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>
This commit is contained in:
@@ -21,6 +21,7 @@ struct timewait_sock_ops {
|
||||
int (*twsk_unique)(struct sock *sk,
|
||||
struct sock *sktw, void *twp);
|
||||
void (*twsk_destructor)(struct sock *sk);
|
||||
void *(*twsk_getpeer)(struct sock *sk);
|
||||
};
|
||||
|
||||
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)
|
||||
sk->sk_prot->twsk_prot->twsk_destructor(sk);
|
||||
}
|
||||
|
||||
static inline void *twsk_getpeer(struct sock *sk)
|
||||
{
|
||||
if (sk->sk_prot->twsk_prot->twsk_getpeer)
|
||||
return sk->sk_prot->twsk_prot->twsk_getpeer(sk);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* _TIMEWAIT_SOCK_H */
|
||||
|
Reference in New Issue
Block a user