diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ipv6.h | 32 | ||||
-rw-r--r-- | include/net/inet6_hashtables.h | 6 | ||||
-rw-r--r-- | include/net/inet_timewait_sock.h | 3 |
3 files changed, 26 insertions, 15 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) */ |
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index a4a204f99ea6..25f708ff020e 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -110,10 +110,10 @@ static inline struct sock * | |||
110 | 110 | ||
111 | if(*((__u32 *)&(tw->tw_dport)) == ports && | 111 | if(*((__u32 *)&(tw->tw_dport)) == ports && |
112 | sk->sk_family == PF_INET6) { | 112 | sk->sk_family == PF_INET6) { |
113 | const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk); | 113 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); |
114 | 114 | ||
115 | if (ipv6_addr_equal(&tcp6tw->tw_v6_daddr, saddr) && | 115 | if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && |
116 | ipv6_addr_equal(&tcp6tw->tw_v6_rcv_saddr, daddr) && | 116 | ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && |
117 | (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif)) | 117 | (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif)) |
118 | goto hit; | 118 | goto hit; |
119 | } | 119 | } |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 28f7b2103505..ca240f856c46 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -127,7 +127,8 @@ struct inet_timewait_sock { | |||
127 | __u16 tw_num; | 127 | __u16 tw_num; |
128 | /* And these are ours. */ | 128 | /* And these are ours. */ |
129 | __u8 tw_ipv6only:1; | 129 | __u8 tw_ipv6only:1; |
130 | /* 31 bits hole, try to pack */ | 130 | /* 15 bits hole, try to pack */ |
131 | __u16 tw_ipv6_offset; | ||
131 | int tw_timeout; | 132 | int tw_timeout; |
132 | unsigned long tw_ttd; | 133 | unsigned long tw_ttd; |
133 | struct inet_bind_bucket *tw_tb; | 134 | struct inet_bind_bucket *tw_tb; |