diff options
author | Patrick McHardy <kaber@trash.net> | 2010-02-26 06:34:51 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-27 02:43:39 -0800 |
commit | a2835763e130c343ace5320c20d33c281e7097b7 (patch) | |
tree | 26077aa8aec7a61fd7e3de31c5eeec4960f78079 /net/core/dev.c | |
parent | 10de05afe01c12cedc42eb9ce05b111eed6c8210 (diff) | |
download | op-kernel-dev-a2835763e130c343ace5320c20d33c281e7097b7.zip op-kernel-dev-a2835763e130c343ace5320c20d33c281e7097b7.tar.gz |
rtnetlink: handle rtnl_link netlink notifications manually
In order to support specifying device flags during device creation,
we must be able to roll back device registration in case setting the
flags fails without sending any notifications related to the device
to userspace.
This patch changes rollback_registered_many() and register_netdevice()
to manually send netlink notifications for devices not handled by
rtnl_link and allows to defer notifications for devices handled by
rtnl_link until setup is complete.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index eb7f1a4..75332b0 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4865,6 +4865,10 @@ static void rollback_registered_many(struct list_head *head) */ call_netdevice_notifiers(NETDEV_UNREGISTER, dev); + if (!dev->rtnl_link_ops || + dev->rtnl_link_state == RTNL_LINK_INITIALIZED) + rtmsg_ifinfo(RTM_DELLINK, dev, ~0U); + /* * Flush the unicast and multicast chains */ @@ -5091,7 +5095,9 @@ int register_netdevice(struct net_device *dev) * Prevent userspace races by waiting until the network * device is fully setup before sending notifications. */ - rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U); + if (!dev->rtnl_link_ops || + dev->rtnl_link_state == RTNL_LINK_INITIALIZED) + rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U); out: return ret; |