aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces/udp/face_udp_node.c
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-02-21 13:48:42 +0000
committerGerrit Code Review <gerrit@fd.io>2019-02-21 13:48:42 +0000
commit1e2e32c281ddb053d03efd74eea660dfb0b6316f (patch)
treeeca31dc7e3bc695f3ab048e8ce139459a76307fe /hicn-plugin/src/faces/udp/face_udp_node.c
parent837def2658716940633d39429619b9c2bd8d9b12 (diff)
parenta7b633f4c8b4d7245c4411cdf249f6e0809fb60b (diff)
Merge "[HICN-75] fixed forwarding issue in udp face and improved packet tracing to show the hicn name"
Diffstat (limited to 'hicn-plugin/src/faces/udp/face_udp_node.c')
-rw-r--r--hicn-plugin/src/faces/udp/face_udp_node.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c
index a8851ad79..5f19eb0af 100644
--- a/hicn-plugin/src/faces/udp/face_udp_node.c
+++ b/hicn-plugin/src/faces/udp/face_udp_node.c
@@ -54,7 +54,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
- u8 packet_data[128 - 1 * sizeof (u32)];
+ u8 packet_data[60];
}
hicn_face_udp4_input_trace_t;
@@ -72,7 +72,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
- u8 packet_data[128 - 1 * sizeof (u32)];
+ u8 packet_data[60];
}
hicn_face_udp6_input_trace_t;
@@ -101,6 +101,10 @@ typedef enum
#define TRACE_INPUT_PKT_UDP4 hicn_face_udp4_input_trace_t
#define TRACE_INPUT_PKT_UDP6 hicn_face_udp6_input_trace_t
+#define SIZE_HICN_HEADER4 sizeof(ip4_header_t) + sizeof(udp_header_t)
+#define SIZE_HICN_HEADER6 sizeof(ip6_header_t) + sizeof(udp_header_t)
+
+
#define face_input_x1(ipv) \
do { \
int ret; \
@@ -359,7 +363,7 @@ hicn_face_udp4_input_format_trace (u8 * s, va_list * args)
s =
format (s, "FACE_UDP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
(int) t->pkt_type, t->sw_if_index, t->next_index,
- t->packet_data[0] == 4 ? format_ip4_header : format_ip6_header,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -440,7 +444,7 @@ hicn_face_udp6_input_format_trace (u8 * s, va_list * args)
s =
format (s, "FACE_UDP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
(int) t->pkt_type, t->sw_if_index, t->next_index,
- t->packet_data[0] == 4 ? format_ip4_header : format_ip6_header,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -570,7 +574,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
- u8 packet_data[128 - 1 * sizeof (u32)];
+ u8 packet_data[60];
}
hicn_face_udp4_output_trace_t;
@@ -580,7 +584,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
- u8 packet_data[128 - 1 * sizeof (u32)];
+ u8 packet_data[60];
}
hicn_face_udp6_output_trace_t;
@@ -639,7 +643,8 @@ hicn_face_udp6_output_trace_t;
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
clib_memcpy_fast (t->packet_data, \
- vlib_buffer_get_current (b0), \
+ vlib_buffer_get_current (b0) + \
+ SIZE_HICN_HEADER##ipv, \
sizeof (t->packet_data)); \
} \
\
@@ -726,7 +731,8 @@ hicn_face_udp6_output_trace_t;
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
clib_memcpy_fast (t->packet_data, \
- vlib_buffer_get_current (b0), \
+ vlib_buffer_get_current (b0) + \
+ SIZE_HICN_HEADER##ipv, \
sizeof (t->packet_data)); \
} \
\
@@ -740,7 +746,8 @@ hicn_face_udp6_output_trace_t;
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
clib_memcpy_fast (t->packet_data, \
- vlib_buffer_get_current (b1), \
+ vlib_buffer_get_current (b1) + \
+ SIZE_HICN_HEADER##ipv, \
sizeof (t->packet_data)); \
} \
/* Verify speculative enqueue, maybe switch current next frame */ \
@@ -800,7 +807,7 @@ hicn_face_udp4_output_format_trace (u8 * s, va_list * args)
s =
format (s, "FACE_UDP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
(int) t->pkt_type, t->sw_if_index, t->next_index,
- t->packet_data[0] == 4 ? format_ip4_header : format_ip6_header,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -876,7 +883,7 @@ hicn_face_udp6_output_format_trace (u8 * s, va_list * args)
s =
format (s, "FACE_UDP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%u",
(int) t->pkt_type, t->sw_if_index, t->next_index,
- t->packet_data[0] == 4 ? format_ip4_header : format_ip6_header,
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
t->packet_data, sizeof (t->packet_data));
return (s);
}