diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-12-17 09:31:47 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-12-17 09:31:47 -0800 |
commit | 177fec0b82d18dc92fe40b51bf1a4a294fb9a7ff (patch) | |
tree | 0c6282fe70d9f0df38ec5136a046ce14311c0d42 /zebra | |
parent | abdb64c635f294a7907690bc6e84322da9064fb5 (diff) | |
download | quagga-177fec0b82d18dc92fe40b51bf1a4a294fb9a7ff.tar.bz2 quagga-177fec0b82d18dc92fe40b51bf1a4a294fb9a7ff.tar.xz |
Revert "Revised version if interface renaming"
This reverts commit 3b1779981cd67679dd4cddd70160859ca3d862d7.
Conflicts:
zebra/rt_netlink.c
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/interface.c | 16 | ||||
-rw-r--r-- | zebra/interface.h | 1 | ||||
-rw-r--r-- | zebra/rt_netlink.c | 27 |
3 files changed, 26 insertions, 18 deletions
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) diff --git a/zebra/interface.h b/zebra/interface.h index 0a6b0365..fe44c501 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -215,6 +215,7 @@ extern void if_delete_update (struct interface *ifp); extern void if_add_update (struct interface *ifp); extern void if_up (struct interface *); extern void if_down (struct interface *); +extern void if_rename (struct interface *, const char *); extern void if_refresh (struct interface *); extern void if_flags_update (struct interface *, uint64_t); extern int if_subnet_add (struct interface *, struct connected *); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 6d4df405..e9ddd737 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -987,24 +987,6 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h) /* If new link is added. */ if_add_update (ifp); } - /* Interface name change */ - else if (strcmp(ifp->name, name) != 0) - { - ifp->mtu6 = ifp->mtu = mtu; - - zlog_info("interface index %d was renamed from %s to %s", - ifi->ifi_index, ifp->name, name); - - if_delete_update(ifp); - - ifp = if_create(name, strlen(name)); - ifp->ifindex = ifi->ifindex; - ifp->metric = 1; - ifp->mtu = ifp->mtu6 = mtu; - ifp->flags = new_flags; - - if_add_update (ifp); - } /* Interface status change. */ else if (new_flags != ifp->flags) { @@ -1029,6 +1011,15 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h) if_up (ifp); } } + /* Interface name change */ + else if (strcmp(ifp->name, name) != 0) + { + ifp->mtu = ifp->mtu6 = mtu; + zlog_info("interface index %d was renamed from %s to %s", + ifi->ifi_index, ifp->name, name); + + if_rename (ifp, name); + } /* Interface mtu change */ else if (mtu != ifp->mtu) { |