diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-16 00:12:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-16 15:55:28 -0400 |
commit | 1d0ab253872cdd3d8e7913f59c266c7fd01771d0 (patch) | |
tree | cc2d3e7f9017862044066bb8fa458944c05c4ff3 | |
parent | f00bbd219caa7b3cc3a51b5ce551d1bd56f19662 (diff) |
net: add sk_fullsock() helper
We have many places where we want to check if a socket is
not a timewait or request socket. Use a helper to avoid
hard coding this.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/sock.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index f10832ca2e90..e0360f5a53e9 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -67,6 +67,7 @@ | |||
67 | #include <linux/atomic.h> | 67 | #include <linux/atomic.h> |
68 | #include <net/dst.h> | 68 | #include <net/dst.h> |
69 | #include <net/checksum.h> | 69 | #include <net/checksum.h> |
70 | #include <net/tcp_states.h> | ||
70 | #include <linux/net_tstamp.h> | 71 | #include <linux/net_tstamp.h> |
71 | 72 | ||
72 | struct cgroup; | 73 | struct cgroup; |
@@ -2218,6 +2219,14 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb) | |||
2218 | return NULL; | 2219 | return NULL; |
2219 | } | 2220 | } |
2220 | 2221 | ||
2222 | /* This helper checks if a socket is a full socket, | ||
2223 | * ie _not_ a timewait or request socket. | ||
2224 | */ | ||
2225 | static inline bool sk_fullsock(const struct sock *sk) | ||
2226 | { | ||
2227 | return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV); | ||
2228 | } | ||
2229 | |||
2221 | void sock_enable_timestamp(struct sock *sk, int flag); | 2230 | void sock_enable_timestamp(struct sock *sk, int flag); |
2222 | int sock_get_timestamp(struct sock *, struct timeval __user *); | 2231 | int sock_get_timestamp(struct sock *, struct timeval __user *); |
2223 | int sock_get_timestampns(struct sock *, struct timespec __user *); | 2232 | int sock_get_timestampns(struct sock *, struct timespec __user *); |