Skip to content

Commit

Permalink
[NET]: Avoid duplicate netlink notification when changing link state
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Graf authored and David S. Miller committed Jun 7, 2007
1 parent df2bc45 commit 7c355f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 7c355f5

Please sign in to comment.