diff options
Diffstat (limited to 'include/net/inet_sock.h')
-rw-r--r-- | include/net/inet_sock.h | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index b21a7f06d6a4..1833c3f389ee 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -70,13 +70,14 @@ struct ip_options_data { | |||
70 | 70 | ||
71 | struct inet_request_sock { | 71 | struct inet_request_sock { |
72 | struct request_sock req; | 72 | struct request_sock req; |
73 | #if IS_ENABLED(CONFIG_IPV6) | 73 | #define ir_loc_addr req.__req_common.skc_rcv_saddr |
74 | u16 inet6_rsk_offset; | 74 | #define ir_rmt_addr req.__req_common.skc_daddr |
75 | #endif | 75 | #define ir_num req.__req_common.skc_num |
76 | __be16 loc_port; | 76 | #define ir_rmt_port req.__req_common.skc_dport |
77 | __be32 loc_addr; | 77 | #define ir_v6_rmt_addr req.__req_common.skc_v6_daddr |
78 | __be32 rmt_addr; | 78 | #define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr |
79 | __be16 rmt_port; | 79 | #define ir_iif req.__req_common.skc_bound_dev_if |
80 | |||
80 | kmemcheck_bitfield_begin(flags); | 81 | kmemcheck_bitfield_begin(flags); |
81 | u16 snd_wscale : 4, | 82 | u16 snd_wscale : 4, |
82 | rcv_wscale : 4, | 83 | rcv_wscale : 4, |
@@ -88,6 +89,7 @@ struct inet_request_sock { | |||
88 | no_srccheck: 1; | 89 | no_srccheck: 1; |
89 | kmemcheck_bitfield_end(flags); | 90 | kmemcheck_bitfield_end(flags); |
90 | struct ip_options_rcu *opt; | 91 | struct ip_options_rcu *opt; |
92 | struct sk_buff *pktopts; | ||
91 | }; | 93 | }; |
92 | 94 | ||
93 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | 95 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) |
@@ -103,6 +105,9 @@ struct inet_cork { | |||
103 | int length; /* Total length of all frames */ | 105 | int length; /* Total length of all frames */ |
104 | struct dst_entry *dst; | 106 | struct dst_entry *dst; |
105 | u8 tx_flags; | 107 | u8 tx_flags; |
108 | __u8 ttl; | ||
109 | __s16 tos; | ||
110 | char priority; | ||
106 | }; | 111 | }; |
107 | 112 | ||
108 | struct inet_cork_full { | 113 | struct inet_cork_full { |
@@ -143,10 +148,8 @@ struct inet_sock { | |||
143 | /* Socket demultiplex comparisons on incoming packets. */ | 148 | /* Socket demultiplex comparisons on incoming packets. */ |
144 | #define inet_daddr sk.__sk_common.skc_daddr | 149 | #define inet_daddr sk.__sk_common.skc_daddr |
145 | #define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr | 150 | #define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr |
146 | #define inet_addrpair sk.__sk_common.skc_addrpair | ||
147 | #define inet_dport sk.__sk_common.skc_dport | 151 | #define inet_dport sk.__sk_common.skc_dport |
148 | #define inet_num sk.__sk_common.skc_num | 152 | #define inet_num sk.__sk_common.skc_num |
149 | #define inet_portpair sk.__sk_common.skc_portpair | ||
150 | 153 | ||
151 | __be32 inet_saddr; | 154 | __be32 inet_saddr; |
152 | __s16 uc_ttl; | 155 | __s16 uc_ttl; |
@@ -199,32 +202,18 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
199 | } | 202 | } |
200 | #endif | 203 | #endif |
201 | 204 | ||
202 | extern int inet_sk_rebuild_header(struct sock *sk); | 205 | int inet_sk_rebuild_header(struct sock *sk); |
203 | |||
204 | extern u32 inet_ehash_secret; | ||
205 | extern u32 ipv6_hash_secret; | ||
206 | extern void build_ehash_secret(void); | ||
207 | 206 | ||
208 | static inline unsigned int inet_ehashfn(struct net *net, | 207 | static inline unsigned int __inet_ehashfn(const __be32 laddr, |
209 | const __be32 laddr, const __u16 lport, | 208 | const __u16 lport, |
210 | const __be32 faddr, const __be16 fport) | 209 | const __be32 faddr, |
210 | const __be16 fport, | ||
211 | u32 initval) | ||
211 | { | 212 | { |
212 | return jhash_3words((__force __u32) laddr, | 213 | return jhash_3words((__force __u32) laddr, |
213 | (__force __u32) faddr, | 214 | (__force __u32) faddr, |
214 | ((__u32) lport) << 16 | (__force __u32)fport, | 215 | ((__u32) lport) << 16 | (__force __u32)fport, |
215 | inet_ehash_secret + net_hash_mix(net)); | 216 | initval); |
216 | } | ||
217 | |||
218 | static inline int inet_sk_ehashfn(const struct sock *sk) | ||
219 | { | ||
220 | const struct inet_sock *inet = inet_sk(sk); | ||
221 | const __be32 laddr = inet->inet_rcv_saddr; | ||
222 | const __u16 lport = inet->inet_num; | ||
223 | const __be32 faddr = inet->inet_daddr; | ||
224 | const __be16 fport = inet->inet_dport; | ||
225 | struct net *net = sock_net(sk); | ||
226 | |||
227 | return inet_ehashfn(net, laddr, lport, faddr, fport); | ||
228 | } | 217 | } |
229 | 218 | ||
230 | static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) | 219 | static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) |