summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces/udp/iface_udp_node.c
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-02-21 11:40:21 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-02-21 11:40:21 +0100
commita7b633f4c8b4d7245c4411cdf249f6e0809fb60b (patch)
tree0887427c62dd7e81401fdc65e169dd0e5dc4dc55 /hicn-plugin/src/faces/udp/iface_udp_node.c
parent0d0e74ffb9207cb56fcf4d5b034906a406c1bffa (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/iface_udp_node.c')
-rw-r--r--hicn-plugin/src/faces/udp/iface_udp_node.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/hicn-plugin/src/faces/udp/iface_udp_node.c b/hicn-plugin/src/faces/udp/iface_udp_node.c
index 7b36c4e1e..c71616b77 100644
--- a/hicn-plugin/src/faces/udp/iface_udp_node.c
+++ b/hicn-plugin/src/faces/udp/iface_udp_node.c
@@ -86,7 +86,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_iface_udp4_input_trace_t;
@@ -104,7 +104,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_iface_udp6_input_trace_t;
@@ -379,8 +379,8 @@ hicn_iface_udp4_input_format_trace (u8 * s, va_list * args)
s =
format (s, "IFACE_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, sizeof (t->packet_data));
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -460,8 +460,8 @@ hicn_iface_udp6_input_format_trace (u8 * s, va_list * args)
s =
format (s, "IFACE_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, sizeof (t->packet_data));
+ (t->packet_data[0] & 0xf0) == 0x40 ? format_ip4_header : format_ip6_header,
+ t->packet_data, sizeof (t->packet_data));
return (s);
}
@@ -576,7 +576,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_iface_udp4_output_trace_t;
@@ -593,7 +593,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_iface_udp6_output_trace_t;
@@ -622,6 +622,9 @@ typedef enum
#define TRACE_OUTPUT_PKT_UDP4 hicn_iface_udp4_output_trace_t
#define TRACE_OUTPUT_PKT_UDP6 hicn_iface_udp6_output_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 iface_output_x1(ipv) \
do { \
vlib_buffer_t *b0; \
@@ -667,7 +670,8 @@ typedef enum
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 +730,7 @@ typedef enum
{ \
HICN_FACE_UDP_ENCAP_IP##ipv \
(vm, b1, face1); \
- next0 = NEXT_LOOKUP_UDP##ipv; \
+ next1 = NEXT_LOOKUP_UDP##ipv; \
stats.pkts_data_count += 1; \
} \
\
@@ -739,7 +743,8 @@ typedef enum
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)); \
} \
\
@@ -752,7 +757,8 @@ typedef enum
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)); \
} \
\
@@ -811,9 +817,9 @@ hicn_iface_udp4_output_format_trace (u8 * s, va_list * args)
s =
format (s,
- "IFACE_UDP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ "IFACE_UDP4_OUTPUT: pkt: %d, out face %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);
}
@@ -891,9 +897,9 @@ hicn_iface_udp6_output_format_trace (u8 * s, va_list * args)
s =
format (s,
- "IFACE_UDP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
+ "IFACE_UDP6_OUTPUT: pkt: %d, out face %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);
}