diff options
Diffstat (limited to 'hicn-plugin/src/faces')
-rw-r--r-- | hicn-plugin/src/faces/app/face_prod.c | 19 | ||||
-rw-r--r-- | hicn-plugin/src/faces/face.c | 2 | ||||
-rw-r--r-- | hicn-plugin/src/faces/ip/dpo_ip.h | 4 | ||||
-rw-r--r-- | hicn-plugin/src/faces/ip/face_ip.c | 34 | ||||
-rw-r--r-- | hicn-plugin/src/faces/ip/face_ip_node.c | 56 | ||||
-rw-r--r-- | hicn-plugin/src/faces/ip/iface_ip_node.c | 39 | ||||
-rw-r--r-- | hicn-plugin/src/faces/udp/dpo_udp.h | 20 | ||||
-rw-r--r-- | hicn-plugin/src/faces/udp/face_udp.c | 66 | ||||
-rw-r--r-- | hicn-plugin/src/faces/udp/face_udp_node.c | 74 | ||||
-rw-r--r-- | hicn-plugin/src/faces/udp/iface_udp_node.c | 88 |
10 files changed, 304 insertions, 98 deletions
diff --git a/hicn-plugin/src/faces/app/face_prod.c b/hicn-plugin/src/faces/app/face_prod.c index d06fe2ff3..834b35da9 100644 --- a/hicn-plugin/src/faces/app/face_prod.c +++ b/hicn-plugin/src/faces/app/face_prod.c @@ -144,6 +144,12 @@ hicn_face_prod_add (hicn_prefix_t * prefix, u32 sw_if, u32 * cs_reserved, if_flags |= VNET_SW_INTERFACE_FLAG_ADMIN_UP; vnet_sw_interface_set_flags (vnm, sw_if, if_flags); + u8 *s0; + s0 = format (0, "Prefix %U/%u", format_ip6_address, + &prefix->name, prefix->len); + + vlib_cli_output (vm, "Received request for %s, swif %d\n", s0, sw_if); + if (ip46_address_is_zero (&prefix->name)) { return HICN_ERROR_APPFACE_PROD_PREFIX_NULL; @@ -204,19 +210,20 @@ hicn_face_prod_add (hicn_prefix_t * prefix, u32 sw_if, u32 * cs_reserved, ip4_address_t app_ip4 = get_ip4_address (); ip4_add_del_interface_address (vm, sw_if, - &app_ip4, - ADDR_MGR_IP4_CONS_LEN, - 0 /* is_del */ ); + &app_ip4, 32, 0 /* is_del */ ); app_ip = to_ip46 ( /* isv6 */ 0, app_ip4.as_u8); } else { ip6_address_t app_ip6 = get_ip6_address (); + u8 *s0; + s0 = format (0, "Prefix %U", format_ip6_address, &app_ip6); + + vlib_cli_output (vm, "Setting ip address %s\n", s0); + ip6_add_del_interface_address (vm, sw_if, - &app_ip6, - ADDR_MGR_IP6_CONS_LEN, - 0 /* is_del */ ); + &app_ip6, 128, 0 /* is_del */ ); app_ip = to_ip46 ( /* isv6 */ 1, app_ip6.as_u8); } diff --git a/hicn-plugin/src/faces/face.c b/hicn-plugin/src/faces/face.c index f0559bb98..26dcf960b 100644 --- a/hicn-plugin/src/faces/face.c +++ b/hicn-plugin/src/faces/face.c @@ -72,7 +72,7 @@ void hicn_face_module_init (vlib_main_t * vm) { pool_validate (hicn_dpoi_face_pool); - + pool_alloc (hicn_dpoi_face_pool, 1024); hicn_face_ip_init (vm); hicn_iface_ip_init (vm); hicn_face_udp_init (vm); diff --git a/hicn-plugin/src/faces/ip/dpo_ip.h b/hicn-plugin/src/faces/ip/dpo_ip.h index 426d5a146..164931a06 100644 --- a/hicn-plugin/src/faces/ip/dpo_ip.h +++ b/hicn-plugin/src/faces/ip/dpo_ip.h @@ -120,6 +120,10 @@ hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo, const ip4_address_t * remote_addr, u32 sw_if, u32 node_index) { + dpo->dpoi_type = DPO_FIRST; + dpo->dpoi_proto = DPO_PROTO_NONE; + dpo->dpoi_index = INDEX_INVALID; + dpo->dpoi_next_node = 0; /*All (complete) faces are indexed by remote addess as well */ hicn_face_t *face = hicn_face_ip4_get (remote_addr, sw_if, &hicn_face_ip_remote_hashtb); diff --git a/hicn-plugin/src/faces/ip/face_ip.c b/hicn-plugin/src/faces/ip/face_ip.c index c7f6a1ba1..c1e264e44 100644 --- a/hicn-plugin/src/faces/ip/face_ip.c +++ b/hicn-plugin/src/faces/ip/face_ip.c @@ -40,21 +40,17 @@ hicn_face_ip_init (vlib_main_t * vm) /* Default Strategy has index 0 and it always exists */ strategy_face_ip4_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_ip4_output_node. - index); + hicn_face_ip4_output_node.index); strategy_face_ip6_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_ip6_output_node. - index); + hicn_face_ip6_output_node.index); /* * Create and edge between al the other strategy nodes * and the ip_encap nodes. @@ -73,6 +69,17 @@ hicn_face_ip_init (vlib_main_t * vm) ASSERT (temp_index6 == strategy_face_ip6_vlib_edge); } + u32 temp_index4 = vlib_node_add_next (vm, + hicn_interest_hitpit_node.index, + hicn_face_ip4_output_node.index); + u32 temp_index6 = vlib_node_add_next (vm, + hicn_interest_hitpit_node.index, + hicn_face_ip6_output_node.index); + + ASSERT (temp_index4 == strategy_face_ip4_vlib_edge); + ASSERT (temp_index6 == strategy_face_ip6_vlib_edge); + + hicn_dpo_ip_module_init (); register_face_type (hicn_face_ip_type, &ip_vft, "ip"); @@ -224,8 +231,7 @@ hicn_face_ip_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) @@ -305,8 +311,8 @@ hicn_face_ip_get_dpo (hicn_face_t * face, dpo_id_t * dpo) hicn_face_ip_t *face_ip = (hicn_face_ip_t *) face->data; return hicn_dpo_ip_create_from_face (face, dpo, - ip46_address_is_ip4 (&face_ip-> - remote_addr) ? + ip46_address_is_ip4 + (&face_ip->remote_addr) ? strategy_face_ip4_vlib_edge : strategy_face_ip6_vlib_edge); } diff --git a/hicn-plugin/src/faces/ip/face_ip_node.c b/hicn-plugin/src/faces/ip/face_ip_node.c index b3577f65f..f0408860e 100644 --- a/hicn-plugin/src/faces/ip/face_ip_node.c +++ b/hicn-plugin/src/faces/ip/face_ip_node.c @@ -56,7 +56,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_ip4_input_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_ip4_input_trace_t; typedef enum { @@ -72,7 +74,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_ip6_input_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_ip6_input_trace_t; typedef enum { @@ -157,6 +161,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -245,6 +252,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \ @@ -255,6 +265,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -310,8 +323,9 @@ hicn_face_ip4_input_format_trace (u8 * s, va_list * args) hicn_face_ip4_input_trace_t *t = va_arg (*args, hicn_face_ip4_input_trace_t *); - s = format (s, "FACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "FACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, + format_ip4_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -389,8 +403,9 @@ hicn_face_ip6_input_format_trace (u8 * s, va_list * args) hicn_face_ip6_input_trace_t *t = va_arg (*args, hicn_face_ip6_input_trace_t *); - s = format (s, "FACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "FACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, + format_ip6_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -468,7 +483,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_ip4_output_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_ip4_output_trace_t; /* Trace context struct */ typedef struct @@ -476,7 +493,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_ip6_output_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_ip6_output_trace_t; #define TRACE_OUTPUT_PKT_IP4 hicn_face_ip4_output_trace_t #define TRACE_OUTPUT_PKT_IP6 hicn_face_ip6_output_trace_t @@ -524,6 +543,9 @@ typedef struct t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -591,6 +613,9 @@ typedef struct t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \ @@ -601,6 +626,9 @@ typedef struct t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -657,8 +685,10 @@ hicn_face_ip4_output_format_trace (u8 * s, va_list * args) hicn_face_ip4_output_trace_t *t = va_arg (*args, hicn_face_ip4_output_trace_t *); - s = format (s, "FACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = + format (s, "FACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, + format_ip4_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -728,8 +758,10 @@ hicn_face_ip6_output_format_trace (u8 * s, va_list * args) hicn_face_ip6_output_trace_t *t = va_arg (*args, hicn_face_ip6_output_trace_t *); - s = format (s, "FACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = + format (s, "FACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, + format_ip6_header, t->packet_data, sizeof (t->packet_data)); return (s); } diff --git a/hicn-plugin/src/faces/ip/iface_ip_node.c b/hicn-plugin/src/faces/ip/iface_ip_node.c index 9ca00d7bf..a0baa7d8c 100644 --- a/hicn-plugin/src/faces/ip/iface_ip_node.c +++ b/hicn-plugin/src/faces/ip/iface_ip_node.c @@ -77,6 +77,7 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; + u8 packet_data[128 - 1 * sizeof (u32)]; } hicn_iface_ip4_input_trace_t; typedef enum @@ -93,6 +94,7 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; + u8 packet_data[128 - 1 * sizeof (u32)]; } hicn_iface_ip6_input_trace_t; typedef enum @@ -185,6 +187,10 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ + \ } \ \ \ @@ -270,6 +276,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \ @@ -280,6 +289,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ /* Verify speculative enqueue, maybe switch current next frame */ \ @@ -335,8 +347,8 @@ hicn_iface_ip4_input_format_trace (u8 * s, va_list * args) hicn_iface_ip4_input_trace_t *t = va_arg (*args, hicn_iface_ip4_input_trace_t *); - s = format (s, "IFACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "IFACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip4_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -412,8 +424,8 @@ hicn_iface_ip6_input_format_trace (u8 * s, va_list * args) hicn_iface_ip6_input_trace_t *t = va_arg (*args, hicn_iface_ip6_input_trace_t *); - s = format (s, "IFACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "IFACE_IP6_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip6_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -518,6 +530,7 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; + u8 packet_data[128 - 1 * sizeof (u32)]; } hicn_iface_ip4_output_trace_t; typedef enum @@ -533,6 +546,7 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; + u8 packet_data[128 - 1 * sizeof (u32)]; } hicn_iface_ip6_output_trace_t; typedef enum @@ -598,6 +612,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -669,6 +686,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \ @@ -679,6 +699,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -735,8 +758,8 @@ hicn_iface_ip4_output_format_trace (u8 * s, va_list * args) hicn_iface_ip4_output_trace_t *t = va_arg (*args, hicn_iface_ip4_output_trace_t *); - s = format (s, "IFACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "IFACE_IP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip4_header, t->packet_data, sizeof (t->packet_data)); return (s); } @@ -808,8 +831,8 @@ hicn_iface_ip6_output_format_trace (u8 * s, va_list * args) hicn_iface_ip6_output_trace_t *t = va_arg (*args, hicn_iface_ip6_output_trace_t *); - s = format (s, "IFACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = format (s, "IFACE_IP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d\n%U", + (int) t->pkt_type, t->sw_if_index, t->next_index, format_ip6_header, t->packet_data, sizeof (t->packet_data)); return (s); } diff --git a/hicn-plugin/src/faces/udp/dpo_udp.h b/hicn-plugin/src/faces/udp/dpo_udp.h index 33e4b5d46..cc71a8d44 100644 --- a/hicn-plugin/src/faces/udp/dpo_udp.h +++ b/hicn-plugin/src/faces/udp/dpo_udp.h @@ -75,6 +75,11 @@ hicn_dpo_udp4_lock (dpo_id_t * dpo, const ip4_address_t * remote_addr, u16 local_port, u16 remote_port, u8 * hicnb_flags) { + dpo->dpoi_type = DPO_FIRST; + dpo->dpoi_proto = DPO_PROTO_NONE; + dpo->dpoi_index = INDEX_INVALID; + dpo->dpoi_next_node = 0; + hicn_face_t *face = hicn_face_udp4_get (local_addr, remote_addr, local_port, remote_port); @@ -112,6 +117,11 @@ hicn_dpo_udp4_add_and_lock (dpo_id_t * dpo, u16 local_port, u16 remote_port, u32 node_index, u8 * hicnb_flags) { + dpo->dpoi_type = DPO_FIRST; + dpo->dpoi_proto = DPO_PROTO_NONE; + dpo->dpoi_index = INDEX_INVALID; + dpo->dpoi_next_node = 0; + hicn_face_t *face = hicn_face_udp4_get (local_addr, remote_addr, local_port, remote_port); @@ -207,6 +217,11 @@ hicn_dpo_udp6_lock (dpo_id_t * dpo, const ip6_address_t * remote_addr, u16 local_port, u16 remote_port, u8 * hicnb_flags) { + dpo->dpoi_type = DPO_FIRST; + dpo->dpoi_proto = DPO_PROTO_NONE; + dpo->dpoi_index = INDEX_INVALID; + dpo->dpoi_next_node = 0; + hicn_face_t *face = hicn_face_udp6_get (local_addr, remote_addr, local_port, remote_port); @@ -244,6 +259,11 @@ hicn_dpo_udp6_add_and_lock (dpo_id_t * dpo, u16 local_port, u16 remote_port, u32 node_index, u8 * hicnb_flags) { + dpo->dpoi_type = DPO_FIRST; + dpo->dpoi_proto = DPO_PROTO_NONE; + dpo->dpoi_index = INDEX_INVALID; + dpo->dpoi_next_node = 0; + hicn_face_t *face = hicn_face_udp6_get (local_addr, remote_addr, local_port, remote_port); diff --git a/hicn-plugin/src/faces/udp/face_udp.c b/hicn-plugin/src/faces/udp/face_udp.c index 9d3eedd83..ae1fd89c7 100644 --- a/hicn-plugin/src/faces/udp/face_udp.c +++ b/hicn-plugin/src/faces/udp/face_udp.c @@ -20,6 +20,7 @@ #include "face_udp_node.h" #include "dpo_udp.h" #include "../face.h" +#include "../../infra.h" #include "../../strategy.h" #include "../../strategy_dpo_manager.h" #include "../../hicn.h" @@ -78,17 +79,15 @@ 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); /* @@ -109,6 +108,16 @@ hicn_face_udp_init (vlib_main_t * vm) ASSERT (temp_index6 == strategy_face_udp6_vlib_edge); } + u32 temp_index4 = vlib_node_add_next (vm, + hicn_interest_hitpit_node.index, + hicn_face_udp4_output_node.index); + u32 temp_index6 = vlib_node_add_next (vm, + hicn_interest_hitpit_node.index, + hicn_face_udp6_output_node.index); + + ASSERT (temp_index4 == strategy_face_udp4_vlib_edge); + ASSERT (temp_index6 == strategy_face_udp6_vlib_edge); + hicn_dpo_udp_module_init (); register_face_type (hicn_face_udp_type, &udp_vft, "udp");; @@ -119,8 +128,6 @@ hicn_face_udp_add (const ip46_address_t * local_addr, const ip46_address_t * remote_addr, u16 local_port, u16 remote_port, u32 swif, hicn_face_id_t * pfaceid) { - fib_protocol_t fib_type; - vnet_link_t link_type; adj_index_t ip_adj; int ret = HICN_ERROR_NONE; dpo_proto_t dpo_proto; @@ -131,9 +138,20 @@ hicn_face_udp_add (const ip46_address_t * local_addr, if (ip46_address_is_ip4 (local_addr) && ip46_address_is_ip4 (remote_addr)) { - link_type = VNET_LINK_IP4; - fib_type = FIB_PROTOCOL_IP4; - ip_adj = adj_nbr_add_or_lock (fib_type, link_type, remote_addr, swif); + fib_prefix_t fib_pfx; + fib_node_index_t fib_entry_index; + fib_prefix_from_ip46_addr (remote_addr, &fib_pfx); + fib_pfx.fp_len = 32; + + u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto, + HICN_FIB_TABLE, + FIB_SOURCE_PLUGIN_HI); + fib_entry_index = fib_table_lookup (fib_index, &fib_pfx); + + ip_adj = fib_entry_get_adj (fib_entry_index); + + if (ip_adj == ~0) + return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND; hicn_face_t *face = hicn_face_udp4_get (&local_addr->ip4, &remote_addr->ip4, local_port, @@ -181,13 +199,25 @@ hicn_face_udp_add (const ip46_address_t * local_addr, *pfaceid = hicn_dpoi_get_index (face); dpo_proto = DPO_PROTO_IP4; + fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI); } else if (!ip46_address_is_ip4 (local_addr) && !ip46_address_is_ip4 (remote_addr)) { - link_type = VNET_LINK_IP6; - fib_type = FIB_PROTOCOL_IP6; - ip_adj = adj_nbr_add_or_lock (fib_type, link_type, remote_addr, swif); + fib_prefix_t fib_pfx; + fib_node_index_t fib_entry_index; + fib_prefix_from_ip46_addr (remote_addr, &fib_pfx); + fib_pfx.fp_len = 128; + + u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto, + HICN_FIB_TABLE, + FIB_SOURCE_PLUGIN_HI); + fib_entry_index = fib_table_lookup (fib_index, &fib_pfx); + + ip_adj = fib_entry_get_adj (fib_entry_index); + + if (ip_adj == ~0) + return HICN_ERROR_FACE_IP_ADJ_NOT_FOUND; hicn_face_t *face = hicn_face_udp6_get (&local_addr->ip6, &remote_addr->ip6, local_port, @@ -226,6 +256,7 @@ hicn_face_udp_add (const ip46_address_t * local_addr, *pfaceid = hicn_dpoi_get_index (face); dpo_proto = DPO_PROTO_IP6; + fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI); } else { @@ -233,8 +264,7 @@ 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) diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c index ac7a63731..a8851ad79 100644 --- a/hicn-plugin/src/faces/udp/face_udp_node.c +++ b/hicn-plugin/src/faces/udp/face_udp_node.c @@ -54,7 +54,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_udp4_input_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_udp4_input_trace_t; typedef enum { @@ -70,7 +72,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_udp6_input_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_udp6_input_trace_t; typedef enum { @@ -163,7 +167,10 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_CONTENT; \ 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), \ + sizeof (t->packet_data)); \ + } \ \ \ /* Verify speculative enqueue, maybe switch current next frame */ \ @@ -279,6 +286,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_CONTENT; \ 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), \ + sizeof (t->packet_data)); \ } \ \ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \ @@ -289,6 +299,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_CONTENT; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -343,8 +356,11 @@ hicn_face_udp4_input_format_trace (u8 * s, va_list * args) hicn_face_udp4_input_trace_t *t = va_arg (*args, hicn_face_udp4_input_trace_t *); - s = format (s, "FACE_UDP4_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + 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, sizeof (t->packet_data)); return (s); } @@ -421,8 +437,11 @@ hicn_face_udp6_input_format_trace (u8 * s, va_list * args) hicn_face_udp6_input_trace_t *t = va_arg (*args, hicn_face_udp6_input_trace_t *); - s = format (s, "FACE_UDP6_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + 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, sizeof (t->packet_data)); return (s); } @@ -551,7 +570,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_udp4_output_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_udp4_output_trace_t; /* Trace context struct */ typedef struct @@ -559,7 +580,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_face_udp6_output_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_face_udp6_output_trace_t; #define HICN_FACE_UDP_ENCAP_IP4 hicn_face_udp4_encap #define HICN_FACE_UDP_ENCAP_IP6 hicn_face_udp6_encap @@ -615,6 +638,9 @@ typedef struct t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ to_next[0] = bi0; \ @@ -699,8 +725,24 @@ typedef struct t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ + \ + if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \ + (b1->flags & VLIB_BUFFER_IS_TRACED))) \ + { \ + TRACE_OUTPUT_PKT_UDP##ipv *t = \ + vlib_add_trace (vm, node, b0, sizeof (*t)); \ + t->pkt_type = HICN_PKT_TYPE_INTEREST; \ + 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), \ + sizeof (t->packet_data)); \ + } \ /* Verify speculative enqueue, maybe switch current next frame */ \ vlib_validate_buffer_enqueue_x2 (vm, node, next_index, \ to_next, n_left_to_next, \ @@ -755,8 +797,11 @@ hicn_face_udp4_output_format_trace (u8 * s, va_list * args) hicn_face_udp4_output_trace_t *t = va_arg (*args, hicn_face_udp4_output_trace_t *); - s = format (s, "FACE_UDP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + 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, sizeof (t->packet_data)); return (s); } @@ -828,8 +873,11 @@ hicn_face_udp6_output_format_trace (u8 * s, va_list * args) hicn_face_udp6_output_trace_t *t = va_arg (*args, hicn_face_udp6_output_trace_t *); - s = format (s, "FACE_UDP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + 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, 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 1f6dbd4ab..7b36c4e1e 100644 --- a/hicn-plugin/src/faces/udp/iface_udp_node.c +++ b/hicn-plugin/src/faces/udp/iface_udp_node.c @@ -39,13 +39,11 @@ 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, @@ -88,7 +86,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_iface_udp4_input_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_iface_udp4_input_trace_t; typedef enum { @@ -104,7 +104,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_iface_udp6_input_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_iface_udp6_input_trace_t; typedef enum { @@ -135,7 +137,7 @@ typedef enum #define TRACE_INPUT_PKT_UDP4 hicn_iface_udp4_input_trace_t #define TRACE_INPUT_PKT_UDP6 hicn_iface_udp6_input_trace_t -#define iface_input_x1(ipv) \ +#define iface_input_x1(ipv) \ do { \ vlib_buffer_t *b0; \ u32 bi0; \ @@ -196,6 +198,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -297,6 +302,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -308,6 +316,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -365,8 +376,11 @@ hicn_iface_udp4_input_format_trace (u8 * s, va_list * args) hicn_iface_udp4_input_trace_t *t = va_arg (*args, hicn_iface_udp4_input_trace_t *); - s = format (s, "IFACE_UDP4_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + 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)); return (s); } @@ -443,8 +457,11 @@ hicn_iface_udp6_input_format_trace (u8 * s, va_list * args) hicn_iface_udp6_input_trace_t *t = va_arg (*args, hicn_iface_udp6_input_trace_t *); - s = format (s, "IFACE_UDP6_INPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + 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)); return (s); } @@ -485,9 +502,8 @@ hicn_iface_udp4_encap (vlib_main_t * vm, /* Adjust vlib buffers */ /* Set the right length on the header buffer */ /* Move the next buffer current data pointer back to the ip+tcp header (hicn header) */ - int offset = sizeof (ip4_header_t) + sizeof (udp_header_t); - b0->current_data -= offset; - b0->current_length += offset; + word offset = sizeof (ip4_header_t) + sizeof (udp_header_t); + vlib_buffer_advance (b0, -offset); /* ip */ ip0 = vlib_buffer_get_current (b0); @@ -517,9 +533,8 @@ hicn_iface_udp6_encap (vlib_main_t * vm, hicn_face_udp_t *face_udp = (hicn_face_udp_t *) face->data; /* Adjust vlib buffer */ - int offset = sizeof (ip6_header_t) + sizeof (udp_header_t); - b0->current_data -= offset; - b0->current_length += offset; + word offset = sizeof (ip6_header_t) + sizeof (udp_header_t); + vlib_buffer_advance (b0, -offset); /* ip */ ip0 = vlib_buffer_get_current (b0); @@ -561,7 +576,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_iface_udp4_output_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_iface_udp4_output_trace_t; typedef enum { @@ -576,7 +593,9 @@ typedef struct u32 next_index; u32 sw_if_index; u8 pkt_type; -} hicn_iface_udp6_output_trace_t; + u8 packet_data[128 - 1 * sizeof (u32)]; +} +hicn_iface_udp6_output_trace_t; typedef enum { @@ -633,7 +652,7 @@ typedef enum \ if (PREDICT_TRUE(face != NULL)) \ { \ - HICN_FACE_UDP_ENCAP_IP##ipv \ + HICN_FACE_UDP_ENCAP_IP##ipv \ (vm, b0, face); \ next0 = NEXT_LOOKUP_UDP##ipv; \ stats.pkts_data_count += 1; \ @@ -647,6 +666,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -656,7 +678,7 @@ typedef enum bi0, next0); \ } while(0) -#define iface_output_x2(ipv) \ +#define iface_output_x2(ipv) \ do { \ vlib_buffer_t *b0, *b1; \ u32 bi0, bi1; \ @@ -690,7 +712,7 @@ typedef enum face0 = \ hicn_dpoi_get_from_idx(vnet_buffer (b0)->ip.adj_index[VLIB_TX]); \ face1 = \ - hicn_dpoi_get_from_idx(vnet_buffer (b0)->ip.adj_index[VLIB_TX]); \ + hicn_dpoi_get_from_idx(vnet_buffer (b1)->ip.adj_index[VLIB_TX]); \ \ if (PREDICT_TRUE(face0 != NULL)) \ { \ @@ -716,6 +738,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \ @@ -726,6 +751,9 @@ typedef enum t->pkt_type = HICN_PKT_TYPE_INTEREST; \ 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), \ + sizeof (t->packet_data)); \ } \ \ \ @@ -781,8 +809,12 @@ hicn_iface_udp4_output_format_trace (u8 * s, va_list * args) hicn_iface_udp4_output_trace_t *t = va_arg (*args, hicn_iface_udp4_output_trace_t *); - s = format (s, "IFACE_UDP4_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = + format (s, + "IFACE_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, sizeof (t->packet_data)); return (s); } @@ -857,8 +889,12 @@ hicn_iface_udp6_output_format_trace (u8 * s, va_list * args) hicn_iface_udp6_output_trace_t *t = va_arg (*args, hicn_iface_udp6_output_trace_t *); - s = format (s, "IFACE_UDP6_OUTPUT: pkt: %d, sw_if_index %d, next index %d", - (int) t->pkt_type, t->sw_if_index, t->next_index); + s = + format (s, + "IFACE_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, sizeof (t->packet_data)); return (s); } |