diff options
Diffstat (limited to 'zebra/zebra_netns_notify.c')
| -rw-r--r-- | zebra/zebra_netns_notify.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index cdba0c21ab..4260d29c43 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -17,7 +17,7 @@ #include <sys/inotify.h> #include <sys/stat.h> -#include "thread.h" +#include "frrevent.h" #include "ns.h" #include "command.h" #include "memory.h" @@ -41,18 +41,18 @@ #define ZEBRA_NS_POLLING_MAX_RETRIES 200 DEFINE_MTYPE_STATIC(ZEBRA, NETNS_MISC, "ZebraNetNSInfo"); -static struct thread *zebra_netns_notify_current; +static struct event *zebra_netns_notify_current; struct zebra_netns_info { const char *netnspath; unsigned int retries; }; -static void zebra_ns_ready_read(struct thread *t); +static void zebra_ns_ready_read(struct event *t); static void zebra_ns_notify_create_context_from_entry_name(const char *name); static int zebra_ns_continue_read(struct zebra_netns_info *zns_info, int stop_retry); -static void zebra_ns_notify_read(struct thread *t); +static void zebra_ns_notify_read(struct event *t); static struct vrf *vrf_handler_create(struct vty *vty, const char *vrfname) { @@ -133,9 +133,9 @@ static int zebra_ns_continue_read(struct zebra_netns_info *zns_info, XFREE(MTYPE_NETNS_MISC, zns_info); return 0; } - thread_add_timer_msec(zrouter.master, zebra_ns_ready_read, - (void *)zns_info, ZEBRA_NS_POLLING_INTERVAL_MSEC, - NULL); + event_add_timer_msec(zrouter.master, zebra_ns_ready_read, + (void *)zns_info, ZEBRA_NS_POLLING_INTERVAL_MSEC, + NULL); return 0; } @@ -165,6 +165,17 @@ static int zebra_ns_delete(char *name) if_down(ifp); } + if (IS_ZEBRA_IF_BOND(ifp)) + zebra_l2if_update_bond(ifp, false); + if (IS_ZEBRA_IF_BOND_SLAVE(ifp)) + zebra_l2if_update_bond_slave(ifp, IFINDEX_INTERNAL, + false); + /* Special handling for bridge or VxLAN interfaces. */ + if (IS_ZEBRA_IF_BRIDGE(ifp)) + zebra_l2_bridge_del(ifp); + else if (IS_ZEBRA_IF_VXLAN(ifp)) + zebra_l2_vxlanif_del(ifp); + UNSET_FLAG(ifp->flags, IFF_UP); if_delete_update(&ifp); } @@ -218,9 +229,9 @@ static bool zebra_ns_notify_is_default_netns(const char *name) return false; } -static void zebra_ns_ready_read(struct thread *t) +static void zebra_ns_ready_read(struct event *t) { - struct zebra_netns_info *zns_info = THREAD_ARG(t); + struct zebra_netns_info *zns_info = EVENT_ARG(t); const char *netnspath; int err, stop_retry = 0; @@ -269,16 +280,16 @@ static void zebra_ns_ready_read(struct thread *t) zebra_ns_continue_read(zns_info, 1); } -static void zebra_ns_notify_read(struct thread *t) +static void zebra_ns_notify_read(struct event *t) { - int fd_monitor = THREAD_FD(t); + int fd_monitor = EVENT_FD(t); struct inotify_event *event; char buf[BUFSIZ]; ssize_t len; char event_name[NAME_MAX + 1]; - thread_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, - &zebra_netns_notify_current); + event_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, + &zebra_netns_notify_current); len = read(fd_monitor, buf, sizeof(buf)); if (len < 0) { flog_err_sys(EC_ZEBRA_NS_NOTIFY_READ, @@ -350,8 +361,8 @@ static void zebra_ns_notify_read(struct thread *t) sizeof(struct zebra_netns_info)); netnsinfo->retries = ZEBRA_NS_POLLING_MAX_RETRIES; netnsinfo->netnspath = netnspath; - thread_add_timer_msec(zrouter.master, zebra_ns_ready_read, - (void *)netnsinfo, 0, NULL); + event_add_timer_msec(zrouter.master, zebra_ns_ready_read, + (void *)netnsinfo, 0, NULL); } } @@ -416,8 +427,8 @@ void zebra_ns_notify_init(void) "NS notify watch: failed to add watch (%s)", safe_strerror(errno)); } - thread_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, - &zebra_netns_notify_current); + event_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, + &zebra_netns_notify_current); } void zebra_ns_notify_close(void) @@ -431,7 +442,7 @@ void zebra_ns_notify_close(void) fd = zebra_netns_notify_current->u.fd; if (zebra_netns_notify_current->master != NULL) - THREAD_OFF(zebra_netns_notify_current); + EVENT_OFF(zebra_netns_notify_current); /* auto-removal of notify items */ if (fd > 0) |
