]> git.proxmox.com Git - mirror_frr.git/commit - zebra/zebra_netns_notify.c
*: rework renaming the default VRF
authorIgor Ryzhov <iryzhov@nfware.com>
Fri, 3 Dec 2021 22:22:55 +0000 (01:22 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 21 Dec 2021 19:09:29 +0000 (22:09 +0300)
commitac2cb9bf9467ada08014b045c52512c625d6c55b
tree19983a5108d70d705c0810c6f270332712c0d207
parenta64829d3c55b9c83e275d78698eab0899ebfcaae
*: rework renaming the default VRF

Currently, it is possible to rename the default VRF either by passing
`-o` option to zebra or by creating a file in `/var/run/netns` and
binding it to `/proc/self/ns/net`.

In both cases, only zebra knows about the rename and other daemons learn
about it only after they connect to zebra. This is a problem, because
daemons may read their config before they connect to zebra. To handle
this rename after the config is read, we have some special code in every
single daemon, which is not very bad but not desirable in my opinion.
But things are getting worse when we need to handle this in northbound
layer as we have to manually rewrite the config nodes. This approach is
already hacky, but still works as every daemon handles its own NB
structures. But it is completely incompatible with the central
management daemon architecture we are aiming for, as mgmtd doesn't even
have a connection with zebra to learn from it. And it shouldn't have it,
because operational state changes should never affect configuration.

To solve the problem and simplify the code, I propose to expand the `-o`
option to all daemons. By using the startup option, we let daemons know
about the rename before they read their configs so we don't need any
special code to deal with it. There's an easy way to pass the option to
all daemons by using `frr_global_options` variable.

Unfortunately, the second way of renaming by creating a file in
`/var/run/netns` is incompatible with the new mgmtd architecture.
Theoretically, we could force daemons to read their configs only after
they connect to zebra, but it means adding even more code to handle a
very specific use-case. And anyway this won't work for mgmtd as it
doesn't have a connection with zebra. So I had to remove this option.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
37 files changed:
bfdd/bfd.c
bfdd/bfd.h
bfdd/ptm_adapter.c
bgpd/bgp_main.c
doc/user/basic.rst
doc/user/setup.rst
doc/user/zebra.rst
eigrpd/eigrp_main.c
eigrpd/eigrp_vrf.c
isisd/isisd.c
ldpd/ldpd.c
lib/libfrr.c
lib/vrf.c
lib/vrf.h
lib/zclient.c
nhrpd/nhrp_main.c
ospf6d/ospf6_top.c
ospfd/ospf_vty.c
ospfd/ospfd.c
pbrd/pbr_vrf.c
pimd/pim_instance.c
ripd/ripd.c
ripngd/ripngd.c
sharpd/sharp_main.c
staticd/static_vrf.c
tests/bgpd/test_capability.c
tests/bgpd/test_mp_attr.c
tests/bgpd/test_mpath.c
tests/bgpd/test_packet.c
tests/bgpd/test_peer_attr.c
tests/ospfd/test_ospf_spf.c
vrrpd/vrrp.c
zebra/main.c
zebra/zebra_netns_notify.c
zebra/zebra_ns.c
zebra/zebra_ns.h
zebra/zebra_vrf.c