From b8de7d43e4955bb4025cd0e0e7390279841b6d7d Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Mon, 13 Dec 2021 11:26:30 -0800 Subject: vxlan: crash on configuring vxlan tunnel on l3 mode Configure a vxlan tunnel using this CLI and then assign an ip address to the vxlan tunnel cause VPP to crash immediately create vxlan tunnel src x.x.x.x dst y.y.y.y vni 1000 decap-next node ethernet-input l3 set interface ip address vxlan_tunnel0 z.z.z.z/24 It looks like when l3 mode is configured, the code calls the wrong function to register the interface Type: fix Fixes: 3e38422ab905d26ab1625c74268e30c94327ea54 Signed-off-by: Steven Luong Change-Id: Ie1a08efc028f37fb528a7dfd7048ff6836bb8ddc --- src/vnet/vxlan/vxlan.c | 13 +++++++------ src/vnet/vxlan/vxlan.h | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/vnet/vxlan') diff --git a/src/vnet/vxlan/vxlan.c b/src/vnet/vxlan/vxlan.c index 8568d5b0a98..484b7c2fa21 100644 --- a/src/vnet/vxlan/vxlan.c +++ b/src/vnet/vxlan/vxlan.c @@ -82,6 +82,8 @@ format_vxlan_tunnel (u8 * s, va_list * args) if (PREDICT_FALSE (t->decap_next_index != VXLAN_INPUT_NEXT_L2_INPUT)) s = format (s, "decap-next-%U ", format_decap_next, t->decap_next_index); + s = format (s, "l3 %u ", t->is_l3); + if (PREDICT_FALSE (ip46_address_is_multicast (&t->dst))) s = format (s, "mcast-sw-if-idx %d ", t->mcast_sw_if_index); @@ -245,7 +247,8 @@ const static fib_node_vft_t vxlan_vft = { _ (src) \ _ (dst) \ _ (src_port) \ - _ (dst_port) + _ (dst_port) \ + _ (is_l3) static void vxlan_rewrite (vxlan_tunnel_t * t, bool is_ip6) @@ -448,7 +451,7 @@ int vnet_vxlan_add_del_tunnel t->user_instance = user_instance; /* name */ t->flow_index = ~0; - if (a->is_l3) + if (a->is_l3 == 0) t->hw_if_index = vnet_register_interface (vnm, vxlan_device_class.index, dev_instance, vxlan_hw_class.index, dev_instance); @@ -503,7 +506,7 @@ int vnet_vxlan_add_del_tunnel if (add_failed) { - if (a->is_l3) + if (a->is_l3 == 0) vnet_delete_hw_interface (vnm, t->hw_if_index); else ethernet_delete_interface (vnm, t->hw_if_index); @@ -656,8 +659,7 @@ int vnet_vxlan_add_del_tunnel mcast_shared_remove (&t->dst); } - vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, t->hw_if_index); - if (hw->dev_class_index == vxlan_device_class.index) + if (t->is_l3 == 0) vnet_delete_hw_interface (vnm, t->hw_if_index); else ethernet_delete_interface (vnm, t->hw_if_index); @@ -844,7 +846,6 @@ vxlan_add_del_tunnel_command_fn (vlib_main_t * vm, vnet_vxlan_add_del_tunnel_args_t a = { .is_add = is_add, .is_ip6 = ipv6_set, - .is_l3 = is_l3, .instance = instance, #define _(x) .x = x, foreach_copy_field diff --git a/src/vnet/vxlan/vxlan.h b/src/vnet/vxlan/vxlan.h index d6dad7a6fae..290f03d57c4 100644 --- a/src/vnet/vxlan/vxlan.h +++ b/src/vnet/vxlan/vxlan.h @@ -134,7 +134,8 @@ typedef struct u32 dev_instance; /* Real device instance in tunnel vector */ u32 user_instance; /* Instance name being shown to user */ - VNET_DECLARE_REWRITE; + VNET_DECLARE_REWRITE; + u8 is_l3; } vxlan_tunnel_t; #define foreach_vxlan_input_next \ -- cgit 1.2.3-korg