diff options
author | David S. Miller <davem@davemloft.net> | 2010-12-01 21:09:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-01 21:09:13 -0500 |
commit | ccb7c410ddc054b8c1ae780319bc98ae092d3854 (patch) | |
tree | 6a363c7232121d2390c091b232ee758fa10e4446 /net/ipv6/tcp_ipv6.c | |
parent | 4399ce402c7c837dec80bf9fb40d079b39b9265a (diff) |
timewait_sock: Create and use getpeer op.
The only thing AF-specific about remembering the timestamp
for a time-wait TCP socket is getting the peer.
Abstract that behind a new timewait_sock_ops vector.
Support for real IPV6 sockets is not filled in yet, but
curiously this makes timewait recycling start to work
for v4-mapped ipv6 sockets.
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 | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index e394d0029d8d..5f73a1808e36 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -906,12 +906,6 @@ static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = { | |||
906 | }; | 906 | }; |
907 | #endif | 907 | #endif |
908 | 908 | ||
909 | static struct timewait_sock_ops tcp6_timewait_sock_ops = { | ||
910 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), | ||
911 | .twsk_unique = tcp_twsk_unique, | ||
912 | .twsk_destructor= tcp_twsk_destructor, | ||
913 | }; | ||
914 | |||
915 | static void __tcp_v6_send_check(struct sk_buff *skb, | 909 | static void __tcp_v6_send_check(struct sk_buff *skb, |
916 | struct in6_addr *saddr, struct in6_addr *daddr) | 910 | struct in6_addr *saddr, struct in6_addr *daddr) |
917 | { | 911 | { |
@@ -1818,12 +1812,30 @@ do_time_wait: | |||
1818 | goto discard_it; | 1812 | goto discard_it; |
1819 | } | 1813 | } |
1820 | 1814 | ||
1821 | struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it) | 1815 | static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it) |
1816 | { | ||
1817 | /* Alas, not yet... */ | ||
1818 | return NULL; | ||
1819 | } | ||
1820 | |||
1821 | static void *tcp_v6_tw_get_peer(struct sock *sk) | ||
1822 | { | 1822 | { |
1823 | struct inet_timewait_sock *tw = inet_twsk(sk); | ||
1824 | |||
1825 | if (tw->tw_family == AF_INET) | ||
1826 | return tcp_v4_tw_get_peer(sk); | ||
1827 | |||
1823 | /* Alas, not yet... */ | 1828 | /* Alas, not yet... */ |
1824 | return NULL; | 1829 | return NULL; |
1825 | } | 1830 | } |
1826 | 1831 | ||
1832 | static struct timewait_sock_ops tcp6_timewait_sock_ops = { | ||
1833 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), | ||
1834 | .twsk_unique = tcp_twsk_unique, | ||
1835 | .twsk_destructor= tcp_twsk_destructor, | ||
1836 | .twsk_getpeer = tcp_v6_tw_get_peer, | ||
1837 | }; | ||
1838 | |||
1827 | static const struct inet_connection_sock_af_ops ipv6_specific = { | 1839 | static const struct inet_connection_sock_af_ops ipv6_specific = { |
1828 | .queue_xmit = inet6_csk_xmit, | 1840 | .queue_xmit = inet6_csk_xmit, |
1829 | .send_check = tcp_v6_send_check, | 1841 | .send_check = tcp_v6_send_check, |