diff options
Diffstat (limited to 'include/linux/ipv6.h')
-rw-r--r-- | include/linux/ipv6.h | 76 |
1 files changed, 9 insertions, 67 deletions
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 28ea38439313..5d89d1b808a6 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -21,13 +21,11 @@ struct ipv6_devconf { | |||
21 | __s32 force_mld_version; | 21 | __s32 force_mld_version; |
22 | __s32 mldv1_unsolicited_report_interval; | 22 | __s32 mldv1_unsolicited_report_interval; |
23 | __s32 mldv2_unsolicited_report_interval; | 23 | __s32 mldv2_unsolicited_report_interval; |
24 | #ifdef CONFIG_IPV6_PRIVACY | ||
25 | __s32 use_tempaddr; | 24 | __s32 use_tempaddr; |
26 | __s32 temp_valid_lft; | 25 | __s32 temp_valid_lft; |
27 | __s32 temp_prefered_lft; | 26 | __s32 temp_prefered_lft; |
28 | __s32 regen_max_retry; | 27 | __s32 regen_max_retry; |
29 | __s32 max_desync_factor; | 28 | __s32 max_desync_factor; |
30 | #endif | ||
31 | __s32 max_addresses; | 29 | __s32 max_addresses; |
32 | __s32 accept_ra_defrtr; | 30 | __s32 accept_ra_defrtr; |
33 | __s32 accept_ra_pinfo; | 31 | __s32 accept_ra_pinfo; |
@@ -115,16 +113,8 @@ static inline int inet6_iif(const struct sk_buff *skb) | |||
115 | return IP6CB(skb)->iif; | 113 | return IP6CB(skb)->iif; |
116 | } | 114 | } |
117 | 115 | ||
118 | struct inet6_request_sock { | ||
119 | struct in6_addr loc_addr; | ||
120 | struct in6_addr rmt_addr; | ||
121 | struct sk_buff *pktopts; | ||
122 | int iif; | ||
123 | }; | ||
124 | |||
125 | struct tcp6_request_sock { | 116 | struct tcp6_request_sock { |
126 | struct tcp_request_sock tcp6rsk_tcp; | 117 | struct tcp_request_sock tcp6rsk_tcp; |
127 | struct inet6_request_sock tcp6rsk_inet6; | ||
128 | }; | 118 | }; |
129 | 119 | ||
130 | struct ipv6_mc_socklist; | 120 | struct ipv6_mc_socklist; |
@@ -141,8 +131,6 @@ struct ipv6_fl_socklist; | |||
141 | */ | 131 | */ |
142 | struct ipv6_pinfo { | 132 | struct ipv6_pinfo { |
143 | struct in6_addr saddr; | 133 | struct in6_addr saddr; |
144 | struct in6_addr rcv_saddr; | ||
145 | struct in6_addr daddr; | ||
146 | struct in6_pktinfo sticky_pktinfo; | 134 | struct in6_pktinfo sticky_pktinfo; |
147 | const struct in6_addr *daddr_cache; | 135 | const struct in6_addr *daddr_cache; |
148 | #ifdef CONFIG_IPV6_SUBTREES | 136 | #ifdef CONFIG_IPV6_SUBTREES |
@@ -256,48 +244,22 @@ struct tcp6_sock { | |||
256 | 244 | ||
257 | extern int inet6_sk_rebuild_header(struct sock *sk); | 245 | extern int inet6_sk_rebuild_header(struct sock *sk); |
258 | 246 | ||
259 | struct inet6_timewait_sock { | ||
260 | struct in6_addr tw_v6_daddr; | ||
261 | struct in6_addr tw_v6_rcv_saddr; | ||
262 | }; | ||
263 | |||
264 | struct tcp6_timewait_sock { | 247 | struct tcp6_timewait_sock { |
265 | struct tcp_timewait_sock tcp6tw_tcp; | 248 | struct tcp_timewait_sock tcp6tw_tcp; |
266 | struct inet6_timewait_sock tcp6tw_inet6; | ||
267 | }; | 249 | }; |
268 | 250 | ||
269 | static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk) | ||
270 | { | ||
271 | return (struct inet6_timewait_sock *)(((u8 *)sk) + | ||
272 | inet_twsk(sk)->tw_ipv6_offset); | ||
273 | } | ||
274 | |||
275 | #if IS_ENABLED(CONFIG_IPV6) | 251 | #if IS_ENABLED(CONFIG_IPV6) |
276 | static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) | 252 | static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) |
277 | { | 253 | { |
278 | return inet_sk(__sk)->pinet6; | 254 | return inet_sk(__sk)->pinet6; |
279 | } | 255 | } |
280 | 256 | ||
281 | static inline struct inet6_request_sock * | ||
282 | inet6_rsk(const struct request_sock *rsk) | ||
283 | { | ||
284 | return (struct inet6_request_sock *)(((u8 *)rsk) + | ||
285 | inet_rsk(rsk)->inet6_rsk_offset); | ||
286 | } | ||
287 | |||
288 | static inline u32 inet6_rsk_offset(struct request_sock *rsk) | ||
289 | { | ||
290 | return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock); | ||
291 | } | ||
292 | |||
293 | static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops) | 257 | static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops) |
294 | { | 258 | { |
295 | struct request_sock *req = reqsk_alloc(ops); | 259 | struct request_sock *req = reqsk_alloc(ops); |
296 | 260 | ||
297 | if (req != NULL) { | 261 | if (req) |
298 | inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req); | 262 | inet_rsk(req)->pktopts = NULL; |
299 | inet6_rsk(req)->pktopts = NULL; | ||
300 | } | ||
301 | 263 | ||
302 | return req; | 264 | return req; |
303 | } | 265 | } |
@@ -321,21 +283,11 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
321 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) | 283 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) |
322 | #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) | 284 | #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) |
323 | 285 | ||
324 | static inline u16 inet6_tw_offset(const struct proto *prot) | 286 | static inline const struct in6_addr *inet6_rcv_saddr(const struct sock *sk) |
325 | { | 287 | { |
326 | return prot->twsk_prot->twsk_obj_size - | 288 | if (sk->sk_family == AF_INET6) |
327 | sizeof(struct inet6_timewait_sock); | 289 | return &sk->sk_v6_rcv_saddr; |
328 | } | 290 | return NULL; |
329 | |||
330 | static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk) | ||
331 | { | ||
332 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | ||
333 | &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr; | ||
334 | } | ||
335 | |||
336 | static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk) | ||
337 | { | ||
338 | return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL; | ||
339 | } | 291 | } |
340 | 292 | ||
341 | static inline int inet_v6_ipv6only(const struct sock *sk) | 293 | static inline int inet_v6_ipv6only(const struct sock *sk) |
@@ -363,28 +315,18 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) | |||
363 | return NULL; | 315 | return NULL; |
364 | } | 316 | } |
365 | 317 | ||
366 | #define __inet6_rcv_saddr(__sk) NULL | ||
367 | #define inet6_rcv_saddr(__sk) NULL | 318 | #define inet6_rcv_saddr(__sk) NULL |
368 | #define tcp_twsk_ipv6only(__sk) 0 | 319 | #define tcp_twsk_ipv6only(__sk) 0 |
369 | #define inet_v6_ipv6only(__sk) 0 | 320 | #define inet_v6_ipv6only(__sk) 0 |
370 | #endif /* IS_ENABLED(CONFIG_IPV6) */ | 321 | #endif /* IS_ENABLED(CONFIG_IPV6) */ |
371 | 322 | ||
372 | #define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \ | 323 | #define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \ |
373 | ((inet_sk(__sk)->inet_portpair == (__ports)) && \ | 324 | (((__sk)->sk_portpair == (__ports)) && \ |
374 | ((__sk)->sk_family == AF_INET6) && \ | 325 | ((__sk)->sk_family == AF_INET6) && \ |
375 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ | 326 | ipv6_addr_equal(&(__sk)->sk_v6_daddr, (__saddr)) && \ |
376 | ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ | 327 | ipv6_addr_equal(&(__sk)->sk_v6_rcv_saddr, (__daddr)) && \ |
377 | (!(__sk)->sk_bound_dev_if || \ | 328 | (!(__sk)->sk_bound_dev_if || \ |
378 | ((__sk)->sk_bound_dev_if == (__dif))) && \ | 329 | ((__sk)->sk_bound_dev_if == (__dif))) && \ |
379 | net_eq(sock_net(__sk), (__net))) | 330 | net_eq(sock_net(__sk), (__net))) |
380 | 331 | ||
381 | #define INET6_TW_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \ | ||
382 | ((inet_twsk(__sk)->tw_portpair == (__ports)) && \ | ||
383 | ((__sk)->sk_family == AF_INET6) && \ | ||
384 | ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr)) && \ | ||
385 | ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr)) && \ | ||
386 | (!(__sk)->sk_bound_dev_if || \ | ||
387 | ((__sk)->sk_bound_dev_if == (__dif))) && \ | ||
388 | net_eq(sock_net(__sk), (__net))) | ||
389 | |||
390 | #endif /* _IPV6_H */ | 332 | #endif /* _IPV6_H */ |