Commit db3949c4 authored by David S. Miller's avatar David S. Miller

tcp: Implement ipv6 ->get_peer() and ->tw_get_peer().

Now ipv6 timewait recycling is fully implemented and
enabled.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 493f377d
...@@ -1865,19 +1865,33 @@ static int tcp_v6_rcv(struct sk_buff *skb) ...@@ -1865,19 +1865,33 @@ static int tcp_v6_rcv(struct sk_buff *skb)
static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it) static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it)
{ {
/* Alas, not yet... */ struct rt6_info *rt = (struct rt6_info *) __sk_dst_get(sk);
return NULL; struct ipv6_pinfo *np = inet6_sk(sk);
struct inet_peer *peer;
if (!rt ||
!ipv6_addr_equal(&np->daddr, &rt->rt6i_dst.addr)) {
peer = inet_getpeer_v6(&np->daddr, 1);
*release_it = true;
} else {
if (!rt->rt6i_peer)
rt6_bind_peer(rt, 1);
peer = rt->rt6i_peer;
*release_it = true;
}
return peer;
} }
static void *tcp_v6_tw_get_peer(struct sock *sk) static void *tcp_v6_tw_get_peer(struct sock *sk)
{ {
struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
struct inet_timewait_sock *tw = inet_twsk(sk); struct inet_timewait_sock *tw = inet_twsk(sk);
if (tw->tw_family == AF_INET) if (tw->tw_family == AF_INET)
return tcp_v4_tw_get_peer(sk); return tcp_v4_tw_get_peer(sk);
/* Alas, not yet... */ return inet_getpeer_v6(&tw6->tw_v6_daddr, 1);
return NULL;
} }
static struct timewait_sock_ops tcp6_timewait_sock_ops = { static struct timewait_sock_ops tcp6_timewait_sock_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment