#include <vnet/fib/fib_table.h>
#include <vnet/mfib/mfib_table.h>
#include <vnet/adj/adj_mcast.h>
+#include <vnet/interface.h>
#include <vlib/vlib.h>
/**
static vxlan_tunnel_t *
vxlan_tunnel_from_fib_node (fib_node_t *node)
{
-#if (CLIB_DEBUG > 0)
ASSERT(FIB_NODE_TYPE_VXLAN_TUNNEL == node->fn_type);
-#endif
return ((vxlan_tunnel_t*) (((char*)node) -
STRUCT_OFFSET_OF(vxlan_tunnel_t, node)));
}
return decap_next_index < r->n_next_nodes;
}
-static void
-hash_set_key_copy (uword ** h, void * key, uword v) {
- size_t ksz = hash_header(*h)->user;
- void * copy = clib_mem_alloc (ksz);
- clib_memcpy (copy, key, ksz);
- hash_set_mem (*h, copy, v);
-}
-
-static void
-hash_unset_key_free (uword ** h, void * key) {
- hash_pair_t * hp = hash_get_pair_mem (*h, key);
- ASSERT (hp);
- key = uword_to_pointer (hp->key, void *);
- hash_unset_mem (*h, key);
- clib_mem_free (key);
-}
-
static uword
vtep_addr_ref(ip46_address_t *ip)
{
return ++(*vtep);
ip46_address_is_ip4(ip) ?
hash_set (vxlan_main.vtep4, ip->ip4.as_u32, 1) :
- hash_set_key_copy (&vxlan_main.vtep6, &ip->ip6, 1);
+ hash_set_mem_alloc (&vxlan_main.vtep6, &ip->ip6, 1);
return 1;
}
return *vtep;
ip46_address_is_ip4(ip) ?
hash_unset (vxlan_main.vtep4, ip->ip4.as_u32) :
- hash_unset_key_free (&vxlan_main.vtep6, &ip->ip6);
+ hash_unset_mem_free (&vxlan_main.vtep6, &ip->ip6);
return 0;
}
.mfib_entry_index = mfei,
};
- hash_set_key_copy (&vxlan_main.mcast_shared, dst, new_ep.as_u64);
+ hash_set_mem_alloc (&vxlan_main.mcast_shared, dst, new_ep.as_u64);
}
static inline void
mfib_table_entry_delete_index(ep.mfib_entry_index,
MFIB_SOURCE_VXLAN);
- hash_unset_key_free (&vxlan_main.mcast_shared, dst);
+ hash_unset_mem_free (&vxlan_main.mcast_shared, dst);
}
static inline fib_protocol_t
/* copy the key */
if (is_ip6)
- hash_set_key_copy (&vxm->vxlan6_tunnel_by_key, &key6, t - vxm->tunnels);
+ hash_set_mem_alloc (&vxm->vxlan6_tunnel_by_key, &key6,
+ t - vxm->tunnels);
else
hash_set (vxm->vxlan4_tunnel_by_key, key4.as_u64, t - vxm->tunnels);
l2im->configs[sw_if_index].feature_bitmap = L2INPUT_FEAT_DROP;
l2im->configs[sw_if_index].bd_index = 0;
+ vnet_sw_interface_t * si = vnet_get_sw_interface (vnm, sw_if_index);
+ si->flags &= ~VNET_SW_INTERFACE_FLAG_HIDDEN;
vnet_sw_interface_set_flags (vnm, sw_if_index,
VNET_SW_INTERFACE_FLAG_ADMIN_UP);
+
fib_node_init(&t->node, FIB_NODE_TYPE_VXLAN_TUNNEL);
fib_prefix_t tun_dst_pfx;
u32 encap_index = !is_ip6 ?
vtep_addr_ref(&t->src);
t->fib_entry_index = fib_table_entry_special_add
(t->encap_fib_index, &tun_dst_pfx, FIB_SOURCE_RR,
- FIB_ENTRY_FLAG_NONE, ADJ_INDEX_INVALID);
+ FIB_ENTRY_FLAG_NONE);
t->sibling_index = fib_entry_child_add
(t->fib_entry_index, FIB_NODE_TYPE_VXLAN_TUNNEL, t - vxm->tunnels);
vxlan_tunnel_restack_dpo(t);
fib_node_index_t mfei;
adj_index_t ai;
fib_route_path_t path = {
- .frp_proto = fp,
+ .frp_proto = fib_proto_to_dpo(fp),
.frp_addr = zero_addr,
.frp_sw_if_index = 0xffffffff,
.frp_fib_index = ~0,
mcast_shared_t ep = mcast_shared_get(&t->dst);
/* Stack shared mcast dst mac addr rewrite on encap */
- dpo_set (&dpo, DPO_ADJACENCY,
+ dpo_set (&dpo, DPO_ADJACENCY_MCAST,
fib_proto_to_dpo(fp),
ep.mcast_adj_index);
t = pool_elt_at_index (vxm->tunnels, p[0]);
+ sw_if_index = t->sw_if_index;
vnet_sw_interface_set_flags (vnm, t->sw_if_index, 0 /* down */);
+ vnet_sw_interface_t * si = vnet_get_sw_interface (vnm, t->sw_if_index);
+ si->flags |= VNET_SW_INTERFACE_FLAG_HIDDEN;
+
/* make sure tunnel is removed from l2 bd or xconnect */
set_int_l2_mode(vxm->vlib_main, vnm, MODE_L3, t->sw_if_index, 0, 0, 0, 0);
vec_add1 (vxm->free_vxlan_tunnel_hw_if_indices, t->hw_if_index);
if (!is_ip6)
hash_unset (vxm->vxlan4_tunnel_by_key, key4.as_u64);
else
- hash_unset_key_free (&vxm->vxlan6_tunnel_by_key, &key6);
+ hash_unset_mem_free (&vxm->vxlan6_tunnel_by_key, &key6);
if (!ip46_address_is_multicast(&t->dst))
{