diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/ipv6.h | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 69a0decfbdf4..7d3908594fac 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -348,26 +348,36 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
348 | 348 | ||
349 | #include <linux/tcp.h> | 349 | #include <linux/tcp.h> |
350 | 350 | ||
351 | struct inet6_timewait_sock { | ||
352 | struct in6_addr tw_v6_daddr; | ||
353 | struct in6_addr tw_v6_rcv_saddr; | ||
354 | }; | ||
355 | |||
351 | struct tcp6_timewait_sock { | 356 | struct tcp6_timewait_sock { |
352 | struct tcp_timewait_sock tw_v6_sk; | 357 | struct tcp_timewait_sock tcp6tw_tcp; |
353 | struct in6_addr tw_v6_daddr; | 358 | struct inet6_timewait_sock tcp6tw_inet6; |
354 | struct in6_addr tw_v6_rcv_saddr; | ||
355 | }; | 359 | }; |
356 | 360 | ||
357 | static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk) | 361 | static inline u16 inet6_tw_offset(const struct proto *prot) |
362 | { | ||
363 | return prot->twsk_obj_size - sizeof(struct inet6_timewait_sock); | ||
364 | } | ||
365 | |||
366 | static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk) | ||
358 | { | 367 | { |
359 | return (struct tcp6_timewait_sock *)sk; | 368 | return (struct inet6_timewait_sock *)(((u8 *)sk) + |
369 | inet_twsk(sk)->tw_ipv6_offset); | ||
360 | } | 370 | } |
361 | 371 | ||
362 | static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) | 372 | static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk) |
363 | { | 373 | { |
364 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | 374 | return likely(sk->sk_state != TCP_TIME_WAIT) ? |
365 | &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr; | 375 | &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr; |
366 | } | 376 | } |
367 | 377 | ||
368 | static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) | 378 | static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk) |
369 | { | 379 | { |
370 | return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; | 380 | return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL; |
371 | } | 381 | } |
372 | 382 | ||
373 | static inline int inet_v6_ipv6only(const struct sock *sk) | 383 | static inline int inet_v6_ipv6only(const struct sock *sk) |
@@ -395,8 +405,8 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) | |||
395 | return NULL; | 405 | return NULL; |
396 | } | 406 | } |
397 | 407 | ||
398 | #define __tcp_v6_rcv_saddr(__sk) NULL | 408 | #define __inet6_rcv_saddr(__sk) NULL |
399 | #define tcp_v6_rcv_saddr(__sk) NULL | 409 | #define inet6_rcv_saddr(__sk) NULL |
400 | #define tcp_twsk_ipv6only(__sk) 0 | 410 | #define tcp_twsk_ipv6only(__sk) 0 |
401 | #define inet_v6_ipv6only(__sk) 0 | 411 | #define inet_v6_ipv6only(__sk) 0 |
402 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | 412 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ |