aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/faces')
-rw-r--r--hicn-plugin/src/faces/ip/face_ip_node.c13
-rw-r--r--hicn-plugin/src/faces/udp/dpo_udp.h7
-rw-r--r--hicn-plugin/src/faces/udp/face_udp.h8
-rw-r--r--hicn-plugin/src/faces/udp/face_udp_node.c37
-rw-r--r--hicn-plugin/src/faces/udp/iface_udp_node.c18
5 files changed, 57 insertions, 26 deletions
diff --git a/hicn-plugin/src/faces/ip/face_ip_node.c b/hicn-plugin/src/faces/ip/face_ip_node.c
index 109750de8..945895fa0 100644
--- a/hicn-plugin/src/faces/ip/face_ip_node.c
+++ b/hicn-plugin/src/faces/ip/face_ip_node.c
@@ -465,7 +465,6 @@ static inline void
hicn_face_rewrite_interest (vlib_main_t * vm, vlib_buffer_t * b0,
hicn_face_t * face, u32 * next)
{
- ip_adjacency_t *adj = adj_get (face->shared.adj);
hicn_header_t *hicn = vlib_buffer_get_current (b0);
@@ -477,11 +476,19 @@ hicn_face_rewrite_interest (vlib_main_t * vm, vlib_buffer_t * b0,
hicn_ops_vft[type.l1]->rewrite_interest (type, &hicn->protocol,
&ip_face->local_addr, &temp_addr);
+ int is_iface = 0;
+ ip_adjacency_t *adj;
+ if (PREDICT_FALSE (face->shared.adj == ~0))
+ is_iface = 1;
+ else
+ adj = adj_get (face->shared.adj);
+
/* In case the adj is not complete, we look if a better one exists, otherwise we send an arp request
* This is necessary to account for the case in which when we create a face, there isn't a /128(/32) adjacency and we match with a more general route which is in glean state
* In this case in fact, the general route will not be update upone receiving of a arp or neighbour responde, but a new /128(/32) will be created
*/
- if (PREDICT_FALSE (adj->lookup_next_index < IP_LOOKUP_NEXT_REWRITE))
+ if (PREDICT_FALSE
+ (is_iface || adj->lookup_next_index < IP_LOOKUP_NEXT_REWRITE))
{
fib_prefix_t fib_pfx;
fib_node_index_t fib_entry_index;
@@ -495,6 +502,8 @@ hicn_face_rewrite_interest (vlib_main_t * vm, vlib_buffer_t * b0,
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
face->shared.adj = fib_entry_get_adj (fib_entry_index);
+ face->shared.flags &= ~HICN_FACE_FLAGS_IFACE;
+ face->shared.flags |= HICN_FACE_FLAGS_FACE;
adj = adj_get (face->shared.adj);
diff --git a/hicn-plugin/src/faces/udp/dpo_udp.h b/hicn-plugin/src/faces/udp/dpo_udp.h
index 42b9864df..06c65a9c2 100644
--- a/hicn-plugin/src/faces/udp/dpo_udp.h
+++ b/hicn-plugin/src/faces/udp/dpo_udp.h
@@ -24,6 +24,9 @@
#include "../face.h"
#include "../../error.h"
+extern u32 strategy_face_udp4_vlib_edge;
+extern u32 strategy_face_udp6_vlib_edge;
+
/**
* @brief Initialize the internal structures of the dpo udp face module.
@@ -88,7 +91,7 @@ hicn_dpo_udp4_lock (dpo_id_t * dpo,
index_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP4, dpoi_index);
- dpo->dpoi_next_node = ~0;
+ dpo->dpoi_next_node = strategy_face_udp4_vlib_edge;
dpo_lock (dpo);
*hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
@@ -208,7 +211,7 @@ hicn_dpo_udp6_lock (dpo_id_t * dpo,
hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_udp_type, DPO_PROTO_IP6, dpoi_index);
- dpo->dpoi_next_node = ~0;
+ dpo->dpoi_next_node = strategy_face_udp6_vlib_edge;
dpo_lock (dpo);
*hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
diff --git a/hicn-plugin/src/faces/udp/face_udp.h b/hicn-plugin/src/faces/udp/face_udp.h
index 2bd420b55..cea3e7262 100644
--- a/hicn-plugin/src/faces/udp/face_udp.h
+++ b/hicn-plugin/src/faces/udp/face_udp.h
@@ -248,7 +248,9 @@ hicn_iface_udp6_add (const ip6_address_t * local_addr,
remote_port, &key);
*pfaceid = hicn_dpoi_get_index (face);
- mhash_set_mem (&hicn_face_udp_hashtb, &key, (uword *) & pfaceid, 0);
+ hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
+
+ mhash_set_mem (&hicn_face_udp_hashtb, &key, (uword *) & dpoi_index, 0);
for (int i = 0; i < HICN_N_COUNTER; i++)
{
@@ -300,7 +302,9 @@ hicn_iface_udp4_add (const ip4_address_t * local_addr,
remote_port, &key);
*pfaceid = hicn_dpoi_get_index (face);
- mhash_set_mem (&hicn_face_udp_hashtb, &key, (uword *) & pfaceid, 0);
+ hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
+
+ mhash_set_mem (&hicn_face_udp_hashtb, &key, (uword *) & dpoi_index, 0);
for (int i = 0; i < HICN_N_COUNTER; i++)
{
diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c
index 5d304693d..232b86d70 100644
--- a/hicn-plugin/src/faces/udp/face_udp_node.c
+++ b/hicn-plugin/src/faces/udp/face_udp_node.c
@@ -138,8 +138,8 @@ typedef enum
\
inner_ip_hdr = (u8 *)(udp_hdr + 1); \
u8 is_v6 = hicn_is_v6((hicn_header_t *)inner_ip_hdr); \
- u8 is_icmp = is_v6*(inner_ip_hdr[7] == IPPROTO_ICMPV6) + \
- (1 - is_v6)*(inner_ip_hdr[10] == IPPROTO_ICMPV4); \
+ u8 is_icmp = is_v6*(inner_ip_hdr[6] == IPPROTO_ICMPV6) + \
+ (1 - is_v6)*(inner_ip_hdr[9] == IPPROTO_ICMPV4); \
\
ret = HICN_DPO_UDP_LOCK_IP##ipv \
(&(hicnb0->face_dpo_id), \
@@ -236,13 +236,13 @@ typedef enum
\
inner_ip_hdr0 = (u8 *)(udp_hdr0 + 1); \
u8 is_v6_0 = hicn_is_v6((hicn_header_t *)inner_ip_hdr0); \
- u8 is_icmp0 = is_v6_0*(inner_ip_hdr0[7] == IPPROTO_ICMPV6) + \
- (1 - is_v6_0)*(inner_ip_hdr0[10] == IPPROTO_ICMPV4); \
+ u8 is_icmp0 = is_v6_0*(inner_ip_hdr0[6] == IPPROTO_ICMPV6) + \
+ (1 - is_v6_0)*(inner_ip_hdr0[9] == IPPROTO_ICMPV4); \
\
inner_ip_hdr1 = (u8 *)(udp_hdr1 + 1); \
u8 is_v6_1 = hicn_is_v6((hicn_header_t *)inner_ip_hdr1); \
- u8 is_icmp1 = is_v6_1*(inner_ip_hdr1[7] == IPPROTO_ICMPV6) + \
- (1 - is_v6_1)*(inner_ip_hdr1[10] == IPPROTO_ICMPV4); \
+ u8 is_icmp1 = is_v6_1*(inner_ip_hdr1[6] == IPPROTO_ICMPV6) + \
+ (1 - is_v6_1)*(inner_ip_hdr1[9] == IPPROTO_ICMPV4); \
\
ret0 = HICN_DPO_UDP_LOCK_IP##ipv \
(&(hicnb0->face_dpo_id), \
@@ -507,7 +507,6 @@ hicn_face_udp4_encap (vlib_main_t * vm,
ip4_header_t *ip0;
udp_header_t *udp0;
hicn_face_udp_t *face_udp = (hicn_face_udp_t *) face->data;
- ip_adjacency_t *adj = adj_get (face->shared.adj);
/* ip */
ip0 = vlib_buffer_get_current (outer_b0);
@@ -535,11 +534,19 @@ hicn_face_udp4_encap (vlib_main_t * vm,
length /* changed member */ );
ip0->checksum = sum0;
+ int is_iface = 0;
+ ip_adjacency_t *adj;
+ if (PREDICT_FALSE (face->shared.adj == ~0))
+ is_iface = 1;
+ else
+ adj = adj_get (face->shared.adj);
+
/* In case the adj is not complete, we look if a better one exists, otherwise we send an arp request
* This is necessary to account for the case in which when we create a face, there isn't a /128(/32) adjacency and we match with a more general route which is in glean state
* In this case in fact, the general route will not be update upone receiving of a arp or neighbour responde, but a new /128(/32) will be created
*/
- if (PREDICT_FALSE (adj->lookup_next_index < IP_LOOKUP_NEXT_REWRITE))
+ if (PREDICT_FALSE
+ (is_iface || adj->lookup_next_index < IP_LOOKUP_NEXT_REWRITE))
{
fib_prefix_t fib_pfx;
fib_node_index_t fib_entry_index;
@@ -555,6 +562,8 @@ hicn_face_udp4_encap (vlib_main_t * vm,
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
face->shared.adj = fib_entry_get_adj (fib_entry_index);
+ face->shared.flags &= ~HICN_FACE_FLAGS_IFACE;
+ face->shared.flags |= HICN_FACE_FLAGS_FACE;
adj = adj_get (face->shared.adj);
}
@@ -573,7 +582,6 @@ hicn_face_udp6_encap (vlib_main_t * vm,
ip6_header_t *ip0;
udp_header_t *udp0;
hicn_face_udp_t *face_udp = (hicn_face_udp_t *) face->data;
- ip_adjacency_t *adj = adj_get (face->shared.adj);
/* ip */
ip0 = vlib_buffer_get_current (outer_b0);
@@ -595,11 +603,18 @@ hicn_face_udp6_encap (vlib_main_t * vm,
if (udp0->checksum == 0)
udp0->checksum = 0xffff;
+ int is_iface = 0;
+ ip_adjacency_t *adj;
+ if (PREDICT_FALSE (face->shared.adj == ~0))
+ is_iface = 1;
+ else
+ adj = adj_get (face->shared.adj);
+
/* In case the adj is not complete, we look if a better one exists, otherwise we send an arp request
* This is necessary to account for the case in which when we create a face, there isn't a /128(/32) adjacency and we match with a more general route which is in glean state
* In this case in fact, the general route will not be update upone receiving of a arp or neighbour responde, but a new /128(/32) will be created
*/
- if (PREDICT_FALSE (adj->lookup_next_index < IP_LOOKUP_NEXT_REWRITE))
+ if (PREDICT_FALSE (is_iface || adj->lookup_next_index < IP_LOOKUP_NEXT_REWRITE))
{
fib_prefix_t fib_pfx;
fib_node_index_t fib_entry_index;
@@ -615,6 +630,8 @@ hicn_face_udp6_encap (vlib_main_t * vm,
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
face->shared.adj = fib_entry_get_adj (fib_entry_index);
+ face->shared.flags &= ~HICN_FACE_FLAGS_IFACE;
+ face->shared.flags |= HICN_FACE_FLAGS_FACE;
adj = adj_get (face->shared.adj);
}
diff --git a/hicn-plugin/src/faces/udp/iface_udp_node.c b/hicn-plugin/src/faces/udp/iface_udp_node.c
index 738aad829..1fdd68f0b 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,
@@ -173,8 +171,8 @@ typedef enum
\
inner_ip_hdr = (u8 *)(udp_hdr + 1); \
u8 is_v6 = hicn_is_v6((hicn_header_t *)inner_ip_hdr); \
- u8 is_icmp = is_v6*(inner_ip_hdr[7] == IPPROTO_ICMPV6) + \
- (1 - is_v6)*(inner_ip_hdr[10] == IPPROTO_ICMPV4); \
+ u8 is_icmp = is_v6*(inner_ip_hdr[6] == IPPROTO_ICMPV6) + \
+ (1 - is_v6)*(inner_ip_hdr[9] == IPPROTO_ICMPV4); \
\
next0 = is_icmp*NEXT_MAPME_UDP##ipv + \
(1-is_icmp)*NEXT_INTEREST_UDP##ipv; \
@@ -267,10 +265,10 @@ typedef enum
inner_ip_hdr1 = (u8 *)(udp_hdr1 + 1); \
u8 is_v6_0 = hicn_is_v6((hicn_header_t *)inner_ip_hdr0); \
u8 is_v6_1 = hicn_is_v6((hicn_header_t *)inner_ip_hdr1); \
- u8 is_icmp0 = is_v6_0*(inner_ip_hdr0[7] == IPPROTO_ICMPV6) + \
- (1 - is_v6_0)*(inner_ip_hdr0[10] == IPPROTO_ICMPV4); \
- u8 is_icmp1 = is_v6_1*(inner_ip_hdr1[7] == IPPROTO_ICMPV6) + \
- (1 - is_v6_1)*(inner_ip_hdr1[10] == IPPROTO_ICMPV4); \
+ u8 is_icmp0 = is_v6_0*(inner_ip_hdr0[6] == IPPROTO_ICMPV6) + \
+ (1 - is_v6_0)*(inner_ip_hdr0[9] == IPPROTO_ICMPV4); \
+ u8 is_icmp1 = is_v6_1*(inner_ip_hdr1[6] == IPPROTO_ICMPV6) + \
+ (1 - is_v6_1)*(inner_ip_hdr1[9] == IPPROTO_ICMPV4); \
\
next0 = is_icmp0*NEXT_MAPME_UDP##ipv + \
(1-is_icmp0)*NEXT_INTEREST_UDP##ipv; \