summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-03-25 13:13:16 +0100
committerGitHub <noreply@github.com>2019-03-25 13:13:16 +0100
commitc9146c85a0356a9c62b52f384025bfe0ff65c654 (patch)
tree6f93b5c83b955c7cd1d293adf039793f92d8450c /lib
parentMerge pull request #3989 from opensourcerouting/redhat-new-init (diff)
parentlib: handling vrf backend unknown case (diff)
downloadfrr-c9146c85a0356a9c62b52f384025bfe0ff65c654.tar.xz
frr-c9146c85a0356a9c62b52f384025bfe0ff65c654.zip
Merge pull request #3772 from pguibert6WIND/vrf_backend_unknown
Vrf backend unknown
Diffstat (limited to 'lib')
-rw-r--r--lib/if.c6
-rw-r--r--lib/vrf.c4
-rw-r--r--lib/vrf.h5
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/if.c b/lib/if.c
index abcc6c5d3..5b1473af4 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -396,6 +396,7 @@ struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id)
struct interface *ifp;
switch (vrf_get_backend()) {
+ case VRF_BACKEND_UNKNOWN:
case VRF_BACKEND_NETNS:
ifp = if_lookup_by_name(name, vrf_id);
if (ifp)
@@ -1279,6 +1280,11 @@ static int lib_interface_create(enum nb_event event,
vrf->name);
return NB_ERR_VALIDATION;
}
+
+ /* if VRF is netns or not yet known - init for instance
+ * then assumption is that passed config is exact
+ * then the user intent was not to use an other iface
+ */
if (vrf_get_backend() == VRF_BACKEND_VRF_LITE) {
ifp = if_lookup_by_name_all_vrf(ifname);
if (ifp && ifp->vrf_id != vrf->vrf_id) {
diff --git a/lib/vrf.c b/lib/vrf.c
index ab47f242f..dd87ed63e 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -56,6 +56,7 @@ struct vrf_id_head vrfs_by_id = RB_INITIALIZER(&vrfs_by_id);
struct vrf_name_head vrfs_by_name = RB_INITIALIZER(&vrfs_by_name);
static int vrf_backend;
+static int vrf_backend_configured;
static struct zebra_privs_t *vrf_daemon_privs;
static char vrf_default_name[VRF_NAMSIZ] = VRF_DEFAULT_NAME_INTERNAL;
@@ -613,12 +614,15 @@ int vrf_is_backend_netns(void)
int vrf_get_backend(void)
{
+ if (!vrf_backend_configured)
+ return VRF_BACKEND_UNKNOWN;
return vrf_backend;
}
void vrf_configure_backend(int vrf_backend_netns)
{
vrf_backend = vrf_backend_netns;
+ vrf_backend_configured = 1;
}
int vrf_handler_create(struct vty *vty, const char *vrfname,
diff --git a/lib/vrf.h b/lib/vrf.h
index b947ab1d5..d8fedf911 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -101,8 +101,9 @@ RB_PROTOTYPE(vrf_name_head, vrf, name_entry, vrf_name_compare)
DECLARE_QOBJ_TYPE(vrf)
/* Allow VRF with netns as backend */
-#define VRF_BACKEND_VRF_LITE 0
-#define VRF_BACKEND_NETNS 1
+#define VRF_BACKEND_VRF_LITE 0
+#define VRF_BACKEND_NETNS 1
+#define VRF_BACKEND_UNKNOWN 2
extern struct vrf_id_head vrfs_by_id;
extern struct vrf_name_head vrfs_by_name;