* [NET]: Avoid duplicate netlink notification when changing link state
@ 2007-06-05 22:54 Thomas Graf
2007-06-05 23:04 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Graf @ 2007-06-05 22:54 UTC (permalink / raw)
To: davem; +Cc: netdev
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>
Index: net-2.6/net/core/dev.c
===================================================================
--- net-2.6.orig/net/core/dev.c 2007-06-05 17:50:13.000000000 +0200
+++ net-2.6/net/core/dev.c 2007-06-06 00:48:53.000000000 +0200
@@ -2577,7 +2577,7 @@ unsigned dev_get_flags(const struct net_
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_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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [NET]: Avoid duplicate netlink notification when changing link state
2007-06-05 22:54 [NET]: Avoid duplicate netlink notification when changing link state Thomas Graf
@ 2007-06-05 23:04 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-06-05 23:04 UTC (permalink / raw)
To: tgraf; +Cc: netdev
From: Thomas Graf <tgraf@suug.ch>
Date: Wed, 6 Jun 2007 00:54:53 +0200
> 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>
Thanks for fixing this, patch applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-05 23:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-05 22:54 [NET]: Avoid duplicate netlink notification when changing link state Thomas Graf
2007-06-05 23:04 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).