aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-13 08:32:54 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-13 08:32:54 -0400
commitdc2af52c0d6d00fd530e4a5e300834cdb1bb1c1c (patch)
tree4573b99fb11e5b93bd011045039b370ddafe45e6 /net/core/dev.c
parentf1992dde7fef6713a469a5a142b86812b8a47f9e (diff)
parent36be50515fe2aef61533b516fa2576a2c7fe7664 (diff)
Merge tag 'v3.4-rc7' into for-3.5
Linux 3.4-rc7 Conflicts): drivers/base/regmap/regmap.c (overlap with bug fixes) sound/soc/blackfin/bf5xx-ssm2602.c (overlap with bug fixes)
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index c25d453b2803..99e1d759f41e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1409,14 +1409,34 @@ EXPORT_SYMBOL(register_netdevice_notifier);
1409 * register_netdevice_notifier(). The notifier is unlinked into the 1409 * register_netdevice_notifier(). The notifier is unlinked into the
1410 * kernel structures and may then be reused. A negative errno code 1410 * kernel structures and may then be reused. A negative errno code
1411 * is returned on a failure. 1411 * is returned on a failure.
1412 *
1413 * After unregistering unregister and down device events are synthesized
1414 * for all devices on the device list to the removed notifier to remove
1415 * the need for special case cleanup code.
1412 */ 1416 */
1413 1417
1414int unregister_netdevice_notifier(struct notifier_block *nb) 1418int unregister_netdevice_notifier(struct notifier_block *nb)
1415{ 1419{
1420 struct net_device *dev;
1421 struct net *net;
1416 int err; 1422 int err;
1417 1423
1418 rtnl_lock(); 1424 rtnl_lock();
1419 err = raw_notifier_chain_unregister(&netdev_chain, nb); 1425 err = raw_notifier_chain_unregister(&netdev_chain, nb);
1426 if (err)
1427 goto unlock;
1428
1429 for_each_net(net) {
1430 for_each_netdev(net, dev) {
1431 if (dev->flags & IFF_UP) {
1432 nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
1433 nb->notifier_call(nb, NETDEV_DOWN, dev);
1434 }
1435 nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
1436 nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev);
1437 }
1438 }
1439unlock:
1420 rtnl_unlock(); 1440 rtnl_unlock();
1421 return err; 1441 return err;
1422} 1442}
@@ -1597,10 +1617,14 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1597 return NET_RX_DROP; 1617 return NET_RX_DROP;
1598 } 1618 }
1599 skb->skb_iif = 0; 1619 skb->skb_iif = 0;
1600 skb_set_dev(skb, dev); 1620 skb->dev = dev;
1621 skb_dst_drop(skb);
1601 skb->tstamp.tv64 = 0; 1622 skb->tstamp.tv64 = 0;
1602 skb->pkt_type = PACKET_HOST; 1623 skb->pkt_type = PACKET_HOST;
1603 skb->protocol = eth_type_trans(skb, dev); 1624 skb->protocol = eth_type_trans(skb, dev);
1625 skb->mark = 0;
1626 secpath_reset(skb);
1627 nf_reset(skb);
1604 return netif_rx(skb); 1628 return netif_rx(skb);
1605} 1629}
1606EXPORT_SYMBOL_GPL(dev_forward_skb); 1630EXPORT_SYMBOL_GPL(dev_forward_skb);
@@ -1849,36 +1873,6 @@ void netif_device_attach(struct net_device *dev)
1849} 1873}
1850EXPORT_SYMBOL(netif_device_attach); 1874EXPORT_SYMBOL(netif_device_attach);
1851 1875
1852/**
1853 * skb_dev_set -- assign a new device to a buffer
1854 * @skb: buffer for the new device
1855 * @dev: network device
1856 *
1857 * If an skb is owned by a device already, we have to reset
1858 * all data private to the namespace a device belongs to
1859 * before assigning it a new device.
1860 */
1861#ifdef CONFIG_NET_NS
1862void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
1863{
1864 skb_dst_drop(skb);
1865 if (skb->dev && !net_eq(dev_net(skb->dev), dev_net(dev))) {
1866 secpath_reset(skb);
1867 nf_reset(skb);
1868 skb_init_secmark(skb);
1869 skb->mark = 0;
1870 skb->priority = 0;
1871 skb->nf_trace = 0;
1872 skb->ipvs_property = 0;
1873#ifdef CONFIG_NET_SCHED
1874 skb->tc_index = 0;
1875#endif
1876 }
1877 skb->dev = dev;
1878}
1879EXPORT_SYMBOL(skb_set_dev);
1880#endif /* CONFIG_NET_NS */
1881
1882static void skb_warn_bad_offload(const struct sk_buff *skb) 1876static void skb_warn_bad_offload(const struct sk_buff *skb)
1883{ 1877{
1884 static const netdev_features_t null_features = 0; 1878 static const netdev_features_t null_features = 0;