diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-12-14 02:23:09 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-03 16:10:47 -0500 |
commit | 0fa1a53e1f055a6c790f40e7728f42a825b29248 (patch) | |
tree | 524eb8c8cadf6053faad6c8799c0571dee92c2b1 /net | |
parent | b9750ce13c08aa8a71a9b138d741f3046aefd991 (diff) |
[IPV6]: Introduce inet6_timewait_sock
Out of tcp6_timewait_sock, that now is just an aggregation of
inet_timewait_sock and inet6_timewait_sock, using tw_ipv6_offset in struct
inet_timewait_sock, that is common to the IPv6 transport protocols that use
timewait sockets, like DCCP and TCP.
tw_ipv6_offset plays the struct inet_sock pinfo6 role, i.e. for the generic
code to find the IPv6 area in a timewait sock.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/inet_diag.c | 6 | ||||
-rw-r--r-- | net/ipv4/tcp_minisocks.c | 8 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 2 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 12 |
4 files changed, 15 insertions, 13 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 3ce73b141d7e..c49908192047 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -112,12 +112,12 @@ static int inet_diag_fill(struct sk_buff *skb, struct sock *sk, | |||
112 | r->idiag_inode = 0; | 112 | r->idiag_inode = 0; |
113 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 113 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
114 | if (r->idiag_family == AF_INET6) { | 114 | if (r->idiag_family == AF_INET6) { |
115 | const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk); | 115 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); |
116 | 116 | ||
117 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, | 117 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, |
118 | &tcp6tw->tw_v6_rcv_saddr); | 118 | &tw6->tw_v6_rcv_saddr); |
119 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, | 119 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, |
120 | &tcp6tw->tw_v6_daddr); | 120 | &tw6->tw_v6_daddr); |
121 | } | 121 | } |
122 | #endif | 122 | #endif |
123 | nlh->nlmsg_len = skb->tail - b; | 123 | nlh->nlmsg_len = skb->tail - b; |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 9c029683a626..2b9b7f6c7f7c 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -298,10 +298,12 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) | |||
298 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 298 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
299 | if (tw->tw_family == PF_INET6) { | 299 | if (tw->tw_family == PF_INET6) { |
300 | struct ipv6_pinfo *np = inet6_sk(sk); | 300 | struct ipv6_pinfo *np = inet6_sk(sk); |
301 | struct tcp6_timewait_sock *tcp6tw = tcp6_twsk((struct sock *)tw); | 301 | struct inet6_timewait_sock *tw6; |
302 | 302 | ||
303 | ipv6_addr_copy(&tcp6tw->tw_v6_daddr, &np->daddr); | 303 | tw->tw_ipv6_offset = inet6_tw_offset(sk->sk_prot); |
304 | ipv6_addr_copy(&tcp6tw->tw_v6_rcv_saddr, &np->rcv_saddr); | 304 | tw6 = inet6_twsk((struct sock *)tw); |
305 | ipv6_addr_copy(&tw6->tw_v6_daddr, &np->daddr); | ||
306 | ipv6_addr_copy(&tw6->tw_v6_rcv_saddr, &np->rcv_saddr); | ||
305 | tw->tw_ipv6only = np->ipv6only; | 307 | tw->tw_ipv6only = np->ipv6only; |
306 | } | 308 | } |
307 | #endif | 309 | #endif |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index a60585fd85ad..704fb73e6c5f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1195,7 +1195,7 @@ struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, struct net_device * | |||
1195 | int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2) | 1195 | int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2) |
1196 | { | 1196 | { |
1197 | const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr; | 1197 | const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr; |
1198 | const struct in6_addr *sk2_rcv_saddr6 = tcp_v6_rcv_saddr(sk2); | 1198 | const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2); |
1199 | u32 sk_rcv_saddr = inet_sk(sk)->rcv_saddr; | 1199 | u32 sk_rcv_saddr = inet_sk(sk)->rcv_saddr; |
1200 | u32 sk2_rcv_saddr = inet_rcv_saddr(sk2); | 1200 | u32 sk2_rcv_saddr = inet_rcv_saddr(sk2); |
1201 | int sk_ipv6only = ipv6_only_sock(sk); | 1201 | int sk_ipv6only = ipv6_only_sock(sk); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 2f932ce72610..cb880079daf3 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -138,14 +138,14 @@ static int __tcp_v6_check_established(struct sock *sk, const __u16 lport, | |||
138 | 138 | ||
139 | /* Check TIME-WAIT sockets first. */ | 139 | /* Check TIME-WAIT sockets first. */ |
140 | sk_for_each(sk2, node, &(head + tcp_hashinfo.ehash_size)->chain) { | 140 | sk_for_each(sk2, node, &(head + tcp_hashinfo.ehash_size)->chain) { |
141 | const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk2); | 141 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk2); |
142 | 142 | ||
143 | tw = inet_twsk(sk2); | 143 | tw = inet_twsk(sk2); |
144 | 144 | ||
145 | if(*((__u32 *)&(tw->tw_dport)) == ports && | 145 | if(*((__u32 *)&(tw->tw_dport)) == ports && |
146 | sk2->sk_family == PF_INET6 && | 146 | sk2->sk_family == PF_INET6 && |
147 | ipv6_addr_equal(&tcp6tw->tw_v6_daddr, saddr) && | 147 | ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && |
148 | ipv6_addr_equal(&tcp6tw->tw_v6_rcv_saddr, daddr) && | 148 | ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && |
149 | sk2->sk_bound_dev_if == sk->sk_bound_dev_if) { | 149 | sk2->sk_bound_dev_if == sk->sk_bound_dev_if) { |
150 | const struct tcp_timewait_sock *tcptw = tcp_twsk(sk2); | 150 | const struct tcp_timewait_sock *tcptw = tcp_twsk(sk2); |
151 | struct tcp_sock *tp = tcp_sk(sk); | 151 | struct tcp_sock *tp = tcp_sk(sk); |
@@ -1663,14 +1663,14 @@ static void get_timewait6_sock(struct seq_file *seq, | |||
1663 | { | 1663 | { |
1664 | struct in6_addr *dest, *src; | 1664 | struct in6_addr *dest, *src; |
1665 | __u16 destp, srcp; | 1665 | __u16 destp, srcp; |
1666 | struct tcp6_timewait_sock *tcp6tw = tcp6_twsk((struct sock *)tw); | 1666 | struct inet6_timewait_sock *tw6 = inet6_twsk((struct sock *)tw); |
1667 | int ttd = tw->tw_ttd - jiffies; | 1667 | int ttd = tw->tw_ttd - jiffies; |
1668 | 1668 | ||
1669 | if (ttd < 0) | 1669 | if (ttd < 0) |
1670 | ttd = 0; | 1670 | ttd = 0; |
1671 | 1671 | ||
1672 | dest = &tcp6tw->tw_v6_daddr; | 1672 | dest = &tw6->tw_v6_daddr; |
1673 | src = &tcp6tw->tw_v6_rcv_saddr; | 1673 | src = &tw6->tw_v6_rcv_saddr; |
1674 | destp = ntohs(tw->tw_dport); | 1674 | destp = ntohs(tw->tw_dport); |
1675 | srcp = ntohs(tw->tw_sport); | 1675 | srcp = ntohs(tw->tw_sport); |
1676 | 1676 | ||