aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/inet_sock.h')
-rw-r--r--include/net/inet_sock.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 1f4a9a60d4c..ce6da97bc84 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -27,7 +27,6 @@
27/** struct ip_options - IP Options 27/** struct ip_options - IP Options
28 * 28 *
29 * @faddr - Saved first hop address 29 * @faddr - Saved first hop address
30 * @is_setbyuser - Set by setsockopt?
31 * @is_data - Options in __data, rather than skb 30 * @is_data - Options in __data, rather than skb
32 * @is_strictroute - Strict source route 31 * @is_strictroute - Strict source route
33 * @srr_is_hit - Packet destination addr was our one 32 * @srr_is_hit - Packet destination addr was our one
@@ -37,13 +36,12 @@
37 * @ts_needaddr - Need to record addr of outgoing dev 36 * @ts_needaddr - Need to record addr of outgoing dev
38 */ 37 */
39struct ip_options { 38struct ip_options {
40 __u32 faddr; 39 __be32 faddr;
41 unsigned char optlen; 40 unsigned char optlen;
42 unsigned char srr; 41 unsigned char srr;
43 unsigned char rr; 42 unsigned char rr;
44 unsigned char ts; 43 unsigned char ts;
45 unsigned char is_setbyuser:1, 44 unsigned char is_data:1,
46 is_data:1,
47 is_strictroute:1, 45 is_strictroute:1,
48 srr_is_hit:1, 46 srr_is_hit:1,
49 is_changed:1, 47 is_changed:1,
@@ -51,7 +49,7 @@ struct ip_options {
51 ts_needtime:1, 49 ts_needtime:1,
52 ts_needaddr:1; 50 ts_needaddr:1;
53 unsigned char router_alert; 51 unsigned char router_alert;
54 unsigned char __pad1; 52 unsigned char cipso;
55 unsigned char __pad2; 53 unsigned char __pad2;
56 unsigned char __data[0]; 54 unsigned char __data[0];
57}; 55};
@@ -64,9 +62,9 @@ struct inet_request_sock {
64 u16 inet6_rsk_offset; 62 u16 inet6_rsk_offset;
65 /* 2 bytes hole, try to pack */ 63 /* 2 bytes hole, try to pack */
66#endif 64#endif
67 u32 loc_addr; 65 __be32 loc_addr;
68 u32 rmt_addr; 66 __be32 rmt_addr;
69 u16 rmt_port; 67 __be16 rmt_port;
70 u16 snd_wscale : 4, 68 u16 snd_wscale : 4,
71 rcv_wscale : 4, 69 rcv_wscale : 4,
72 tstamp_ok : 1, 70 tstamp_ok : 1,
@@ -112,15 +110,15 @@ struct inet_sock {
112 struct ipv6_pinfo *pinet6; 110 struct ipv6_pinfo *pinet6;
113#endif 111#endif
114 /* Socket demultiplex comparisons on incoming packets. */ 112 /* Socket demultiplex comparisons on incoming packets. */
115 __u32 daddr; 113 __be32 daddr;
116 __u32 rcv_saddr; 114 __be32 rcv_saddr;
117 __u16 dport; 115 __be16 dport;
118 __u16 num; 116 __u16 num;
119 __u32 saddr; 117 __be32 saddr;
120 __s16 uc_ttl; 118 __s16 uc_ttl;
121 __u16 cmsg_flags; 119 __u16 cmsg_flags;
122 struct ip_options *opt; 120 struct ip_options *opt;
123 __u16 sport; 121 __be16 sport;
124 __u16 id; 122 __u16 id;
125 __u8 tos; 123 __u8 tos;
126 __u8 mc_ttl; 124 __u8 mc_ttl;
@@ -131,7 +129,7 @@ struct inet_sock {
131 hdrincl:1, 129 hdrincl:1,
132 mc_loop:1; 130 mc_loop:1;
133 int mc_index; 131 int mc_index;
134 __u32 mc_addr; 132 __be32 mc_addr;
135 struct ip_mc_socklist *mc_list; 133 struct ip_mc_socklist *mc_list;
136 struct { 134 struct {
137 unsigned int flags; 135 unsigned int flags;
@@ -139,7 +137,7 @@ struct inet_sock {
139 struct ip_options *opt; 137 struct ip_options *opt;
140 struct rtable *rt; 138 struct rtable *rt;
141 int length; /* Total length of all frames */ 139 int length; /* Total length of all frames */
142 u32 addr; 140 __be32 addr;
143 struct flowi fl; 141 struct flowi fl;
144 } cork; 142 } cork;
145}; 143};
@@ -169,10 +167,10 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
169 167
170extern int inet_sk_rebuild_header(struct sock *sk); 168extern int inet_sk_rebuild_header(struct sock *sk);
171 169
172static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, 170static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
173 const __u32 faddr, const __u16 fport) 171 const __be32 faddr, const __be16 fport)
174{ 172{
175 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); 173 unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport);
176 h ^= h >> 16; 174 h ^= h >> 16;
177 h ^= h >> 8; 175 h ^= h >> 8;
178 return h; 176 return h;
@@ -181,10 +179,10 @@ static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
181static inline int inet_sk_ehashfn(const struct sock *sk) 179static inline int inet_sk_ehashfn(const struct sock *sk)
182{ 180{
183 const struct inet_sock *inet = inet_sk(sk); 181 const struct inet_sock *inet = inet_sk(sk);
184 const __u32 laddr = inet->rcv_saddr; 182 const __be32 laddr = inet->rcv_saddr;
185 const __u16 lport = inet->num; 183 const __u16 lport = inet->num;
186 const __u32 faddr = inet->daddr; 184 const __be32 faddr = inet->daddr;
187 const __u16 fport = inet->dport; 185 const __be16 fport = inet->dport;
188 186
189 return inet_ehashfn(laddr, lport, faddr, fport); 187 return inet_ehashfn(laddr, lport, faddr, fport);
190} 188}