Commit graph

8 commits

Author SHA1 Message Date
Nathan Bahr b6ae01f907 lib: Create VRF if needed
When creating a control plane protocol through NB, create the vrf
if needed instead of only looking up and asserting if it doesn't
exist yet.
Fixes 18429.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-03-19 16:08:56 +00:00
Igor Ryzhov cb781f6097 staticd: fix NB dependency hack
Currently, staticd configuration is tightly coupled with VRF existence.
Because of that, it has to use a hack in NB infrastructure to create a
VRF configuration when at least one static route is configured for this
VRF. This hack is incompatible with mgmtd, because mgmtd doesn't execute
configuration callbacks. Because of that, the configuration may become
out of sync between mgmtd and staticd. There are two main cases:

1. Create static route in a VRF. The VRF data node will be created
   automatically in staticd by the NB hack, but not in mgmtd.
2. Delete VRF which has some static routes configured. The static route
   configuration will be deleted from staticd by the NB hack, but not
   from mgmtd.

To fix the problem, decouple configuration of static routes from VRF
configuration. Now it is possible to configure static routes even if the
VRF doesn't exist yet. Once the VRF is created, staticd applies all the
preconfigured routes.

This change also fixes the problem with static routes being preserved in
the system when staticd "control-plane-protocol" container is deleted
but the VRF is still configured.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-02 00:57:59 +02:00
Christian Hopps 2c01083d35 lib: all: remove './' from xpath 22% speedup
fixes #8299

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-29 14:37:23 -05:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
David Lamparter 1f8031f79a *: make sure config.h or zebra.h is first
`config.h` has all the defines from autoconf, which may include things
that switch behavior of other included headers (e.g. _GNU_SOURCE
enabling prototypes for additional functions.)

So, the first include in any `.c` file must be either `config.h` (with
the appropriate guard) or `zebra.h` (which includes `config.h` first
thing.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-23 12:06:35 +02:00
David Lamparter 8451921b70 *: require semicolon after DEFINE_HOOK & co.
See previous commit.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:17 +01:00
Igor Ryzhov 2ada626940 lib: register dependency between control plane protocol and vrf nb nodes
When the control plane protocol is created, the vrf structure is
allocated, and its address is stored in the northbound node.
The vrf structure may later be deleted by the user, which will lead to
a stale pointer stored in this node.

Instead of this, allow daemons that use the vrf pointer to register the
dependency between the control plane protocol and vrf nodes. This will
guarantee that the nodes will always be created and deleted together, and
there won't be any stale pointers.

Add such registration to staticd and pimd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-22 18:53:24 +03:00
vdhingra 7441ea1afd lib : basic-routing backend configuration northbound code
Signed-off-by: VishalDhingra <vdhingra@vmware.com>
2020-07-16 08:33:00 -07:00