summaryrefslogtreecommitdiff
path: root/zebra/zebra_netns_notify.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-12-28 14:27:45 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-01-16 17:02:03 +0100
commitbc30893f9f8f40b0eaef9cc65b6f6989675d01e9 (patch)
treebc13c6e733b4784f554c0437e3b4e7a3adf2e49d /zebra/zebra_netns_notify.c
parent1a976da6f502314a1be237264bdb8e88ab7f3fc3 (diff)
zebra: do not create vrf if name already set to default vrf at startup
if the default vrf name is manually set, by passing -o parameter to zebra, then this should be detected when walking the list of netns available in the system. If a netns called vrf0 is present, then it should be ignored. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zebra_netns_notify.c')
-rw-r--r--zebra/zebra_netns_notify.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c
index ed9f3899d4..ef31fcf45d 100644
--- a/zebra/zebra_netns_notify.c
+++ b/zebra/zebra_netns_notify.c
@@ -215,6 +215,12 @@ static int zebra_ns_ready_read(struct thread *t)
if (err < 0)
return zebra_ns_continue_read(zns_info, stop_retry);
+ /* check default name is not already set */
+ if (strmatch(VRF_DEFAULT_NAME, basename(netnspath))) {
+ zlog_warn("NS notify : NS %s is already default VRF."
+ "Cancel VRF Creation", basename(netnspath));
+ return zebra_ns_continue_read(zns_info, 1);
+ }
if (zebra_ns_notify_is_default_netns(basename(netnspath))) {
zlog_warn(
"NS notify : NS %s is default VRF."
@@ -312,6 +318,12 @@ void zebra_ns_notify_parse(void)
dent->d_name);
continue;
}
+ /* check default name is not already set */
+ if (strmatch(VRF_DEFAULT_NAME, basename(dent->d_name))) {
+ zlog_warn("NS notify : NS %s is already default VRF."
+ "Cancel VRF Creation", dent->d_name);
+ continue;
+ }
if (zebra_ns_notify_is_default_netns(dent->d_name)) {
zlog_warn(
"NS notify : NS %s is default VRF."