basebox
basebox copied to clipboard
baseboxd should properly cleanup behind itself on shutdown
Currently baseboxd just stops when receiving SIGTERM. This is fine when using tap interfaces, but when using knet interfaces this means they won't get cleaned up.
Unfortunately just trapping the SIGTERM doesn't work, as baseboxd will then continue trying to serve the port interfaces, which can cause crashes if a shutdown is in progress.
Likewise if OF-DPA is in shutting down at the same time, in-progress grpc/client_drivshell calls might indefinitely hang, since ofdpa has intentionally no timeouts.
So for being able to properly clean up behind itself, baseboxd should have a "shutdown" mode, where it won't process any netlink or packet-in/outs, and remove all port interfaces.
Once we have that working, we can extend this to even clean up created trunk interfaces and groups/flows.