diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-09 17:56:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-09 17:56:12 -0400 |
commit | 2397849baa7c44c242e5d5142d5d16d1e7ed53d0 (patch) | |
tree | 0ee2012361d1b0f8a92b68da7d0d92209613ecaf /net/ipv6/tcp_ipv6.c | |
parent | 4670fd819e7f47392c7c6fc6168ea2857c66d163 (diff) |
[PATCH] tcp: Cache inetpeer in timewait socket, and only when necessary.
Since it's guarenteed that we will access the inetpeer if we're trying
to do timewait recycling and TCP options were enabled on the
connection, just cache the peer in the timewait socket.
In the future, inetpeer lookups will be context dependent (per routing
realm), and this helps facilitate that as well.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index b5ecf37b61a6..f91b0bfd12d5 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1746,23 +1746,10 @@ static struct inet_peer *tcp_v6_get_peer(struct sock *sk) | |||
1746 | return rt6_get_peer_create(rt); | 1746 | return rt6_get_peer_create(rt); |
1747 | } | 1747 | } |
1748 | 1748 | ||
1749 | static void *tcp_v6_tw_get_peer(struct sock *sk) | ||
1750 | { | ||
1751 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); | ||
1752 | const struct inet_timewait_sock *tw = inet_twsk(sk); | ||
1753 | struct net *net = sock_net(sk); | ||
1754 | |||
1755 | if (tw->tw_family == AF_INET) | ||
1756 | return tcp_v4_tw_get_peer(sk); | ||
1757 | |||
1758 | return inet_getpeer_v6(net, &tw6->tw_v6_daddr, 1); | ||
1759 | } | ||
1760 | |||
1761 | static struct timewait_sock_ops tcp6_timewait_sock_ops = { | 1749 | static struct timewait_sock_ops tcp6_timewait_sock_ops = { |
1762 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), | 1750 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), |
1763 | .twsk_unique = tcp_twsk_unique, | 1751 | .twsk_unique = tcp_twsk_unique, |
1764 | .twsk_destructor= tcp_twsk_destructor, | 1752 | .twsk_destructor= tcp_twsk_destructor, |
1765 | .twsk_getpeer = tcp_v6_tw_get_peer, | ||
1766 | }; | 1753 | }; |
1767 | 1754 | ||
1768 | static const struct inet_connection_sock_af_ops ipv6_specific = { | 1755 | static const struct inet_connection_sock_af_ops ipv6_specific = { |