aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-07-28 00:01:35 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-28 00:01:35 -0400
commitbb7e95c8fd859922c6cf3ebbb3a8546007df1748 (patch)
tree58b54c6306ba168b76f25cc6dc9a2d1d2eb830a7 /net
parentb8bc0421ab7f83712a0a8ef7eb05fa73ec53c027 (diff)
parent5447080cfa3c77154498dfbf225367ac85b4c2b5 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/bnx2x_main.c Merge bnx2x bug fixes in by hand... :-/ Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c1
-rw-r--r--net/core/skbuff.c7
-rw-r--r--net/ipv6/addrconf.c14
-rw-r--r--net/mac80211/cfg.c2
-rw-r--r--net/sched/act_mirred.c43
5 files changed, 56 insertions, 11 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 6e1b4370781c..b74fcd3e9365 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1484,6 +1484,7 @@ static inline void net_timestamp_check(struct sk_buff *skb)
1484int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) 1484int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1485{ 1485{
1486 skb_orphan(skb); 1486 skb_orphan(skb);
1487 nf_reset(skb);
1487 1488
1488 if (!(dev->flags & IFF_UP) || 1489 if (!(dev->flags & IFF_UP) ||
1489 (skb->len > (dev->mtu + dev->hard_header_len))) { 1490 (skb->len > (dev->mtu + dev->hard_header_len))) {
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7da58a25ad92..3a2513f0d0c3 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -843,7 +843,9 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
843 skb->network_header += off; 843 skb->network_header += off;
844 if (skb_mac_header_was_set(skb)) 844 if (skb_mac_header_was_set(skb))
845 skb->mac_header += off; 845 skb->mac_header += off;
846 skb->csum_start += nhead; 846 /* Only adjust this if it actually is csum_start rather than csum */
847 if (skb->ip_summed == CHECKSUM_PARTIAL)
848 skb->csum_start += nhead;
847 skb->cloned = 0; 849 skb->cloned = 0;
848 skb->hdr_len = 0; 850 skb->hdr_len = 0;
849 skb->nohdr = 0; 851 skb->nohdr = 0;
@@ -930,7 +932,8 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
930 copy_skb_header(n, skb); 932 copy_skb_header(n, skb);
931 933
932 off = newheadroom - oldheadroom; 934 off = newheadroom - oldheadroom;
933 n->csum_start += off; 935 if (n->ip_summed == CHECKSUM_PARTIAL)
936 n->csum_start += off;
934#ifdef NET_SKBUFF_DATA_USES_OFFSET 937#ifdef NET_SKBUFF_DATA_USES_OFFSET
935 n->transport_header += off; 938 n->transport_header += off;
936 n->network_header += off; 939 n->network_header += off;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e81155d2f251..ab70a3fbcafa 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1763,7 +1763,10 @@ static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
1763 1763
1764 idev = ipv6_find_idev(dev); 1764 idev = ipv6_find_idev(dev);
1765 if (!idev) 1765 if (!idev)
1766 return NULL; 1766 return ERR_PTR(-ENOBUFS);
1767
1768 if (idev->cnf.disable_ipv6)
1769 return ERR_PTR(-EACCES);
1767 1770
1768 /* Add default multicast route */ 1771 /* Add default multicast route */
1769 addrconf_add_mroute(dev); 1772 addrconf_add_mroute(dev);
@@ -2132,8 +2135,9 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
2132 if (!dev) 2135 if (!dev)
2133 return -ENODEV; 2136 return -ENODEV;
2134 2137
2135 if ((idev = addrconf_add_dev(dev)) == NULL) 2138 idev = addrconf_add_dev(dev);
2136 return -ENOBUFS; 2139 if (IS_ERR(idev))
2140 return PTR_ERR(idev);
2137 2141
2138 scope = ipv6_addr_scope(pfx); 2142 scope = ipv6_addr_scope(pfx);
2139 2143
@@ -2380,7 +2384,7 @@ static void addrconf_dev_config(struct net_device *dev)
2380 } 2384 }
2381 2385
2382 idev = addrconf_add_dev(dev); 2386 idev = addrconf_add_dev(dev);
2383 if (idev == NULL) 2387 if (IS_ERR(idev))
2384 return; 2388 return;
2385 2389
2386 memset(&addr, 0, sizeof(struct in6_addr)); 2390 memset(&addr, 0, sizeof(struct in6_addr));
@@ -2471,7 +2475,7 @@ static void addrconf_ip6_tnl_config(struct net_device *dev)
2471 ASSERT_RTNL(); 2475 ASSERT_RTNL();
2472 2476
2473 idev = addrconf_add_dev(dev); 2477 idev = addrconf_add_dev(dev);
2474 if (!idev) { 2478 if (IS_ERR(idev)) {
2475 printk(KERN_DEBUG "init ip6-ip6: add_dev failed\n"); 2479 printk(KERN_DEBUG "init ip6-ip6: add_dev failed\n");
2476 return; 2480 return;
2477 } 2481 }
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a3f3325df9f2..db4d9340c846 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -632,7 +632,7 @@ static void ieee80211_send_layer2_update(struct sta_info *sta)
632 skb->dev = sta->sdata->dev; 632 skb->dev = sta->sdata->dev;
633 skb->protocol = eth_type_trans(skb, sta->sdata->dev); 633 skb->protocol = eth_type_trans(skb, sta->sdata->dev);
634 memset(skb->cb, 0, sizeof(skb->cb)); 634 memset(skb->cb, 0, sizeof(skb->cb));
635 netif_rx(skb); 635 netif_rx_ni(skb);
636} 636}
637 637
638static void sta_apply_parameters(struct ieee80211_local *local, 638static void sta_apply_parameters(struct ieee80211_local *local,
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index a16b0175f890..11f195af2da0 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -33,6 +33,7 @@
33static struct tcf_common *tcf_mirred_ht[MIRRED_TAB_MASK + 1]; 33static struct tcf_common *tcf_mirred_ht[MIRRED_TAB_MASK + 1];
34static u32 mirred_idx_gen; 34static u32 mirred_idx_gen;
35static DEFINE_RWLOCK(mirred_lock); 35static DEFINE_RWLOCK(mirred_lock);
36static LIST_HEAD(mirred_list);
36 37
37static struct tcf_hashinfo mirred_hash_info = { 38static struct tcf_hashinfo mirred_hash_info = {
38 .htab = tcf_mirred_ht, 39 .htab = tcf_mirred_ht,
@@ -47,7 +48,9 @@ static inline int tcf_mirred_release(struct tcf_mirred *m, int bind)
47 m->tcf_bindcnt--; 48 m->tcf_bindcnt--;
48 m->tcf_refcnt--; 49 m->tcf_refcnt--;
49 if(!m->tcf_bindcnt && m->tcf_refcnt <= 0) { 50 if(!m->tcf_bindcnt && m->tcf_refcnt <= 0) {
50 dev_put(m->tcfm_dev); 51 list_del(&m->tcfm_list);
52 if (m->tcfm_dev)
53 dev_put(m->tcfm_dev);
51 tcf_hash_destroy(&m->common, &mirred_hash_info); 54 tcf_hash_destroy(&m->common, &mirred_hash_info);
52 return 1; 55 return 1;
53 } 56 }
@@ -134,8 +137,10 @@ static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est,
134 m->tcfm_ok_push = ok_push; 137 m->tcfm_ok_push = ok_push;
135 } 138 }
136 spin_unlock_bh(&m->tcf_lock); 139 spin_unlock_bh(&m->tcf_lock);
137 if (ret == ACT_P_CREATED) 140 if (ret == ACT_P_CREATED) {
141 list_add(&m->tcfm_list, &mirred_list);
138 tcf_hash_insert(pc, &mirred_hash_info); 142 tcf_hash_insert(pc, &mirred_hash_info);
143 }
139 144
140 return ret; 145 return ret;
141} 146}
@@ -164,9 +169,14 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
164 m->tcf_bstats.packets++; 169 m->tcf_bstats.packets++;
165 170
166 dev = m->tcfm_dev; 171 dev = m->tcfm_dev;
172 if (!dev) {
173 printk_once(KERN_NOTICE "tc mirred: target device is gone\n");
174 goto out;
175 }
176
167 if (!(dev->flags & IFF_UP)) { 177 if (!(dev->flags & IFF_UP)) {
168 if (net_ratelimit()) 178 if (net_ratelimit())
169 pr_notice("tc mirred to Houston: device %s is gone!\n", 179 pr_notice("tc mirred to Houston: device %s is down\n",
170 dev->name); 180 dev->name);
171 goto out; 181 goto out;
172 } 182 }
@@ -230,6 +240,28 @@ nla_put_failure:
230 return -1; 240 return -1;
231} 241}
232 242
243static int mirred_device_event(struct notifier_block *unused,
244 unsigned long event, void *ptr)
245{
246 struct net_device *dev = ptr;
247 struct tcf_mirred *m;
248
249 if (event == NETDEV_UNREGISTER)
250 list_for_each_entry(m, &mirred_list, tcfm_list) {
251 if (m->tcfm_dev == dev) {
252 dev_put(dev);
253 m->tcfm_dev = NULL;
254 }
255 }
256
257 return NOTIFY_DONE;
258}
259
260static struct notifier_block mirred_device_notifier = {
261 .notifier_call = mirred_device_event,
262};
263
264
233static struct tc_action_ops act_mirred_ops = { 265static struct tc_action_ops act_mirred_ops = {
234 .kind = "mirred", 266 .kind = "mirred",
235 .hinfo = &mirred_hash_info, 267 .hinfo = &mirred_hash_info,
@@ -250,12 +282,17 @@ MODULE_LICENSE("GPL");
250 282
251static int __init mirred_init_module(void) 283static int __init mirred_init_module(void)
252{ 284{
285 int err = register_netdevice_notifier(&mirred_device_notifier);
286 if (err)
287 return err;
288
253 pr_info("Mirror/redirect action on\n"); 289 pr_info("Mirror/redirect action on\n");
254 return tcf_register_action(&act_mirred_ops); 290 return tcf_register_action(&act_mirred_ops);
255} 291}
256 292
257static void __exit mirred_cleanup_module(void) 293static void __exit mirred_cleanup_module(void)
258{ 294{
295 unregister_netdevice_notifier(&mirred_device_notifier);
259 tcf_unregister_action(&act_mirred_ops); 296 tcf_unregister_action(&act_mirred_ops);
260} 297}
261 298