aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-09 04:25:47 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-09 04:25:47 -0400
commit4670fd819e7f47392c7c6fc6168ea2857c66d163 (patch)
treeb8e90a8a449c0b42b77b54313683ab2d0edb09f3 /net/ipv6/tcp_ipv6.c
parentfbfe95a42e90b3dd079cc9019ba7d7700feee0f6 (diff)
tcp: Get rid of inetpeer special cases.
The get_peer method TCP uses is full of special cases that make no sense accommodating, and it also gets in the way of doing more reasonable things here. First of all, if the socket doesn't have a usable cached route, there is no sense in trying to optimize timewait recycling. Likewise for the case where we have IP options, such as SRR enabled, that make the IP header destination address (and thus the destination address of the route key) differ from that of the connection's destination address. Just return a NULL peer in these cases, and thus we're also able to get rid of the clumsy inetpeer release logic. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 218433cb992..b5ecf37b61a 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1732,23 +1732,18 @@ do_time_wait:
1732 goto discard_it; 1732 goto discard_it;
1733} 1733}
1734 1734
1735static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it) 1735static struct inet_peer *tcp_v6_get_peer(struct sock *sk)
1736{ 1736{
1737 struct rt6_info *rt = (struct rt6_info *) __sk_dst_get(sk); 1737 struct rt6_info *rt = (struct rt6_info *) __sk_dst_get(sk);
1738 struct ipv6_pinfo *np = inet6_sk(sk); 1738 struct ipv6_pinfo *np = inet6_sk(sk);
1739 struct net *net = sock_net(sk);
1740 struct inet_peer *peer;
1741
1742 if (!rt ||
1743 !ipv6_addr_equal(&np->daddr, &rt->rt6i_dst.addr)) {
1744 peer = inet_getpeer_v6(net, &np->daddr, 1);
1745 *release_it = true;
1746 } else {
1747 peer = rt6_get_peer_create(rt);
1748 *release_it = false;
1749 }
1750 1739
1751 return peer; 1740 /* If we don't have a valid cached route, or we're doing IP
1741 * options which make the IPv6 header destination address
1742 * different from our peer's, do not bother with this.
1743 */
1744 if (!rt || !ipv6_addr_equal(&np->daddr, &rt->rt6i_dst.addr))
1745 return NULL;
1746 return rt6_get_peer_create(rt);
1752} 1747}
1753 1748
1754static void *tcp_v6_tw_get_peer(struct sock *sk) 1749static void *tcp_v6_tw_get_peer(struct sock *sk)