summaryrefslogtreecommitdiffstats
path: root/staticd/static_vrf.h
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-02-01 23:57:59 +0100
committerIgor Ryzhov <iryzhov@nfware.com>2024-02-01 23:57:59 +0100
commitcb781f60972aca7e0fdd18884814a9ef0403a67c (patch)
tree8ae2c2b8d6701fee31088d86a39588534ecdfca4 /staticd/static_vrf.h
parentstaticd: fix nexthops without interface (diff)
downloadfrr-cb781f60972aca7e0fdd18884814a9ef0403a67c.tar.xz
frr-cb781f60972aca7e0fdd18884814a9ef0403a67c.zip
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>
Diffstat (limited to 'staticd/static_vrf.h')
-rw-r--r--staticd/static_vrf.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/staticd/static_vrf.h b/staticd/static_vrf.h
index 8f55775d3..26ee28fd8 100644
--- a/staticd/static_vrf.h
+++ b/staticd/static_vrf.h
@@ -7,15 +7,27 @@
#ifndef __STATIC_VRF_H__
#define __STATIC_VRF_H__
+#include "openbsd-tree.h"
+
#ifdef __cplusplus
extern "C" {
#endif
struct static_vrf {
+ RB_ENTRY(static_vrf) entry;
+
+ char name[VRF_NAMSIZ + 1];
struct vrf *vrf;
struct route_table *stable[AFI_MAX][SAFI_MAX];
};
+RB_HEAD(svrf_name_head, static_vrf);
+RB_PROTOTYPE(svrf_name_head, static_vrf, entry, svrf_name_compare)
+
+extern struct svrf_name_head svrfs;
+
+struct static_vrf *static_vrf_alloc(const char *name);
+void static_vrf_free(struct static_vrf *svrf);
struct stable_info {
struct static_vrf *svrf;
@@ -25,8 +37,6 @@ struct stable_info {
#define GET_STABLE_VRF_ID(info) info->svrf->vrf->vrf_id
-struct static_vrf *static_vrf_lookup_by_name(const char *vrf_name);
-
void static_vrf_init(void);
struct route_table *static_vrf_static_table(afi_t afi, safi_t safi,