aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-12-02 14:52:07 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-02 15:14:37 -0500
commitdb3949c4506a21633469d71f2915cf660eea0a35 (patch)
treebe59f60360688d8157ad61d5fc8353424e472237 /net/ipv6
parent493f377d6dd56f4e98b198d637fe714ab124681b (diff)
tcp: Implement ipv6 ->get_peer() and ->tw_get_peer().
Now ipv6 timewait recycling is fully implemented and enabled. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/tcp_ipv6.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index c2ebbe1c5a47..319458558df9 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1865,19 +1865,33 @@ do_time_wait:
1865 1865
1866static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it) 1866static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it)
1867{ 1867{
1868 /* Alas, not yet... */ 1868 struct rt6_info *rt = (struct rt6_info *) __sk_dst_get(sk);
1869 return NULL; 1869 struct ipv6_pinfo *np = inet6_sk(sk);
1870 struct inet_peer *peer;
1871
1872 if (!rt ||
1873 !ipv6_addr_equal(&np->daddr, &rt->rt6i_dst.addr)) {
1874 peer = inet_getpeer_v6(&np->daddr, 1);
1875 *release_it = true;
1876 } else {
1877 if (!rt->rt6i_peer)
1878 rt6_bind_peer(rt, 1);
1879 peer = rt->rt6i_peer;
1880 *release_it = true;
1881 }
1882
1883 return peer;
1870} 1884}
1871 1885
1872static void *tcp_v6_tw_get_peer(struct sock *sk) 1886static void *tcp_v6_tw_get_peer(struct sock *sk)
1873{ 1887{
1888 struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
1874 struct inet_timewait_sock *tw = inet_twsk(sk); 1889 struct inet_timewait_sock *tw = inet_twsk(sk);
1875 1890
1876 if (tw->tw_family == AF_INET) 1891 if (tw->tw_family == AF_INET)
1877 return tcp_v4_tw_get_peer(sk); 1892 return tcp_v4_tw_get_peer(sk);
1878 1893
1879 /* Alas, not yet... */ 1894 return inet_getpeer_v6(&tw6->tw_v6_daddr, 1);
1880 return NULL;
1881} 1895}
1882 1896
1883static struct timewait_sock_ops tcp6_timewait_sock_ops = { 1897static struct timewait_sock_ops tcp6_timewait_sock_ops = {