From a4657249446a96933f0c2928f8a1f87b1929c245 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 12 Dec 2008 16:39:23 -0800 Subject: Fix management of interface renames Need to delete then add since zebra has no clean way to pass around rename, and the configuration is based on name not ifindex. --- zebra/interface.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'zebra/interface.c') diff --git a/zebra/interface.c b/zebra/interface.c index 74c977a9..dec91297 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -483,6 +483,22 @@ if_delete_update (struct interface *ifp) ifp->ifindex = IFINDEX_INTERNAL; } +/* Quagga daemons don't handle rename, so delete then add */ +void +if_rename (struct interface *ifp, const char *name) +{ + int ifindex = ifp->ifindex; + + if_delete_update(ifp); + listnode_delete (iflist, ifp); + + strncpy(ifp->name, name, INTERFACE_NAMSIZ); + ifp->ifindex = ifindex; + + listnode_add_sort (iflist, ifp); + if_add_update (ifp); +} + /* Interface is up. */ void if_up (struct interface *ifp) -- cgit v1.2.3