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 From 3b1779981cd67679dd4cddd70160859ca3d862d7 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 16 Dec 2008 16:10:02 -0800 Subject: Revised version if interface renaming This resolves issue with static routes of multilink. In the multilink case, route is created before device exists. Later device is created as ppp0 and gets renamed to ml0. Zebra needed to orphan the old interface structure and create a new one to correctly match up the interface with the inactive route. --- zebra/interface.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'zebra/interface.c') diff --git a/zebra/interface.c b/zebra/interface.c index dec91297..74c977a9 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -483,22 +483,6 @@ 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 From 177fec0b82d18dc92fe40b51bf1a4a294fb9a7ff Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 17 Dec 2008 09:31:47 -0800 Subject: Revert "Revised version if interface renaming" This reverts commit 3b1779981cd67679dd4cddd70160859ca3d862d7. Conflicts: zebra/rt_netlink.c --- 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