diff options
Diffstat (limited to 'hicn-plugin/src/faces/udp/face_udp_node.c')
-rw-r--r-- | hicn-plugin/src/faces/udp/face_udp_node.c | 29 |
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); } |