Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bea19db8 authored by Eric Dumazet's avatar Eric Dumazet Committed by Lorenzo Colitti
Browse files

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.

[Backport of net-next 1d0ab253872cdd3d8e7913f59c266c7fd01771d0]
[lorenzo@google.com: removed TCPF_NEW_SYN_RECV, and added a comment to add it back.]

Bug: 24163529
Change-Id: Ibf09017e1ab00af5e6925273117c335d7f515d73
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLorenzo Colitti <lorenzo@google.com>
parent bd8d3dd3
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -68,6 +68,7 @@
#include <net/dst.h>
#include <net/dst.h>
#include <net/checksum.h>
#include <net/checksum.h>
#include <linux/net_tstamp.h>
#include <linux/net_tstamp.h>
#include <net/tcp_states.h>


struct cgroup;
struct cgroup;
struct cgroup_subsys;
struct cgroup_subsys;
@@ -2265,6 +2266,15 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
	return NULL;
	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);
}

void sock_enable_timestamp(struct sock *sk, int flag);
void sock_enable_timestamp(struct sock *sk, int flag);
int sock_get_timestamp(struct sock *, struct timeval __user *);
int sock_get_timestamp(struct sock *, struct timeval __user *);
int sock_get_timestampns(struct sock *, struct timespec __user *);
int sock_get_timestampns(struct sock *, struct timespec __user *);