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 /include | |
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 'include')
-rw-r--r-- | include/net/tcp.h | 1 | ||||
-rw-r--r-- | include/net/timewait_sock.h | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 3e239641d4ee..4097320caa25 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -313,6 +313,7 @@ extern void tcp_shutdown (struct sock *sk, int how); | |||
313 | extern int tcp_v4_rcv(struct sk_buff *skb); | 313 | extern int tcp_v4_rcv(struct sk_buff *skb); |
314 | 314 | ||
315 | extern struct inet_peer *tcp_v4_get_peer(struct sock *sk, bool *release_it); | 315 | extern struct inet_peer *tcp_v4_get_peer(struct sock *sk, bool *release_it); |
316 | extern void *tcp_v4_tw_get_peer(struct sock *sk); | ||
316 | extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); | 317 | extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); |
317 | extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 318 | extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
318 | size_t size); | 319 | size_t size); |
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h index 97c3b14da55d..053b3cf2c66a 100644 --- a/include/net/timewait_sock.h +++ b/include/net/timewait_sock.h | |||
@@ -21,6 +21,7 @@ struct timewait_sock_ops { | |||
21 | int (*twsk_unique)(struct sock *sk, | 21 | int (*twsk_unique)(struct sock *sk, |
22 | struct sock *sktw, void *twp); | 22 | struct sock *sktw, void *twp); |
23 | void (*twsk_destructor)(struct sock *sk); | 23 | void (*twsk_destructor)(struct sock *sk); |
24 | void *(*twsk_getpeer)(struct sock *sk); | ||
24 | }; | 25 | }; |
25 | 26 | ||
26 | static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp) | 27 | static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp) |
@@ -39,4 +40,11 @@ static inline void twsk_destructor(struct sock *sk) | |||
39 | sk->sk_prot->twsk_prot->twsk_destructor(sk); | 40 | sk->sk_prot->twsk_prot->twsk_destructor(sk); |
40 | } | 41 | } |
41 | 42 | ||
43 | static inline void *twsk_getpeer(struct sock *sk) | ||
44 | { | ||
45 | if (sk->sk_prot->twsk_prot->twsk_getpeer) | ||
46 | return sk->sk_prot->twsk_prot->twsk_getpeer(sk); | ||
47 | return NULL; | ||
48 | } | ||
49 | |||
42 | #endif /* _TIMEWAIT_SOCK_H */ | 50 | #endif /* _TIMEWAIT_SOCK_H */ |