diff options
author | 2019-02-21 11:40:21 +0100 | |
---|---|---|
committer | 2019-02-21 11:40:21 +0100 | |
commit | a7b633f4c8b4d7245c4411cdf249f6e0809fb60b (patch) | |
tree | 0887427c62dd7e81401fdc65e169dd0e5dc4dc55 /hicn-plugin/src/faces/udp/face_udp_node.c | |
parent | 0d0e74ffb9207cb56fcf4d5b034906a406c1bffa (diff) |
[HICN-75] fixed forwarding issue in udp face and improved packet tracing to show the hicn name
Change-Id: I74426c541324d66c2d1b0353afcca17c5aedceba
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
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); } |