diff options
| author | Hideaki Yoshifuji <yoshfuji@linux-ipv6.org> | 2003-10-27 11:11:07 -0800 |
|---|---|---|
| committer | Hideaki Yoshifuji <yoshfuji@linux-ipv6.org> | 2003-10-27 11:11:07 -0800 |
| commit | af2e3380967d2728bf94c2bc915ec6009587f703 (patch) | |
| tree | 3de6c45f81bbe9420514b4e53d5ca5b4973cc4f2 /include | |
| parent | c54c83e82aa31b4f381dc8426b79cd17989e87eb (diff) | |
[IPV6]: Fix inappropriate usage of inet{,6}_sk().
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/tcp.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index d4e9c07f86d0..2bfe64e2104b 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -219,6 +219,7 @@ struct tcp_tw_bucket { #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) struct in6_addr tw_v6_daddr; struct in6_addr tw_v6_rcv_saddr; + int tw_v6_ipv6only; #endif }; @@ -267,6 +268,38 @@ static __inline__ int tw_del_dead_node(struct tcp_tw_bucket *tw) #define tcptw_sk(__sk) ((struct tcp_tw_bucket *)(__sk)) +static inline const u32 tcp_v4_rcv_saddr(const struct sock *sk) +{ + return likely(sk->sk_state != TCP_TIME_WAIT) ? + inet_sk(sk)->rcv_saddr : tcptw_sk(sk)->tw_rcv_saddr; +} + +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) +static inline const struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) +{ + return likely(sk->sk_state != TCP_TIME_WAIT) ? + &inet6_sk(sk)->rcv_saddr : &tcptw_sk(sk)->tw_v6_rcv_saddr; +} + +static inline const struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) +{ + return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; +} + +#define tcptw_sk_ipv6only(__sk) (tcptw_sk(__sk)->tw_v6_ipv6only) + +static inline int tcp_v6_ipv6only(const struct sock *sk) +{ + return likely(sk->sk_state != TCP_TIME_WAIT) ? + ipv6_only_sock(sk) : tcptw_sk_ipv6only(sk); +} +#else +# define __tcp_v6_rcv_saddr(__sk) NULL +# define tcp_v6_rcv_saddr(__sk) NULL +# define tcptw_sk_ipv6only(__sk) 0 +# define tcp_v6_ipv6only(__sk) 0 +#endif + extern kmem_cache_t *tcp_timewait_cachep; static inline void tcp_tw_put(struct tcp_tw_bucket *tw) |
