summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-03-17 14:25:10 +0000
committerNeale Ranns <nranns@cisco.com>2020-03-17 18:38:29 +0000
commit03c254ec70917290b2fde27de1e7b37abe508ade (patch)
tree47b6807cfd2ac27fc9d460b1f19a0b0fc924786d /src/vnet
parent64e96613d27816ed7d24b9ca2ed760d855d76c81 (diff)
fib: Always install all routers mcast addresses
Type: improvement Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: Ia8dff15855a81cf29729bdaa3ff28fbe3254fa97
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ip/ip4_forward.c3
-rw-r--r--src/vnet/ip/ip_punt_drop.c2
-rw-r--r--src/vnet/mfib/ip4_mfib.c109
-rw-r--r--src/vnet/mfib/ip4_mfib.h7
-rw-r--r--src/vnet/mfib/mfib_types.h2
5 files changed, 93 insertions, 30 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 95db9314d9b..7471a001e7a 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -49,6 +49,7 @@
#include <vnet/fib/fib_entry.h> /* for FIB table and entry creation */
#include <vnet/fib/fib_urpf_list.h> /* for FIB uRPF check */
#include <vnet/fib/ip4_fib.h>
+#include <vnet/mfib/ip4_mfib.h>
#include <vnet/dpo/load_balance.h>
#include <vnet/dpo/load_balance_map.h>
#include <vnet/dpo/classify_dpo.h>
@@ -761,6 +762,7 @@ ip4_add_del_interface_address_internal (vlib_main_t * vm,
goto done;
ip4_sw_interface_enable_disable (sw_if_index, !is_del);
+ ip4_mfib_interface_enable_disable (sw_if_index, !is_del);
/* intf addr routes are added/deleted on admin up/down */
if (vnet_sw_interface_is_admin_up (vnm, sw_if_index))
@@ -1061,6 +1063,7 @@ ip4_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
ip4_add_del_interface_address(vm, sw_if_index, address, ia->address_length, 1);
}));
/* *INDENT-ON* */
+ ip4_mfib_interface_enable_disable (sw_if_index, 0);
}
vnet_feature_enable_disable ("ip4-unicast", "ip4-not-enabled", sw_if_index,
diff --git a/src/vnet/ip/ip_punt_drop.c b/src/vnet/ip/ip_punt_drop.c
index 01577a472ce..ce1631fd2f1 100644
--- a/src/vnet/ip/ip_punt_drop.c
+++ b/src/vnet/ip/ip_punt_drop.c
@@ -29,7 +29,7 @@ format_ip_punt_redirect_trace (u8 * s, va_list * args)
ip_punt_redirect_trace_t *t = va_arg (*args, ip_punt_redirect_trace_t *);
if (INDEX_INVALID == t->rrxi)
- s = format (s, "drop");
+ s = format (s, "ignore");
else
s = format (s, "via redirect:%d", t->rrxi);
diff --git a/src/vnet/mfib/ip4_mfib.c b/src/vnet/mfib/ip4_mfib.c
index 4da1be61113..6973380ec06 100644
--- a/src/vnet/mfib/ip4_mfib.c
+++ b/src/vnet/mfib/ip4_mfib.c
@@ -18,16 +18,27 @@
#include <vnet/mfib/mfib_table.h>
#include <vnet/mfib/mfib_entry.h>
-static const mfib_prefix_t ip4_specials[] = {
+static const mfib_prefix_t all_zeros =
+{
+ .fp_proto = FIB_PROTOCOL_IP4,
+};
+static const mfib_prefix_t ip4_specials[] =
+{
+ /* ALL prefixes are in network order */
{
- /* (*,*)/0 */
- .fp_src_addr = {
- .ip4.data_u32 = 0,
+ /* (*,224.0.0.1)/32 - all hosts */
+ .fp_grp_addr = {
+ .ip4.data_u32 = 0x010000e0,
},
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ },
+ {
+ /* (*,224.0.0.2)/32 - all routers */
.fp_grp_addr = {
- .ip4.data_u32 = 0,
+ .ip4.data_u32 = 0x020000e0,
},
- .fp_len = 0,
+ .fp_len = 32,
.fp_proto = FIB_PROTOCOL_IP4,
},
};
@@ -57,24 +68,31 @@ ip4_create_mfib_with_table_id (u32 table_id,
mfib_table_lock(mfib_table->mft_index, FIB_PROTOCOL_IP4, src);
/*
- * add the special entries into the new FIB
+ * add the default route into the new FIB
*/
+ mfib_table_entry_update(mfib_table->mft_index,
+ &all_zeros,
+ MFIB_SOURCE_DEFAULT_ROUTE,
+ MFIB_RPF_ID_NONE,
+ MFIB_ENTRY_FLAG_DROP);
+
+ const fib_route_path_t path = {
+ .frp_proto = DPO_PROTO_IP4,
+ .frp_addr = zero_addr,
+ .frp_sw_if_index = ~0,
+ .frp_fib_index = ~0,
+ .frp_weight = 1,
+ .frp_flags = FIB_ROUTE_PATH_LOCAL,
+ .frp_mitf_flags = MFIB_ITF_FLAG_FORWARD,
+ };
int ii;
for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++)
{
- mfib_prefix_t prefix = ip4_specials[ii];
-
- prefix.fp_src_addr.ip4.data_u32 =
- clib_host_to_net_u32(prefix.fp_src_addr.ip4.data_u32);
- prefix.fp_grp_addr.ip4.data_u32 =
- clib_host_to_net_u32(prefix.fp_grp_addr.ip4.data_u32);
-
- mfib_table_entry_update(mfib_table->mft_index,
- &prefix,
- MFIB_SOURCE_DEFAULT_ROUTE,
- MFIB_RPF_ID_NONE,
- MFIB_ENTRY_FLAG_DROP);
+ mfib_table_entry_path_update(mfib_table->mft_index,
+ &ip4_specials[ii],
+ MFIB_SOURCE_SPECIAL,
+ &path);
}
return (mfib_table->mft_index);
@@ -89,18 +107,15 @@ ip4_mfib_table_destroy (ip4_mfib_t *mfib)
/*
* remove all the specials we added when the table was created.
*/
+ mfib_table_entry_delete(mfib_table->mft_index,
+ &all_zeros,
+ MFIB_SOURCE_DEFAULT_ROUTE);
+
for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++)
{
- fib_node_index_t mfei;
- mfib_prefix_t prefix = ip4_specials[ii];
-
- prefix.fp_src_addr.ip4.data_u32 =
- clib_host_to_net_u32(prefix.fp_src_addr.ip4.data_u32);
- prefix.fp_grp_addr.ip4.data_u32 =
- clib_host_to_net_u32(prefix.fp_grp_addr.ip4.data_u32);
-
- mfei = mfib_table_lookup(mfib_table->mft_index, &prefix);
- mfib_table_entry_delete_index(mfei, MFIB_SOURCE_DEFAULT_ROUTE);
+ mfib_table_entry_delete(mfib_table->mft_index,
+ &ip4_specials[ii],
+ MFIB_SOURCE_SPECIAL);
}
/*
@@ -113,6 +128,42 @@ ip4_mfib_table_destroy (ip4_mfib_t *mfib)
pool_put(ip4_main.mfibs, mfib_table);
}
+void
+ip4_mfib_interface_enable_disable (u32 sw_if_index, int is_enable)
+{
+ const fib_route_path_t path = {
+ .frp_proto = DPO_PROTO_IP4,
+ .frp_addr = zero_addr,
+ .frp_sw_if_index = sw_if_index,
+ .frp_fib_index = ~0,
+ .frp_weight = 1,
+ .frp_mitf_flags = MFIB_ITF_FLAG_ACCEPT,
+ };
+ u32 mfib_index;
+ int ii;
+
+ vec_validate (ip4_main.mfib_index_by_sw_if_index, sw_if_index);
+ mfib_index = ip4_mfib_table_get_index_for_sw_if_index(sw_if_index);
+
+ for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++)
+ {
+ if (is_enable)
+ {
+ mfib_table_entry_path_update(mfib_index,
+ &ip4_specials[ii],
+ MFIB_SOURCE_SPECIAL,
+ &path);
+ }
+ else
+ {
+ mfib_table_entry_path_remove(mfib_index,
+ &ip4_specials[ii],
+ MFIB_SOURCE_SPECIAL,
+ &path);
+ }
+ }
+}
+
u32
ip4_mfib_table_find_or_create_and_lock (u32 table_id,
mfib_source_t src)
diff --git a/src/vnet/mfib/ip4_mfib.h b/src/vnet/mfib/ip4_mfib.h
index 5b225596469..2e263a497d2 100644
--- a/src/vnet/mfib/ip4_mfib.h
+++ b/src/vnet/mfib/ip4_mfib.h
@@ -56,6 +56,13 @@ extern void ip4_mfib_table_entry_insert(ip4_mfib_t *fib,
extern void ip4_mfib_table_destroy(ip4_mfib_t *fib);
/**
+ * @brief
+ * Add/remove the interface from the accepting list of the special MFIB entries
+ */
+extern void ip4_mfib_interface_enable_disable(u32 sw_if_index,
+ int is_enable);
+
+/**
* @brief Get the FIB at the given index
*/
static inline ip4_mfib_t *
diff --git a/src/vnet/mfib/mfib_types.h b/src/vnet/mfib/mfib_types.h
index 650a7a5c3f9..edc25fe5b99 100644
--- a/src/vnet/mfib/mfib_types.h
+++ b/src/vnet/mfib/mfib_types.h
@@ -172,6 +172,7 @@ typedef enum mfib_source_t_
MFIB_SOURCE_GENEVE,
MFIB_SOURCE_IGMP,
MFIB_SOURCE_VXLAN_GBP,
+ MFIB_SOURCE_PLUGIN_LOW,
MFIB_SOURCE_RR,
MFIB_SOURCE_DEFAULT_ROUTE,
} mfib_source_t;
@@ -189,6 +190,7 @@ typedef enum mfib_source_t_
[MFIB_SOURCE_GENEVE] = "Geneve", \
[MFIB_SOURCE_IGMP] = "IGMP", \
[MFIB_SOURCE_VXLAN_GBP] = "VXLAN-GBP", \
+ [MFIB_SOURCE_PLUGIN_LOW] = "plugin-low", \
[MFIB_SOURCE_RR] = "Recursive-resolution", \
[MFIB_SOURCE_DEFAULT_ROUTE] = "Default Route", \
}