aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces/udp/face_udp_node.c
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-05-07 12:06:04 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-05-07 12:06:04 +0200
commitcd48bbd9685f042a2f1f90678f8fa98a5175ea4d (patch)
tree8412a4f3d56c451250ccb4ea1b687d51ccbb214b /hicn-plugin/src/faces/udp/face_udp_node.c
parent113e0af25e5a802eccac1fc4521f096a2e1bd199 (diff)
[HICN-189] In case the adj is not complete, we look if a better one exists and we follow the new adjacency. The adj in the face is updated accordingly.
Change-Id: Ieb5c02ee66146475d54ee99a77fc795c9bdf3130 Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/faces/udp/face_udp_node.c')
-rw-r--r--hicn-plugin/src/faces/udp/face_udp_node.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c
index df24c477f..184fea679 100644
--- a/hicn-plugin/src/faces/udp/face_udp_node.c
+++ b/hicn-plugin/src/faces/udp/face_udp_node.c
@@ -535,8 +535,31 @@ hicn_face_udp4_encap (vlib_main_t * vm,
length /* changed member */ );
ip0->checksum = sum0;
- vnet_buffer (outer_b0)->ip.adj_index[VLIB_TX] = 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))
+ {
+ fib_prefix_t fib_pfx;
+ fib_node_index_t fib_entry_index;
+ ip46_address_t ip46 =
+ to_ip46 (0, (u8 *) & (face_udp->hdrs.ip4.ip.dst_address));
+ fib_prefix_from_ip46_addr (&ip46, &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);
+ face->shared.adj = fib_entry_get_adj (fib_entry_index);
+
+ adj = adj_get (face->shared.adj);
+ }
+
+ vnet_buffer (outer_b0)->ip.adj_index[VLIB_TX] = face->shared.adj;
*next = adj->lookup_next_index;
}
@@ -572,6 +595,30 @@ hicn_face_udp6_encap (vlib_main_t * vm,
if (udp0->checksum == 0)
udp0->checksum = 0xffff;
+ /* 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))
+ {
+ fib_prefix_t fib_pfx;
+ fib_node_index_t fib_entry_index;
+ ip46_address_t ip46 =
+ to_ip46 (1, (u8 *) & (face_udp->hdrs.ip6.ip.dst_address));
+ fib_prefix_from_ip46_addr (&ip46, &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);
+
+ face->shared.adj = fib_entry_get_adj (fib_entry_index);
+
+ adj = adj_get (face->shared.adj);
+ }
+
vnet_buffer (outer_b0)->ip.adj_index[VLIB_TX] = face->shared.adj;
*next = adj->lookup_next_index;