aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-06-05 16:03:03 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-06-07 13:40:56 -0700
commit7c355f532dd43036622e1880c114773463bafd23 (patch)
tree9d20c7db4e50ece976c89d23e2fb1671ebc17cb0 /net
parentdf2bc459a3ad71f8b44c358bf7169acf9caf4acd (diff)
downloadkernel_samsung_smdk4412-7c355f532dd43036622e1880c114773463bafd23.zip
kernel_samsung_smdk4412-7c355f532dd43036622e1880c114773463bafd23.tar.gz
kernel_samsung_smdk4412-7c355f532dd43036622e1880c114773463bafd23.tar.bz2
[NET]: Avoid duplicate netlink notification when changing link state
When changing the link state from userspace not affecting any other flags. Two duplicate notification are being sent, once as action in the NETDEV_UP/NETDEV_DOWN notification chain and a second time when comparing old and new device flags after the change has been completed. Although harmless, the duplicates should be avoided. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 5a7f20f..2609062 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2577,7 +2577,7 @@ unsigned dev_get_flags(const struct net_device *dev)
int dev_change_flags(struct net_device *dev, unsigned flags)
{
- int ret;
+ int ret, changes;
int old_flags = dev->flags;
/*
@@ -2632,8 +2632,10 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
dev_set_allmulti(dev, inc);
}
- if (old_flags ^ dev->flags)
- rtmsg_ifinfo(RTM_NEWLINK, dev, old_flags ^ dev->flags);
+ /* Exclude state transition flags, already notified */
+ changes = (old_flags ^ dev->flags) & ~(IFF_UP | IFF_RUNNING);
+ if (changes)
+ rtmsg_ifinfo(RTM_NEWLINK, dev, changes);
return ret;
}