bisdn / basebox

A tiny OpenFlow controller for OF-DPA switches.
Mozilla Public License 2.0
45 stars 9 forks source link

nl_vxlan: defer vxlan scan util bridge registration #398

Closed KanjiMonster closed 1 year ago

KanjiMonster commented 1 year ago

nl_vxlan::init() may be called very early, before the switch connection is properly established. Any pre-existing vxlan interfaces may then cause a null pointer access when trying to create the vni, which tries to call gRPC methods.

Fix this by deferring the scan until we attach a bridge, as we support bridge attached vxlan only anways.

Avoids the following crash:

Program terminated with signal SIGSEGV, Segmentation fault.

0 0x000055c68c8f49ce in basebox::ofdpa_client::ofdpaTunnelTenantCreate (this=0x0, tunnel_id=, vni=) at ../git/src/of-dpa/ofdpa_client.cc:33

33 ::Status rv = stub_->ofdpaTunnelTenantCreate(&context, request, &response); [Current thread is 1 (LWP 2559)] (gdb) bt

0 0x000055c68c8f49ce in basebox::ofdpa_client::ofdpaTunnelTenantCreate (this=0x0, tunnel_id=, vni=) at ../git/src/of-dpa/ofdpa_client.cc:33

1 0x000055c68c8d0eb0 in non-virtual thunk to basebox::controller::tunnel_tenant_create(unsigned int, unsigned int) () at /usr/include/rofl/common/ctimespec.hpp:226

2 0x000055c68c8ba309 in basebox::nl_vxlan::create_vni (this=0x55c68d08d130, link=) at ../git/src/netlink/nl_vxlan.cc:468

3 0x000055c68c8c1e2e in basebox::nl_vxlan::init (this=0x55c68d08d130) at ../git/src/netlink/nl_vxlan.cc:214

4 0x000055c68c88a918 in basebox::cnetlink::init_subsystems (this=0x55c68d0a2da0) at /usr/include/c++/11.3.0/bits/shared_ptr_base.h:1295

5 basebox::cnetlink::handle_wakeup (this=0x55c68d0a2da0, thread=...) at ../git/src/netlink/cnetlink.cc:790

6 0x00007fc8faabd093 in rofl::cthread::handle_wakeup() () from /usr/lib/librofl_common.so.0

7 0x00007fc8faabd728 in rofl::cthread::run_loop() () from /usr/lib/librofl_common.so.0

8 0x00007fc8fa097a42 in start_thread (arg=) at pthread_create.c:442

9 0x00007fc8fa119930 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Signed-off-by: Jonas Gorski jonas.gorski@bisdn.de

Description

Motivation and Context

How Has This Been Tested?