summaryrefslogtreecommitdiffstats
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-05-13 13:30:31 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-05-13 13:30:31 -0700
commit118787493424775cb62b61c33c6f5b380652ffb1 (patch)
tree1fc4de5af80c9505e0e0c23e49e1ba9e915b7103 /zebra/rt_netlink.c
parent80e8c9a7cabc4717f58b5cd83047bf1e880df85b (diff)
downloadquagga-118787493424775cb62b61c33c6f5b380652ffb1.tar.bz2
quagga-118787493424775cb62b61c33c6f5b380652ffb1.tar.xz
Ignore netlink interface events that don't change state
Netlink can notify us about changes that don't affect operative state of the interface. So ignore these type of events.
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index b794f18a..2fb72f4c 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1015,7 +1015,7 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
/* Add interface. */
if (h->nlmsg_type == RTM_NEWLINK)
{
- unsigned long flag = ifi->ifi_flags & 0x0000fffff;
+ unsigned long new_flags = ifi->ifi_flags & 0x0000fffff;
ifp = if_lookup_by_name (name);
if (ifp == NULL || !CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
@@ -1024,10 +1024,10 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
ifp = if_get_by_name (name);
zlog_info ("interface %s index %d %s added.",
- name, ifi->ifi_index, if_flag_dump(flag));
+ name, ifi->ifi_index, if_flag_dump(new_flags));
set_ifindex(ifp, ifi->ifi_index);
- ifp->flags = flag;
+ ifp->flags = new_flags;
ifp->mtu6 = ifp->mtu = *(int *) RTA_DATA (tb[IFLA_MTU]);
ifp->metric = 1;
@@ -1041,28 +1041,32 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
ifp->mtu6 = ifp->mtu = *(int *) RTA_DATA (tb[IFLA_MTU]);
ifp->metric = 1;
- zlog_info ("interface %s index %d changed %s.",
- name, ifi->ifi_index, if_flag_dump(flag));
- if (if_is_operative (ifp))
- {
- ifp->flags = flag;
- if (!if_is_operative (ifp))
- if_down (ifp);
+ if (new_flags != ifp->flags)
+ {
+ zlog_info ("interface %s index %d changed %s.",
+ name, ifi->ifi_index, if_flag_dump(new_flags));
+
+ if (if_is_operative (ifp))
+ {
+ ifp->flags = new_flags;
+ if (!if_is_operative (ifp))
+ if_down (ifp);
+ else
+ /* Must notify client daemons of new interface status. */
+ zebra_interface_up_update (ifp);
+ }
else
- /* Must notify client daemons of new interface status. */
- zebra_interface_up_update (ifp);
- }
- else
- {
- ifp->flags = ifi->ifi_flags & 0x0000fffff;
- if (if_is_operative (ifp))
- if_up (ifp);
- }
+ {
+ ifp->flags = new_flags;
+ if (if_is_operative (ifp))
+ if_up (ifp);
+ }
+ }
}
}
else
{
- // RTM_DELLINK.
+ // RTM_DELLINK.
ifp = if_lookup_by_name (name);
if (ifp == NULL)