GBP: redirect contracts
[vpp.git] / src / vnet / adj / adj_midchain.c
index e9a510b..268d940 100644 (file)
@@ -460,6 +460,7 @@ adj_nbr_midchain_get_feature_node (ip_adjacency_t *adj)
 void
 adj_midchain_setup (adj_index_t adj_index,
                     adj_midchain_fixup_t fixup,
+                    const void *data,
                     adj_flags_t flags)
 {
     u32 feature_index, tx_node;
@@ -471,6 +472,7 @@ adj_midchain_setup (adj_index_t adj_index,
     adj = adj_get(adj_index);
 
     adj->sub_type.midchain.fixup_func = fixup;
+    adj->sub_type.midchain.fixup_data = data;
     adj->ia_flags |= flags;
 
     arc_index = adj_midchain_get_feature_arc_index_for_link_type (adj);
@@ -503,6 +505,7 @@ adj_midchain_setup (adj_index_t adj_index,
 void
 adj_nbr_midchain_update_rewrite (adj_index_t adj_index,
                                 adj_midchain_fixup_t fixup,
+                                 const void *fixup_data,
                                 adj_flags_t flags,
                                 u8 *rewrite)
 {
@@ -516,13 +519,16 @@ adj_nbr_midchain_update_rewrite (adj_index_t adj_index,
      * one time only update. since we don't support chainging the tunnel
      * src,dst, this is all we need.
      */
-    ASSERT(adj->lookup_next_index == IP_LOOKUP_NEXT_ARP);
+    ASSERT((adj->lookup_next_index == IP_LOOKUP_NEXT_ARP) ||
+           (adj->lookup_next_index == IP_LOOKUP_NEXT_GLEAN) ||
+           (adj->lookup_next_index == IP_LOOKUP_NEXT_BCAST));
+
     /*
      * tunnels can always provide a rewrite.
      */
     ASSERT(NULL != rewrite);
 
-    adj_midchain_setup(adj_index, fixup, flags);
+    adj_midchain_setup(adj_index, fixup, fixup_data, flags);
 
     /*
      * update the rewirte with the workers paused.
@@ -587,8 +593,9 @@ format_adj_midchain (u8* s, va_list *ap)
     ip_adjacency_t * adj = adj_get(index);
 
     s = format (s, "%U", format_vnet_link, adj->ia_link);
-    s = format (s, " via %U ",
-               format_ip46_address, &adj->sub_type.nbr.next_hop);
+    s = format (s, " via %U",
+               format_ip46_address, &adj->sub_type.nbr.next_hop,
+               adj_proto_to_46(adj->ia_nh_proto));
     s = format (s, " %U",
                format_vnet_rewrite,
                &adj->rewrite_header, sizeof (adj->rewrite_data), indent);
@@ -615,6 +622,7 @@ const static dpo_vft_t adj_midchain_dpo_vft = {
     .dv_lock = adj_dpo_lock,
     .dv_unlock = adj_dpo_unlock,
     .dv_format = format_adj_midchain,
+    .dv_get_urpf = adj_dpo_get_urpf,
 };
 
 /**