diff options
Diffstat (limited to 'zebra/zebra_netns_notify.c')
| -rw-r--r-- | zebra/zebra_netns_notify.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 3f69b98413..a6b17303b9 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." @@ -252,8 +258,6 @@ static int zebra_ns_notify_read(struct thread *t) if (!(event->mask & (IN_CREATE | IN_DELETE))) continue; - if (event->mask & IN_DELETE) - return zebra_ns_delete(event->name); if (offsetof(struct inotify_event, name) + event->len >= sizeof(buf)) { @@ -268,6 +272,9 @@ static int zebra_ns_notify_read(struct thread *t) break; } + if (event->mask & IN_DELETE) + return zebra_ns_delete(event->name); + netnspath = ns_netns_pathname(NULL, event->name); if (!netnspath) continue; @@ -310,6 +317,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." |
