aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-15 18:51:55 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-15 18:51:55 -0400
commit7e52b33bd50faa866bc3e6e97e68438bc5e52251 (patch)
tree46e68adf23f4f170a0eb5045c33a76234de6cf92 /net
parent91c8028c95a468da9c0aafd2d91cf24e27784206 (diff)
parent2a0c451ade8e1783c5d453948289e4a978d417c9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: net/ipv6/route.c This deals with a merge conflict between the net-next addition of the inetpeer network namespace ops, and Thomas Graf's bug fix in 2a0c451ade8e1783c5d453948289e4a978d417c9 which makes sure we don't register /proc/net/ipv6_route before it is actually safe to do so. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/can/raw.c3
-rw-r--r--net/core/dev.c23
-rw-r--r--net/core/netpoll.c11
-rw-r--r--net/ipv6/ip6_fib.c18
-rw-r--r--net/ipv6/route.c24
-rw-r--r--net/iucv/af_iucv.c1
6 files changed, 33 insertions, 47 deletions
diff --git a/net/can/raw.c b/net/can/raw.c
index cde1b4a20f75..46cca3a91d19 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -681,9 +681,6 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
681 if (err < 0) 681 if (err < 0)
682 goto free_skb; 682 goto free_skb;
683 683
684 /* to be able to check the received tx sock reference in raw_rcv() */
685 skb_shinfo(skb)->tx_flags |= SKBTX_DRV_NEEDS_SK_REF;
686
687 skb->dev = dev; 684 skb->dev = dev;
688 skb->sk = sk; 685 skb->sk = sk;
689 686
diff --git a/net/core/dev.c b/net/core/dev.c
index c6e29ea65bd9..57c4f9bc6858 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2089,25 +2089,6 @@ static int dev_gso_segment(struct sk_buff *skb, netdev_features_t features)
2089 return 0; 2089 return 0;
2090} 2090}
2091 2091
2092/*
2093 * Try to orphan skb early, right before transmission by the device.
2094 * We cannot orphan skb if tx timestamp is requested or the sk-reference
2095 * is needed on driver level for other reasons, e.g. see net/can/raw.c
2096 */
2097static inline void skb_orphan_try(struct sk_buff *skb)
2098{
2099 struct sock *sk = skb->sk;
2100
2101 if (sk && !skb_shinfo(skb)->tx_flags) {
2102 /* skb_tx_hash() wont be able to get sk.
2103 * We copy sk_hash into skb->rxhash
2104 */
2105 if (!skb->rxhash)
2106 skb->rxhash = sk->sk_hash;
2107 skb_orphan(skb);
2108 }
2109}
2110
2111static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) 2092static bool can_checksum_protocol(netdev_features_t features, __be16 protocol)
2112{ 2093{
2113 return ((features & NETIF_F_GEN_CSUM) || 2094 return ((features & NETIF_F_GEN_CSUM) ||
@@ -2193,8 +2174,6 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2193 if (!list_empty(&ptype_all)) 2174 if (!list_empty(&ptype_all))
2194 dev_queue_xmit_nit(skb, dev); 2175 dev_queue_xmit_nit(skb, dev);
2195 2176
2196 skb_orphan_try(skb);
2197
2198 features = netif_skb_features(skb); 2177 features = netif_skb_features(skb);
2199 2178
2200 if (vlan_tx_tag_present(skb) && 2179 if (vlan_tx_tag_present(skb) &&
@@ -2304,7 +2283,7 @@ u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb,
2304 if (skb->sk && skb->sk->sk_hash) 2283 if (skb->sk && skb->sk->sk_hash)
2305 hash = skb->sk->sk_hash; 2284 hash = skb->sk->sk_hash;
2306 else 2285 else
2307 hash = (__force u16) skb->protocol ^ skb->rxhash; 2286 hash = (__force u16) skb->protocol;
2308 hash = jhash_1word(hash, hashrnd); 2287 hash = jhash_1word(hash, hashrnd);
2309 2288
2310 return (u16) (((u64) hash * qcount) >> 32) + qoffset; 2289 return (u16) (((u64) hash * qcount) >> 32) + qoffset;
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 3d84fb9d8873..f9f40b932e4b 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -362,22 +362,23 @@ EXPORT_SYMBOL(netpoll_send_skb_on_dev);
362 362
363void netpoll_send_udp(struct netpoll *np, const char *msg, int len) 363void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
364{ 364{
365 int total_len, eth_len, ip_len, udp_len; 365 int total_len, ip_len, udp_len;
366 struct sk_buff *skb; 366 struct sk_buff *skb;
367 struct udphdr *udph; 367 struct udphdr *udph;
368 struct iphdr *iph; 368 struct iphdr *iph;
369 struct ethhdr *eth; 369 struct ethhdr *eth;
370 370
371 udp_len = len + sizeof(*udph); 371 udp_len = len + sizeof(*udph);
372 ip_len = eth_len = udp_len + sizeof(*iph); 372 ip_len = udp_len + sizeof(*iph);
373 total_len = eth_len + ETH_HLEN + NET_IP_ALIGN; 373 total_len = ip_len + LL_RESERVED_SPACE(np->dev);
374 374
375 skb = find_skb(np, total_len, total_len - len); 375 skb = find_skb(np, total_len + np->dev->needed_tailroom,
376 total_len - len);
376 if (!skb) 377 if (!skb)
377 return; 378 return;
378 379
379 skb_copy_to_linear_data(skb, msg, len); 380 skb_copy_to_linear_data(skb, msg, len);
380 skb->len += len; 381 skb_put(skb, len);
381 382
382 skb_push(skb, sizeof(*udph)); 383 skb_push(skb, sizeof(*udph));
383 skb_reset_transport_header(skb); 384 skb_reset_transport_header(skb);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 215afc74d8aa..a83bf067bdc5 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1697,21 +1697,25 @@ int __init fib6_init(void)
1697 ret = register_pernet_subsys(&fib6_net_ops); 1697 ret = register_pernet_subsys(&fib6_net_ops);
1698 if (ret) 1698 if (ret)
1699 goto out_kmem_cache_create; 1699 goto out_kmem_cache_create;
1700
1701 ret = __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib,
1702 NULL);
1703 if (ret)
1704 goto out_unregister_subsys;
1705out: 1700out:
1706 return ret; 1701 return ret;
1707 1702
1708out_unregister_subsys:
1709 unregister_pernet_subsys(&fib6_net_ops);
1710out_kmem_cache_create: 1703out_kmem_cache_create:
1711 kmem_cache_destroy(fib6_node_kmem); 1704 kmem_cache_destroy(fib6_node_kmem);
1712 goto out; 1705 goto out;
1713} 1706}
1714 1707
1708int __init fib6_init_late(void)
1709{
1710 return __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib,
1711 NULL);
1712}
1713
1714void fib6_cleanup_late(void)
1715{
1716 rtnl_unregister(PF_INET6, RTM_GETROUTE);
1717}
1718
1715void fib6_gc_cleanup(void) 1719void fib6_gc_cleanup(void)
1716{ 1720{
1717 unregister_pernet_subsys(&fib6_net_ops); 1721 unregister_pernet_subsys(&fib6_net_ops);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0d41f68daff2..c7ccc36ba63e 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2974,13 +2974,17 @@ int __init ip6_route_init(void)
2974 if (ret) 2974 if (ret)
2975 goto out_kmem_cache; 2975 goto out_kmem_cache;
2976 2976
2977 ret = register_pernet_subsys(&ip6_route_net_ops); 2977 ret = fib6_init();
2978 if (ret) 2978 if (ret)
2979 goto out_dst_entries; 2979 goto out_dst_entries;
2980 2980
2981 ret = register_pernet_subsys(&ipv6_inetpeer_ops); 2981 ret = register_pernet_subsys(&ipv6_inetpeer_ops);
2982 if (ret) 2982 if (ret)
2983 goto out_register_subsys; 2983 goto out_fib6_init;
2984
2985 ret = register_pernet_subsys(&ip6_route_net_ops);
2986 if (ret)
2987 goto out_register_inetpeer;
2984 2988
2985 ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops_template.kmem_cachep; 2989 ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops_template.kmem_cachep;
2986 2990
@@ -2995,13 +2999,13 @@ int __init ip6_route_init(void)
2995 init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; 2999 init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
2996 init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); 3000 init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
2997 #endif 3001 #endif
2998 ret = fib6_init(); 3002 ret = fib6_init_late();
2999 if (ret) 3003 if (ret)
3000 goto out_register_inetpeer; 3004 goto out_register_subsys;
3001 3005
3002 ret = xfrm6_init(); 3006 ret = xfrm6_init();
3003 if (ret) 3007 if (ret)
3004 goto out_fib6_init; 3008 goto out_fib6_init_late;
3005 3009
3006 ret = fib6_rules_init(); 3010 ret = fib6_rules_init();
3007 if (ret) 3011 if (ret)
@@ -3024,12 +3028,14 @@ fib6_rules_init:
3024 fib6_rules_cleanup(); 3028 fib6_rules_cleanup();
3025xfrm6_init: 3029xfrm6_init:
3026 xfrm6_fini(); 3030 xfrm6_fini();
3027out_fib6_init: 3031out_fib6_init_late:
3028 fib6_gc_cleanup(); 3032 fib6_cleanup_late();
3029out_register_inetpeer:
3030 unregister_pernet_subsys(&ipv6_inetpeer_ops);
3031out_register_subsys: 3033out_register_subsys:
3032 unregister_pernet_subsys(&ip6_route_net_ops); 3034 unregister_pernet_subsys(&ip6_route_net_ops);
3035out_register_inetpeer:
3036 unregister_pernet_subsys(&ipv6_inetpeer_ops);
3037out_fib6_init:
3038 fib6_gc_cleanup();
3033out_dst_entries: 3039out_dst_entries:
3034 dst_entries_destroy(&ip6_dst_blackhole_ops); 3040 dst_entries_destroy(&ip6_dst_blackhole_ops);
3035out_kmem_cache: 3041out_kmem_cache:
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 07d7d55a1b93..cd6f7a991d80 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -372,7 +372,6 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock,
372 skb_trim(skb, skb->dev->mtu); 372 skb_trim(skb, skb->dev->mtu);
373 } 373 }
374 skb->protocol = ETH_P_AF_IUCV; 374 skb->protocol = ETH_P_AF_IUCV;
375 skb_shinfo(skb)->tx_flags |= SKBTX_DRV_NEEDS_SK_REF;
376 nskb = skb_clone(skb, GFP_ATOMIC); 375 nskb = skb_clone(skb, GFP_ATOMIC);
377 if (!nskb) 376 if (!nskb)
378 return -ENOMEM; 377 return -ENOMEM;