aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-03-11 21:53:14 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-11 21:55:28 -0400
commit33cf7c90fe2f97afb1cadaa0cfb782cb9d1b9ee2 (patch)
tree7a0c80d0b2bb618919d966ce5b827c7eb8f843f6 /include/net/net_namespace.h
parent654eff45166c7e89d18fc476325c975768b2e347 (diff)
net: add real socket cookies
A long standing problem in netlink socket dumps is the use of kernel socket addresses as cookies. 1) It is a security concern. 2) Sockets can be reused quite quickly, so there is no guarantee a cookie is used once and identify a flow. 3) request sock, establish sock, and timewait socks for a given flow have different cookies. Part of our effort to bring better TCP statistics requires to switch to a different allocator. In this patch, I chose to use a per network namespace 64bit generator, and to use it only in the case a socket needs to be dumped to netlink. (This might be refined later if needed) Note that I tried to carry cookies from request sock, to establish sock, then timewait sockets. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Eric Salo <salo@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r--include/net/net_namespace.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 2cb9acb618e9..e086f4030dd2 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -56,6 +56,8 @@ struct net {
56#endif 56#endif
57 spinlock_t rules_mod_lock; 57 spinlock_t rules_mod_lock;
58 58
59 atomic64_t cookie_gen;
60
59 struct list_head list; /* list of network namespaces */ 61 struct list_head list; /* list of network namespaces */
60 struct list_head cleanup_list; /* namespaces on death row */ 62 struct list_head cleanup_list; /* namespaces on death row */
61 struct list_head exit_list; /* Use only net_mutex */ 63 struct list_head exit_list; /* Use only net_mutex */