mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
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>
[backported from net-next 1d0ab25387]
[lorenzo@google.com: removed TCPF_NEW_SYN_RECV, and added a comment to add it back.]
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Bug: 24163529
Change-Id: Ibf09017e1ab00af5e6925273117c335d7f515d73
(cherry picked from commit cdab04e3612c55f0906c84c3c05996a0507eab7d)
This commit is contained in:
@@ -67,6 +67,7 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <net/dst.h>
|
||||
#include <net/checksum.h>
|
||||
#include <net/tcp_states.h>
|
||||
|
||||
struct cgroup;
|
||||
struct cgroup_subsys;
|
||||
@@ -2251,6 +2252,15 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This helper checks if a socket is a full socket,
|
||||
* ie _not_ a timewait or request socket.
|
||||
* TODO: Check for TCPF_NEW_SYN_RECV when that starts to exist.
|
||||
*/
|
||||
static inline bool sk_fullsock(const struct sock *sk)
|
||||
{
|
||||
return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT);
|
||||
}
|
||||
|
||||
extern void sock_enable_timestamp(struct sock *sk, int flag);
|
||||
extern int sock_get_timestamp(struct sock *, struct timeval __user *);
|
||||
extern int sock_get_timestampns(struct sock *, struct timespec __user *);
|
||||
|
||||
Reference in New Issue
Block a user