summaryrefslogtreecommitdiffstats
path: root/src/vnet/adj
diff options
context:
space:
mode:
authorOle Trøan <otroan@employees.org>2018-02-15 21:56:06 +0000
committerOle Trøan <otroan@employees.org>2018-02-15 22:12:03 +0000
commit438f63094465d35c278155484fe85153e438873e (patch)
tree06e0ec613a6b2393ef2021f12ea7545fade9fec2 /src/vnet/adj
parent909c26bda66313b86168dda31003f76410c1d746 (diff)
Revert "Allow interface types to override glean adjacency behaivour"
This reverts commit 8b30e471df4d42214619e1d6c50cc8298426b45f. Change-Id: I99edb236eb0a7f8ba3fba333c3481a710ebcb59c Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vnet/adj')
-rw-r--r--src/vnet/adj/adj_glean.c60
-rw-r--r--src/vnet/adj/adj_glean.h19
-rw-r--r--src/vnet/adj/adj_internal.h15
-rw-r--r--src/vnet/adj/adj_midchain.c5
-rw-r--r--src/vnet/adj/adj_nbr.c15
5 files changed, 32 insertions, 82 deletions
diff --git a/src/vnet/adj/adj_glean.c b/src/vnet/adj/adj_glean.c
index 09e6c0a0da9..82023f12dd2 100644
--- a/src/vnet/adj/adj_glean.c
+++ b/src/vnet/adj/adj_glean.c
@@ -68,49 +68,24 @@ adj_glean_add_or_lock (fib_protocol_t proto,
adj->sub_type.glean.receive_addr = *nh_addr;
}
- adj->rewrite_header.sw_if_index = sw_if_index;
adj->rewrite_header.data_bytes = 0;
- adj_lock(adj_get_index(adj));
- vnet_update_adjacency_for_sw_interface(vnet_get_main(),
- sw_if_index,
- adj_get_index(adj));
+ vnet_rewrite_for_sw_interface(vnet_get_main(),
+ adj_fib_proto_2_nd(proto),
+ sw_if_index,
+ adj_get_glean_node(proto)->index,
+ VNET_REWRITE_FOR_SW_INTERFACE_ADDRESS_BROADCAST,
+ &adj->rewrite_header,
+ sizeof (adj->rewrite_data));
}
else
{
adj = adj_get(adj_gleans[proto][sw_if_index]);
- adj_lock(adj_get_index(adj));
}
- return (adj_get_index(adj));
-}
-
-/**
- * adj_glean_update_rewrite
- */
-void
-adj_glean_update_rewrite (adj_index_t adj_index)
-{
- ip_adjacency_t *adj;
+ adj_lock(adj_get_index(adj));
- ASSERT(ADJ_INDEX_INVALID != adj_index);
-
- adj = adj_get(adj_index);
-
- vnet_rewrite_for_sw_interface(vnet_get_main(),
- adj_fib_proto_2_nd(adj->ia_nh_proto),
- adj->rewrite_header.sw_if_index,
- adj_get_glean_node(adj->ia_nh_proto)->index,
- VNET_REWRITE_FOR_SW_INTERFACE_ADDRESS_BROADCAST,
- &adj->rewrite_header,
- sizeof (adj->rewrite_data));
-}
-
-adj_index_t
-adj_glean_get (fib_protocol_t proto,
- u32 sw_if_index)
-{
- return (adj_gleans[proto][sw_if_index]);
+ return (adj_get_index(adj));
}
void
@@ -252,17 +227,12 @@ format_adj_glean (u8* s, va_list *ap)
vnet_main_t * vnm = vnet_get_main();
ip_adjacency_t * adj = adj_get(index);
- s = format(s, "%U-glean: %U",
- format_fib_protocol, adj->ia_nh_proto,
- format_vnet_sw_interface_name,
- vnm,
- vnet_get_sw_interface(vnm,
- adj->rewrite_header.sw_if_index));
- s = format (s, " %U",
- format_vnet_rewrite,
- &adj->rewrite_header, sizeof (adj->rewrite_data), 0);
-
- return (s);
+ return (format(s, "%U-glean: %U",
+ format_fib_protocol, adj->ia_nh_proto,
+ format_vnet_sw_interface_name,
+ vnm,
+ vnet_get_sw_interface(vnm,
+ adj->rewrite_header.sw_if_index)));
}
diff --git a/src/vnet/adj/adj_glean.h b/src/vnet/adj/adj_glean.h
index 47cddfbed2b..640bd2f91eb 100644
--- a/src/vnet/adj/adj_glean.h
+++ b/src/vnet/adj/adj_glean.h
@@ -48,25 +48,6 @@ extern adj_index_t adj_glean_add_or_lock(fib_protocol_t proto,
const ip46_address_t *nh_addr);
/**
- * @brief Get an existing glean
- *
- * @return INVALID if it does not exist
- */
-extern adj_index_t adj_glean_get(fib_protocol_t proto,
- u32 sw_if_index);
-
-/**
- * adj_glean_update_rewrite
- *
- * Called by an adjacency provider (an interface type) to configure
- * a glean adj (i.e. and adjacency linked to a connected prefix) to
- * its default behaviour.
- * Other interface types (i.e. 6RD tunnels) can can choose not to use
- * glean behaviour on an adjacency liked to a connected prefix.
- */
-extern void adj_glean_update_rewrite(adj_index_t adj_index);
-
-/**
* @brief Format/display a glean adjacency.
*/
extern u8* format_adj_glean(u8* s, va_list *ap);
diff --git a/src/vnet/adj/adj_internal.h b/src/vnet/adj/adj_internal.h
index 3b7ddb2f10c..e6d276e4d02 100644
--- a/src/vnet/adj/adj_internal.h
+++ b/src/vnet/adj/adj_internal.h
@@ -78,21 +78,6 @@ adj_fib_proto_2_nd (fib_protocol_t fp)
return (0);
}
-static inline ip46_type_t
-adj_proto_to_46 (fib_protocol_t proto)
-{
- switch (proto)
- {
- case FIB_PROTOCOL_IP4:
- return (IP46_TYPE_IP4);
- case FIB_PROTOCOL_IP6:
- return (IP46_TYPE_IP6);
- default:
- return (IP46_TYPE_IP4);
- }
- return (IP46_TYPE_IP4);
-}
-
/**
* @brief
* Get a pointer to an adjacency object from its index
diff --git a/src/vnet/adj/adj_midchain.c b/src/vnet/adj/adj_midchain.c
index b32a0e4f2f7..9fd3246b15a 100644
--- a/src/vnet/adj/adj_midchain.c
+++ b/src/vnet/adj/adj_midchain.c
@@ -590,9 +590,8 @@ 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,
- adj_proto_to_46(adj->ia_nh_proto));
+ s = format (s, " via %U ",
+ format_ip46_address, &adj->sub_type.nbr.next_hop);
s = format (s, " %U",
format_vnet_rewrite,
&adj->rewrite_header, sizeof (adj->rewrite_data), indent);
diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c
index 97940da0271..fc7a7fcd93c 100644
--- a/src/vnet/adj/adj_nbr.c
+++ b/src/vnet/adj/adj_nbr.c
@@ -968,6 +968,21 @@ VLIB_CLI_COMMAND (ip4_show_fib_command, static) = {
.function = adj_nbr_show,
};
+static ip46_type_t
+adj_proto_to_46 (fib_protocol_t proto)
+{
+ switch (proto)
+ {
+ case FIB_PROTOCOL_IP4:
+ return (IP46_TYPE_IP4);
+ case FIB_PROTOCOL_IP6:
+ return (IP46_TYPE_IP6);
+ default:
+ return (IP46_TYPE_IP4);
+ }
+ return (IP46_TYPE_IP4);
+}
+
u8*
format_adj_nbr_incomplete (u8* s, va_list *ap)
{