aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src
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
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')
-rw-r--r--hicn-plugin/src/faces/ip/face_ip_node.c8
-rw-r--r--hicn-plugin/src/faces/ip/iface_ip_node.c8
-rw-r--r--hicn-plugin/src/faces/udp/face_udp.c1
-rw-r--r--hicn-plugin/src/faces/udp/face_udp_node.c29
-rw-r--r--hicn-plugin/src/faces/udp/iface_udp_node.c38
5 files changed, 49 insertions, 35 deletions
diff --git a/hicn-plugin/src/faces/ip/face_ip_node.c b/hicn-plugin/src/faces/ip/face_ip_node.c
index f0408860e..7b32f7355 100644
--- a/hicn-plugin/src/faces/ip/face_ip_node.c
+++ b/hicn-plugin/src/faces/ip/face_ip_node.c
@@ -56,7 +56,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_ip4_input_trace_t;
@@ -74,7 +74,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_ip6_input_trace_t;
@@ -483,7 +483,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_ip4_output_trace_t;
@@ -493,7 +493,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_ip6_output_trace_t;
diff --git a/hicn-plugin/src/faces/ip/iface_ip_node.c b/hicn-plugin/src/faces/ip/iface_ip_node.c
index a0baa7d8c..fcf43ebd7 100644
--- a/hicn-plugin/src/faces/ip/iface_ip_node.c
+++ b/hicn-plugin/src/faces/ip/iface_ip_node.c
@@ -77,7 +77,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_ip4_input_trace_t;
typedef enum
@@ -94,7 +94,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_ip6_input_trace_t;
typedef enum
@@ -530,7 +530,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_ip4_output_trace_t;
typedef enum
@@ -546,7 +546,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_ip6_output_trace_t;
typedef enum
diff --git a/hicn-plugin/src/faces/udp/face_udp.c b/hicn-plugin/src/faces/udp/face_udp.c
index ae1fd89c7..ea16c85fe 100644
--- a/hicn-plugin/src/faces/udp/face_udp.c
+++ b/hicn-plugin/src/faces/udp/face_udp.c
@@ -313,6 +313,7 @@ format_hicn_face_udp (u8 * s, va_list * args)
s =
format (s, "remote %U|%u ", format_ip4_address,
&udp_face->hdrs.ip4.ip.dst_address,
+
clib_net_to_host_u16 (udp_face->hdrs.ip4.udp.dst_port));
s = format (s, "%U", format_vnet_link, adj->ia_link);
s = format (s, " dev %U", format_vnet_sw_interface_name, vnm,
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);
}
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);
}