diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 1 | ||||
-rw-r--r-- | net/core/skbuff.c | 7 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 14 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 2 | ||||
-rw-r--r-- | net/sched/act_mirred.c | 43 |
5 files changed, 56 insertions, 11 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 0ea10f849be8..1f466e82ac33 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1488,6 +1488,7 @@ static inline void net_timestamp_check(struct sk_buff *skb) | |||
1488 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) | 1488 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) |
1489 | { | 1489 | { |
1490 | skb_orphan(skb); | 1490 | skb_orphan(skb); |
1491 | nf_reset(skb); | ||
1491 | 1492 | ||
1492 | if (!(dev->flags & IFF_UP) || | 1493 | if (!(dev->flags & IFF_UP) || |
1493 | (skb->len > (dev->mtu + dev->hard_header_len))) { | 1494 | (skb->len > (dev->mtu + dev->hard_header_len))) { |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 34432b4e96bb..ce88293a34e2 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 e1a698df5706..784f34d11fdd 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1760,7 +1760,10 @@ static struct inet6_dev *addrconf_add_dev(struct net_device *dev) | |||
1760 | 1760 | ||
1761 | idev = ipv6_find_idev(dev); | 1761 | idev = ipv6_find_idev(dev); |
1762 | if (!idev) | 1762 | if (!idev) |
1763 | return NULL; | 1763 | return ERR_PTR(-ENOBUFS); |
1764 | |||
1765 | if (idev->cnf.disable_ipv6) | ||
1766 | return ERR_PTR(-EACCES); | ||
1764 | 1767 | ||
1765 | /* Add default multicast route */ | 1768 | /* Add default multicast route */ |
1766 | addrconf_add_mroute(dev); | 1769 | addrconf_add_mroute(dev); |
@@ -2129,8 +2132,9 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx, | |||
2129 | if (!dev) | 2132 | if (!dev) |
2130 | return -ENODEV; | 2133 | return -ENODEV; |
2131 | 2134 | ||
2132 | if ((idev = addrconf_add_dev(dev)) == NULL) | 2135 | idev = addrconf_add_dev(dev); |
2133 | return -ENOBUFS; | 2136 | if (IS_ERR(idev)) |
2137 | return PTR_ERR(idev); | ||
2134 | 2138 | ||
2135 | scope = ipv6_addr_scope(pfx); | 2139 | scope = ipv6_addr_scope(pfx); |
2136 | 2140 | ||
@@ -2377,7 +2381,7 @@ static void addrconf_dev_config(struct net_device *dev) | |||
2377 | } | 2381 | } |
2378 | 2382 | ||
2379 | idev = addrconf_add_dev(dev); | 2383 | idev = addrconf_add_dev(dev); |
2380 | if (idev == NULL) | 2384 | if (IS_ERR(idev)) |
2381 | return; | 2385 | return; |
2382 | 2386 | ||
2383 | memset(&addr, 0, sizeof(struct in6_addr)); | 2387 | memset(&addr, 0, sizeof(struct in6_addr)); |
@@ -2468,7 +2472,7 @@ static void addrconf_ip6_tnl_config(struct net_device *dev) | |||
2468 | ASSERT_RTNL(); | 2472 | ASSERT_RTNL(); |
2469 | 2473 | ||
2470 | idev = addrconf_add_dev(dev); | 2474 | idev = addrconf_add_dev(dev); |
2471 | if (!idev) { | 2475 | if (IS_ERR(idev)) { |
2472 | printk(KERN_DEBUG "init ip6-ip6: add_dev failed\n"); | 2476 | printk(KERN_DEBUG "init ip6-ip6: add_dev failed\n"); |
2473 | return; | 2477 | return; |
2474 | } | 2478 | } |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index c7000a6ca379..67ee34f57df7 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 | ||
638 | static void sta_apply_parameters(struct ieee80211_local *local, | 638 | static void sta_apply_parameters(struct ieee80211_local *local, |
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index c0b6863e3b87..1980b71c283f 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -33,6 +33,7 @@ | |||
33 | static struct tcf_common *tcf_mirred_ht[MIRRED_TAB_MASK + 1]; | 33 | static struct tcf_common *tcf_mirred_ht[MIRRED_TAB_MASK + 1]; |
34 | static u32 mirred_idx_gen; | 34 | static u32 mirred_idx_gen; |
35 | static DEFINE_RWLOCK(mirred_lock); | 35 | static DEFINE_RWLOCK(mirred_lock); |
36 | static LIST_HEAD(mirred_list); | ||
36 | 37 | ||
37 | static struct tcf_hashinfo mirred_hash_info = { | 38 | static 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 | } |
@@ -162,9 +167,14 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, | |||
162 | m->tcf_tm.lastuse = jiffies; | 167 | m->tcf_tm.lastuse = jiffies; |
163 | 168 | ||
164 | dev = m->tcfm_dev; | 169 | dev = m->tcfm_dev; |
170 | if (!dev) { | ||
171 | printk_once(KERN_NOTICE "tc mirred: target device is gone\n"); | ||
172 | goto out; | ||
173 | } | ||
174 | |||
165 | if (!(dev->flags & IFF_UP)) { | 175 | if (!(dev->flags & IFF_UP)) { |
166 | if (net_ratelimit()) | 176 | if (net_ratelimit()) |
167 | pr_notice("tc mirred to Houston: device %s is gone!\n", | 177 | pr_notice("tc mirred to Houston: device %s is down\n", |
168 | dev->name); | 178 | dev->name); |
169 | goto out; | 179 | goto out; |
170 | } | 180 | } |
@@ -232,6 +242,28 @@ nla_put_failure: | |||
232 | return -1; | 242 | return -1; |
233 | } | 243 | } |
234 | 244 | ||
245 | static int mirred_device_event(struct notifier_block *unused, | ||
246 | unsigned long event, void *ptr) | ||
247 | { | ||
248 | struct net_device *dev = ptr; | ||
249 | struct tcf_mirred *m; | ||
250 | |||
251 | if (event == NETDEV_UNREGISTER) | ||
252 | list_for_each_entry(m, &mirred_list, tcfm_list) { | ||
253 | if (m->tcfm_dev == dev) { | ||
254 | dev_put(dev); | ||
255 | m->tcfm_dev = NULL; | ||
256 | } | ||
257 | } | ||
258 | |||
259 | return NOTIFY_DONE; | ||
260 | } | ||
261 | |||
262 | static struct notifier_block mirred_device_notifier = { | ||
263 | .notifier_call = mirred_device_event, | ||
264 | }; | ||
265 | |||
266 | |||
235 | static struct tc_action_ops act_mirred_ops = { | 267 | static struct tc_action_ops act_mirred_ops = { |
236 | .kind = "mirred", | 268 | .kind = "mirred", |
237 | .hinfo = &mirred_hash_info, | 269 | .hinfo = &mirred_hash_info, |
@@ -252,12 +284,17 @@ MODULE_LICENSE("GPL"); | |||
252 | 284 | ||
253 | static int __init mirred_init_module(void) | 285 | static int __init mirred_init_module(void) |
254 | { | 286 | { |
287 | int err = register_netdevice_notifier(&mirred_device_notifier); | ||
288 | if (err) | ||
289 | return err; | ||
290 | |||
255 | pr_info("Mirror/redirect action on\n"); | 291 | pr_info("Mirror/redirect action on\n"); |
256 | return tcf_register_action(&act_mirred_ops); | 292 | return tcf_register_action(&act_mirred_ops); |
257 | } | 293 | } |
258 | 294 | ||
259 | static void __exit mirred_cleanup_module(void) | 295 | static void __exit mirred_cleanup_module(void) |
260 | { | 296 | { |
297 | unregister_netdevice_notifier(&mirred_device_notifier); | ||
261 | tcf_unregister_action(&act_mirred_ops); | 298 | tcf_unregister_action(&act_mirred_ops); |
262 | } | 299 | } |
263 | 300 | ||