aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-26 14:44:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-26 14:44:11 -0500
commit1cef9350cbee6e3bcf2ff646b8978fbec33f8b85 (patch)
tree5a750b707dcfb66033da612e8fbf238e3a2b184f /include
parentecc88efbe7adceb3f4bfdbbb1efb669efcaab124 (diff)
parenteb970ff07c15f13eb474f643fd165ebe3e4e24b2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) ping_err() ICMP error handler looks at wrong ICMP header, from Li Wei. 2) TCP socket hash function on ipv6 is too weak, from Eric Dumazet. 3) netif_set_xps_queue() forgets to drop mutex on errors, fix from Alexander Duyck. 4) sum_frag_mem_limit() can deadlock due to lack of BH disabling, fix from Eric Dumazet. 5) TCP SYN data is miscalculated in tcp_send_syn_data(), because the amount of TCP option space was not taken into account properly in this code path. Fix from yuchung Cheng. 6) MLX4 driver allocates device queues with the wrong size, from Kleber Sacilotto. 7) sock_diag can access past the end of the sock_diag_handlers[] array, from Mathias Krause. 8) vlan_set_encap_proto() makes incorrect assumptions about where skb->data points, rework the logic so that it works regardless of where skb->data happens to be. From Jesse Gross. 9) Fix gianfar build failure with NET_POLL enabled, from Paul Gortmaker. 10) Fix Ipv4 ID setting and checksum calculations in GRE driver, from Pravin B Shelar. 11) bgmac driver does: int i; for (i = 0; ...; ...) { ... for (i = 0; ...; ...) { effectively corrupting the outer loop index, use a seperate variable for the inner loops. From Rafał Miłecki. 12) Fix suspend bugs in smsc95xx driver, from Ming Lei. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (35 commits) usbnet: smsc95xx: rename FEATURE_AUTOSUSPEND usbnet: smsc95xx: fix broken runtime suspend usbnet: smsc95xx: fix suspend failure bgmac: fix indexing of 2nd level loops b43: Fix lockdep splat on module unload Revert "ip_gre: propogate target device GSO capability to the tunnel device" IP_GRE: Fix GRE_CSUM case. VXLAN: Use tunnel_ip_select_ident() for tunnel IP-Identification. IP_GRE: Fix IP-Identification. net/pasemi: Fix missing coding style vmxnet3: fix ethtool ring buffer size setting vmxnet3: make local function static bnx2x: remove dead code and make local funcs static gianfar: fix compile fail for NET_POLL=y due to struct packing vlan: adjust vlan_set_encap_proto() for its callers sock_diag: Simplify sock_diag_handlers[] handling in __sock_diag_rcv_msg sock_diag: Fix out-of-bounds access to sock_diag_handlers[] vxlan: remove depends on CONFIG_EXPERIMENTAL mlx4_en: fix allocation of CPU affinity reverse-map mlx4_en: fix allocation of device tx_cq ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/net/icmp.h1
-rw-r--r--include/net/inet6_hashtables.h8
-rw-r--r--include/net/inet_frag.h8
-rw-r--r--include/net/inet_sock.h1
-rw-r--r--include/net/ipip.h17
-rw-r--r--include/net/ipv6.h12
7 files changed, 45 insertions, 8 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d06cc5c8f58c..218a3b686d90 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -331,7 +331,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
331 struct vlan_hdr *vhdr) 331 struct vlan_hdr *vhdr)
332{ 332{
333 __be16 proto; 333 __be16 proto;
334 unsigned char *rawp; 334 unsigned short *rawp;
335 335
336 /* 336 /*
337 * Was a VLAN packet, grab the encapsulated protocol, which the layer 337 * Was a VLAN packet, grab the encapsulated protocol, which the layer
@@ -344,8 +344,8 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
344 return; 344 return;
345 } 345 }
346 346
347 rawp = skb->data; 347 rawp = (unsigned short *)(vhdr + 1);
348 if (*(unsigned short *) rawp == 0xFFFF) 348 if (*rawp == 0xFFFF)
349 /* 349 /*
350 * This is a magic hack to spot IPX packets. Older Novell 350 * This is a magic hack to spot IPX packets. Older Novell
351 * breaks the protocol design and runs IPX over 802.3 without 351 * breaks the protocol design and runs IPX over 802.3 without
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 9ac2524d1402..081439fd070e 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -41,6 +41,7 @@ struct net;
41 41
42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43extern int icmp_rcv(struct sk_buff *skb); 43extern int icmp_rcv(struct sk_buff *skb);
44extern void icmp_err(struct sk_buff *, u32 info);
44extern int icmp_init(void); 45extern int icmp_init(void);
45extern void icmp_out_count(struct net *net, unsigned char type); 46extern void icmp_out_count(struct net *net, unsigned char type);
46 47
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 7ca75cbbf75e..fd4ee016ba5c 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -28,16 +28,16 @@
28 28
29struct inet_hashinfo; 29struct inet_hashinfo;
30 30
31/* I have no idea if this is a good hash for v6 or not. -DaveM */
32static inline unsigned int inet6_ehashfn(struct net *net, 31static inline unsigned int inet6_ehashfn(struct net *net,
33 const struct in6_addr *laddr, const u16 lport, 32 const struct in6_addr *laddr, const u16 lport,
34 const struct in6_addr *faddr, const __be16 fport) 33 const struct in6_addr *faddr, const __be16 fport)
35{ 34{
36 u32 ports = (lport ^ (__force u16)fport); 35 u32 ports = (((u32)lport) << 16) | (__force u32)fport;
37 36
38 return jhash_3words((__force u32)laddr->s6_addr32[3], 37 return jhash_3words((__force u32)laddr->s6_addr32[3],
39 (__force u32)faddr->s6_addr32[3], 38 ipv6_addr_jhash(faddr),
40 ports, inet_ehash_secret + net_hash_mix(net)); 39 ports,
40 inet_ehash_secret + net_hash_mix(net));
41} 41}
42 42
43static inline int inet6_sk_ehashfn(const struct sock *sk) 43static inline int inet6_sk_ehashfn(const struct sock *sk)
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 3f237db0a426..76c3fe5ecc2e 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -114,7 +114,13 @@ static inline void init_frag_mem_limit(struct netns_frags *nf)
114 114
115static inline int sum_frag_mem_limit(struct netns_frags *nf) 115static inline int sum_frag_mem_limit(struct netns_frags *nf)
116{ 116{
117 return percpu_counter_sum_positive(&nf->mem); 117 int res;
118
119 local_bh_disable();
120 res = percpu_counter_sum_positive(&nf->mem);
121 local_bh_enable();
122
123 return res;
118} 124}
119 125
120static inline void inet_frag_lru_move(struct inet_frag_queue *q) 126static inline void inet_frag_lru_move(struct inet_frag_queue *q)
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index a4196cbc84ec..7235ae73a1e8 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -203,6 +203,7 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
203extern int inet_sk_rebuild_header(struct sock *sk); 203extern int inet_sk_rebuild_header(struct sock *sk);
204 204
205extern u32 inet_ehash_secret; 205extern u32 inet_ehash_secret;
206extern u32 ipv6_hash_secret;
206extern void build_ehash_secret(void); 207extern void build_ehash_secret(void);
207 208
208static inline unsigned int inet_ehashfn(struct net *net, 209static inline unsigned int inet_ehashfn(struct net *net,
diff --git a/include/net/ipip.h b/include/net/ipip.h
index 21947cf4fa46..fd19625ff99d 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -71,4 +71,21 @@ static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev)
71 } 71 }
72} 72}
73 73
74static inline void tunnel_ip_select_ident(struct sk_buff *skb,
75 const struct iphdr *old_iph,
76 struct dst_entry *dst)
77{
78 struct iphdr *iph = ip_hdr(skb);
79
80 if (iph->frag_off & htons(IP_DF))
81 iph->id = 0;
82 else {
83 /* Use inner packet iph-id if possible. */
84 if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
85 iph->id = old_iph->id;
86 else
87 __ip_select_ident(iph, dst,
88 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
89 }
90}
74#endif 91#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 851d5412a299..64d12e77719a 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/ipv6.h> 16#include <linux/ipv6.h>
17#include <linux/hardirq.h> 17#include <linux/hardirq.h>
18#include <linux/jhash.h>
18#include <net/if_inet6.h> 19#include <net/if_inet6.h>
19#include <net/ndisc.h> 20#include <net/ndisc.h>
20#include <net/flow.h> 21#include <net/flow.h>
@@ -514,6 +515,17 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a)
514#endif 515#endif
515} 516}
516 517
518/* more secured version of ipv6_addr_hash() */
519static inline u32 ipv6_addr_jhash(const struct in6_addr *a)
520{
521 u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1];
522
523 return jhash_3words(v,
524 (__force u32)a->s6_addr32[2],
525 (__force u32)a->s6_addr32[3],
526 ipv6_hash_secret);
527}
528
517static inline bool ipv6_addr_loopback(const struct in6_addr *a) 529static inline bool ipv6_addr_loopback(const struct in6_addr *a)
518{ 530{
519#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 531#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64