summaryrefslogtreecommitdiffstats
path: root/hicn-plugin
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-03-14 15:04:59 +0000
committerGerrit Code Review <gerrit@fd.io>2019-03-14 15:04:59 +0000
commitbb563a76bd1b258534ee19be98dfee735908ea22 (patch)
tree9f76f22a85692789bb2684f90a7f55425988444c /hicn-plugin
parent1266a593b683ee2dd3d777d943f48862475e89a7 (diff)
parent3ae22de77996e7138107be9716545867210468db (diff)
Merge "[HICN-112] Fixed bug on dymanic udp face creation. Fixed visualization of udp faces with "hicn show" command"
Diffstat (limited to 'hicn-plugin')
-rw-r--r--hicn-plugin/src/faces/udp/dpo_udp.c9
-rw-r--r--hicn-plugin/src/faces/udp/dpo_udp.h7
-rw-r--r--hicn-plugin/src/faces/udp/face_udp.c20
-rw-r--r--hicn-plugin/src/faces/udp/iface_udp_node.c35
4 files changed, 41 insertions, 30 deletions
diff --git a/hicn-plugin/src/faces/udp/dpo_udp.c b/hicn-plugin/src/faces/udp/dpo_udp.c
index eadcb6abd..987d52bb7 100644
--- a/hicn-plugin/src/faces/udp/dpo_udp.c
+++ b/hicn-plugin/src/faces/udp/dpo_udp.c
@@ -77,7 +77,8 @@ hicn_dpo_udp4_create (dpo_id_t * dpo,
{
u16 net_src_port = clib_host_to_net_u16 (src_port);
u16 net_dst_port = clib_host_to_net_u16 (dst_port);
- hicn_face_t *face = hicn_face_udp4_get (src_ip, dst_ip, src_port, dst_port);
+ hicn_face_t *face =
+ hicn_face_udp4_get (src_ip, dst_ip, net_src_port, net_dst_port);
u8 hicnb_flags;
/* ip_csum_t sum0; */
@@ -86,7 +87,7 @@ hicn_dpo_udp4_create (dpo_id_t * dpo,
return HICN_ERROR_FACE_ALREADY_CREATED;
hicn_dpo_udp4_add_and_lock (dpo, src_ip, dst_ip, net_src_port, net_dst_port,
- node_index, &hicnb_flags);
+ node_index, &hicnb_flags, sw_if);
face = hicn_dpoi_get_from_idx (dpo->dpoi_index);
@@ -97,7 +98,6 @@ hicn_dpo_udp4_create (dpo_id_t * dpo,
face->shared.flags = flags;
face->shared.adj = ip_adj;
- face->shared.sw_if = sw_if;
*face_id = hicn_dpoi_get_index (face);
return HICN_ERROR_NONE;
@@ -124,13 +124,12 @@ hicn_dpo_udp6_create (dpo_id_t * dpo,
return HICN_ERROR_FACE_ALREADY_CREATED;
hicn_dpo_udp6_add_and_lock (dpo, src_ip, dst_ip, net_src_port, net_dst_port,
- node_index, &hicnb_flags);
+ node_index, &hicnb_flags, sw_if);
face = hicn_dpoi_get_from_idx (dpo->dpoi_index);
face->shared.flags = flags;
face->shared.adj = ip_adj;
- face->shared.sw_if = sw_if;
*face_id = hicn_dpoi_get_index (face);
return HICN_ERROR_NONE;
diff --git a/hicn-plugin/src/faces/udp/dpo_udp.h b/hicn-plugin/src/faces/udp/dpo_udp.h
index cc71a8d44..3d74a1884 100644
--- a/hicn-plugin/src/faces/udp/dpo_udp.h
+++ b/hicn-plugin/src/faces/udp/dpo_udp.h
@@ -115,7 +115,7 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo,
const ip4_address_t * local_addr,
const ip4_address_t * remote_addr,
u16 local_port, u16 remote_port,
- u32 node_index, u8 * hicnb_flags)
+ u32 node_index, u8 * hicnb_flags, u32 sw_if)
{
dpo->dpoi_type = DPO_FIRST;
dpo->dpoi_proto = DPO_PROTO_NONE;
@@ -146,6 +146,7 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo,
face->shared.face_type = hicn_face_udp_type;
face->shared.flags = HICN_FACE_FLAGS_IFACE;
face->shared.locks = 0;
+ face->shared.sw_if = sw_if;
hicn_face_udp_key_t key;
hicn_face_udp4_get_key (local_addr, remote_addr, local_port,
@@ -153,7 +154,6 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo,
hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
mhash_set_mem (&hicn_face_udp_hashtb, &key, (uword *) & dpoi_index, 0);
- face = face;
*hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP4, dpoi_index);
@@ -257,7 +257,7 @@ hicn_dpo_udp6_add_and_lock (dpo_id_t * dpo,
const ip6_address_t * local_addr,
const ip6_address_t * remote_addr,
u16 local_port, u16 remote_port,
- u32 node_index, u8 * hicnb_flags)
+ u32 node_index, u8 * hicnb_flags, u32 sw_if)
{
dpo->dpoi_type = DPO_FIRST;
dpo->dpoi_proto = DPO_PROTO_NONE;
@@ -288,6 +288,7 @@ hicn_dpo_udp6_add_and_lock (dpo_id_t * dpo,
face->shared.face_type = hicn_face_udp_type;
face->shared.flags = HICN_FACE_FLAGS_IFACE;
face->shared.locks = 0;
+ face->shared.sw_if = sw_if;
hicn_face_udp_key_t key;
hicn_face_udp6_get_key (local_addr, remote_addr, local_port,
diff --git a/hicn-plugin/src/faces/udp/face_udp.c b/hicn-plugin/src/faces/udp/face_udp.c
index ea16c85fe..924c79a91 100644
--- a/hicn-plugin/src/faces/udp/face_udp.c
+++ b/hicn-plugin/src/faces/udp/face_udp.c
@@ -79,15 +79,17 @@ hicn_face_udp_init (vlib_main_t * vm)
/* Default Strategy has index 0 and it always exists */
strategy_face_udp4_vlib_edge = vlib_node_add_next (vm,
hicn_dpo_get_strategy_vft
- (default_dpo.hicn_dpo_get_type
- ())->get_strategy_node_index
+ (default_dpo.
+ hicn_dpo_get_type ())->
+ get_strategy_node_index
(),
- hicn_face_udp4_output_node.index);
+ hicn_face_udp4_output_node.
+ index);
strategy_face_udp6_vlib_edge =
vlib_node_add_next (vm,
- hicn_dpo_get_strategy_vft
- (default_dpo.hicn_dpo_get_type
- ())->get_strategy_node_index (),
+ hicn_dpo_get_strategy_vft (default_dpo.
+ hicn_dpo_get_type ())->
+ get_strategy_node_index (),
hicn_face_udp6_output_node.index);
/*
@@ -264,7 +266,8 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
}
retx_t *retx = vlib_process_signal_event_data (vlib_get_main (),
- hicn_mapme_eventmgr_process_node.index,
+ hicn_mapme_eventmgr_process_node.
+ index,
HICN_MAPME_EVENT_FACE_ADD, 1,
sizeof (retx_t));
*retx = (retx_t)
@@ -313,7 +316,6 @@ 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,
@@ -339,7 +341,7 @@ format_hicn_face_udp (u8 * s, va_list * args)
}
else
{
- s = format (s, "IFace %d: ", format_white_space, indent, face_id);
+ s = format (s, "%U iFace %d: ", format_white_space, indent, face_id);
if (udp_face->hdrs.ip4.ip.ip_version_and_header_length == ipv)
{
s = format (s, "type UDP local %U|%u",
diff --git a/hicn-plugin/src/faces/udp/iface_udp_node.c b/hicn-plugin/src/faces/udp/iface_udp_node.c
index c71616b77..9558ebfce 100644
--- a/hicn-plugin/src/faces/udp/iface_udp_node.c
+++ b/hicn-plugin/src/faces/udp/iface_udp_node.c
@@ -39,11 +39,13 @@ hicn_iface_udp_init (vlib_main_t * vm)
{
data_fwd_face_udp4_vlib_edge = vlib_node_add_next (vm,
hicn_data_fwd_node.index,
- hicn_iface_udp4_output_node.index);
+ hicn_iface_udp4_output_node.
+ index);
data_fwd_face_udp6_vlib_edge = vlib_node_add_next (vm,
hicn_data_fwd_node.index,
- hicn_iface_udp6_output_node.index);
+ hicn_iface_udp6_output_node.
+ index);
u32 temp_index4 = vlib_node_add_next (vm,
hicn_interest_hitcs_node.index,
@@ -185,7 +187,8 @@ typedef enum
udp_hdr->src_port, \
GET_FACE_UDP##ipv \
(), \
- &hicnb0->flags); \
+ &hicnb0->flags, \
+ vnet_buffer(b0)->sw_if_index[VLIB_RX]); \
\
vlib_buffer_advance(b0, sizeof(IP_HEADER_##ipv) + \
sizeof(udp_header_t)); \
@@ -275,7 +278,8 @@ typedef enum
udp_hdr0->src_port, \
GET_FACE_UDP##ipv \
(), \
- &hicnb0->flags); \
+ &hicnb0->flags, \
+ vnet_buffer(b0)->sw_if_index[VLIB_RX]); \
\
\
HICN_IFACE_UDP_ADD_LOCK_IP##ipv \
@@ -286,7 +290,8 @@ typedef enum
udp_hdr1->src_port, \
GET_FACE_UDP##ipv \
(), \
- &hicnb1->flags); \
+ &hicnb1->flags, \
+ vnet_buffer(b1)->sw_if_index[VLIB_RX]); \
\
vlib_buffer_advance(b0, sizeof(IP_HEADER_##ipv) + \
sizeof(udp_header_t)); \
@@ -379,8 +384,9 @@ 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] & 0xf0) == 0x40 ? 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 +466,9 @@ 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] & 0xf0) == 0x40 ? 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);
}
@@ -819,8 +826,9 @@ hicn_iface_udp4_output_format_trace (u8 * s, va_list * args)
format (s,
"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] & 0xf0) == 0x40 ? 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);
}
@@ -899,8 +907,9 @@ hicn_iface_udp6_output_format_trace (u8 * s, va_list * args)
format (s,
"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] & 0xf0) == 0x40 ? 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);
}