From 0757a32baaa1eb4b3e763b7e69a4af889815808d Mon Sep 17 00:00:00 2001 From: Michael Borokhovich Date: Wed, 18 Oct 2017 20:29:30 +0000 Subject: Fix multicast packet reception. This commit adds the 224.0.0.0/24 entry to the mfib, making it possible to receive multicast packets. Previously, multicast packets would not be received because the entry was added to the unicast fib and not mfib. Change-Id: Id324805da3f214b3b68e9dba8b3967c615135765 Signed-off-by: Michael Borokhovich --- router/router/tap_inject.c | 38 ++++++++++++++++++++++---------------- router/router/tap_inject_node.c | 1 + 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/router/router/tap_inject.c b/router/router/tap_inject.c index 75d6df2..e8d3f98 100644 --- a/router/router/tap_inject.c +++ b/router/router/tap_inject.c @@ -16,6 +16,7 @@ #include "tap_inject.h" +#include #include #include #ifdef ip6_add_del_route_next_hop @@ -176,24 +177,29 @@ tap_inject_enable (void) } #else { - dpo_proto_t proto = 0; dpo_id_t dpo = DPO_INVALID; - fib_prefix_t pfx = {}; - pfx.fp_addr.ip4.as_u32 = 0x000000E0; /* 224.0.0.0 */ - pfx.fp_len = 24; - pfx.fp_proto = FIB_PROTOCOL_IP4; - proto = DPO_PROTO_IP4; - - vlib_node_add_next (vm, ip4_lookup_node.index, im->tx_node_index); - - dpo_set(&dpo, tap_inject_dpo_type, proto, ~0); - - fib_table_entry_special_dpo_add(0, - &pfx, - FIB_SOURCE_API, - FIB_ENTRY_FLAG_EXCLUSIVE, - &dpo); + const mfib_prefix_t pfx_224_0_0_0 = { + .fp_len = 24, + .fp_proto = FIB_PROTOCOL_IP4, + .fp_grp_addr = { + .ip4.as_u32 = clib_host_to_net_u32(0xe0000000), + }, + .fp_src_addr = { + .ip4.as_u32 = 0, + }, + }; + + dpo_set(&dpo, tap_inject_dpo_type, DPO_PROTO_IP4, ~0); + + index_t repi = replicate_create(1, DPO_PROTO_IP4); + replicate_set_bucket(repi, 0, &dpo); + + mfib_table_entry_special_add(0, + &pfx_224_0_0_0, + MFIB_SOURCE_API, + MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF, + repi); dpo_reset(&dpo); } diff --git a/router/router/tap_inject_node.c b/router/router/tap_inject_node.c index 32c1ab1..8282c4c 100644 --- a/router/router/tap_inject_node.c +++ b/router/router/tap_inject_node.c @@ -348,6 +348,7 @@ const static char *const tap_inject_tx_nodes[] = { }; const static char *const *const tap_inject_nodes[DPO_PROTO_NUM] = { + [DPO_PROTO_IP4] = tap_inject_tx_nodes, [DPO_PROTO_IP6] = tap_inject_tx_nodes, }; -- cgit 1.2.3-korg