aboutsummaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorChenbo Feng <fengc@google.com>2017-04-11 10:37:06 -0700
committerMister Oyster <oysterized@gmail.com>2017-05-23 19:48:06 +0200
commit49104f1ff068f94a6644afd28d6e62315d21784e (patch)
treea2129e471c6dbc4821da6a1ad37508625e86f8aa /net/ipv4
parent40dacaaf5628101771dc5bd45bc47bd0ea7842e5 (diff)
BACKPORT [UPSTREAM] net: add real socket cookies
Cherry-pick from upstream commit 33cf7c90fe2f97afb1cadaa0cfb782cb9d1b9ee2. Introduce a unique per netspace identifier for each socket and it is required by xt_qtaguid module to identify the socket without holding the socket reference count. The change is modified to the minimal impact so that it doesn't change other socket networking behavior. Signed-off-by: mydongistiny <jaysonedson@gmail.com> Signed-off-by: Joe Maples <joe@frap129.org>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/inet_timewait_sock.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 1f27c9f4a..d9e3b5b73 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -196,6 +196,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, const int stat
tw->tw_ipv6only = 0;
tw->tw_transparent = inet->transparent;
tw->tw_prot = sk->sk_prot_creator;
+ atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie));
twsk_net_set(tw, hold_net(sock_net(sk)));
/*
* Because we use RCU lookups, we should not set tw_refcnt