blob: 41902a8103bd2732058ab2b30a08e4ccb6e2e717 [file] [log] [blame]
Alexey Dobriyand62ddc22008-11-25 17:14:31 -08001#ifndef __NETNS_XFRM_H
2#define __NETNS_XFRM_H
3
Alexey Dobriyan9d4139c2008-11-25 17:16:11 -08004#include <linux/list.h>
Alexey Dobriyan50a30652008-11-25 17:21:01 -08005#include <linux/wait.h>
Alexey Dobriyan63082732008-11-25 17:19:07 -08006#include <linux/workqueue.h>
Alexey Dobriyan8b18f8e2008-11-25 17:23:26 -08007#include <linux/xfrm.h>
Alexey Dobriyand7c75442010-01-24 22:47:53 -08008#include <net/dst_ops.h>
Fan Duca925cf2014-01-18 09:55:27 +08009#include <net/flowcache.h>
Alexey Dobriyan9d4139c2008-11-25 17:16:11 -080010
Alexey Dobriyanb27aead2008-11-25 18:00:48 -080011struct ctl_table_header;
12
Alexey Dobriyana35f6c52008-11-25 17:23:48 -080013struct xfrm_policy_hash {
14 struct hlist_head *table;
15 unsigned int hmask;
Christophe Gouaultb58555f2014-08-29 16:16:04 +020016 u8 dbits4;
17 u8 sbits4;
18 u8 dbits6;
19 u8 sbits6;
Alexey Dobriyana35f6c52008-11-25 17:23:48 -080020};
21
Alexey Dobriyand62ddc22008-11-25 17:14:31 -080022struct netns_xfrm {
Alexey Dobriyan9d4139c2008-11-25 17:16:11 -080023 struct list_head state_all;
Alexey Dobriyan73d189d2008-11-25 17:16:58 -080024 /*
25 * Hash table to find appropriate SA towards given target (endpoint of
26 * tunnel or destination of transport mode) allowed by selector.
27 *
28 * Main use is finding SA after policy selected tunnel or transport
29 * mode. Also, it can be used by ah/esp icmp error handler to find
30 * offending SA.
31 */
32 struct hlist_head *state_bydst;
Alexey Dobriyand320bbb2008-11-25 17:17:24 -080033 struct hlist_head *state_bysrc;
Alexey Dobriyanb754a4f2008-11-25 17:17:47 -080034 struct hlist_head *state_byspi;
Alexey Dobriyan529983e2008-11-25 17:18:12 -080035 unsigned int state_hmask;
Alexey Dobriyan0bf7c5b2008-11-25 17:18:39 -080036 unsigned int state_num;
Alexey Dobriyan63082732008-11-25 17:19:07 -080037 struct work_struct state_hash_work;
Alexey Dobriyanb8a0ae22008-11-25 17:20:11 -080038 struct hlist_head state_gc_list;
Alexey Dobriyanc7837142008-11-25 17:20:36 -080039 struct work_struct state_gc_work;
Alexey Dobriyan50a30652008-11-25 17:21:01 -080040
Alexey Dobriyanadfcf0b2008-11-25 17:22:11 -080041 struct list_head policy_all;
Alexey Dobriyan93b851c2008-11-25 17:22:35 -080042 struct hlist_head *policy_byidx;
Alexey Dobriyan8100bea2008-11-25 17:22:58 -080043 unsigned int policy_idx_hmask;
Alexey Dobriyan8b18f8e2008-11-25 17:23:26 -080044 struct hlist_head policy_inexact[XFRM_POLICY_MAX * 2];
Alexey Dobriyana35f6c52008-11-25 17:23:48 -080045 struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2];
Alexey Dobriyandc2caba2008-11-25 17:24:15 -080046 unsigned int policy_count[XFRM_POLICY_MAX * 2];
Alexey Dobriyan66caf622008-11-25 17:28:57 -080047 struct work_struct policy_hash_work;
Alexey Dobriyana6483b72008-11-25 17:38:20 -080048
Alexey Dobriyand7c75442010-01-24 22:47:53 -080049
Alexey Dobriyana6483b72008-11-25 17:38:20 -080050 struct sock *nlsk;
Eric W. Biedermand79d7922009-12-03 02:29:05 +000051 struct sock *nlsk_stash;
Alexey Dobriyanb27aead2008-11-25 18:00:48 -080052
53 u32 sysctl_aevent_etime;
54 u32 sysctl_aevent_rseqth;
55 int sysctl_larval_drop;
56 u32 sysctl_acq_expires;
57#ifdef CONFIG_SYSCTL
58 struct ctl_table_header *sysctl_hdr;
59#endif
Eric Dumazet8e602ce2010-10-14 05:56:18 +000060
61 struct dst_ops xfrm4_dst_ops;
Eric Dumazetdfd56b82011-12-10 09:48:31 +000062#if IS_ENABLED(CONFIG_IPV6)
Eric Dumazet8e602ce2010-10-14 05:56:18 +000063 struct dst_ops xfrm6_dst_ops;
64#endif
Fan Du283bc9f2013-11-07 17:47:50 +080065 spinlock_t xfrm_state_lock;
Fan Du283bc9f2013-11-07 17:47:50 +080066 rwlock_t xfrm_policy_lock;
67 struct mutex xfrm_cfg_mutex;
Fan Duca925cf2014-01-18 09:55:27 +080068
69 /* flow cache part */
70 struct flow_cache flow_cache_global;
Fan Duca925cf2014-01-18 09:55:27 +080071 atomic_t flow_cache_genid;
72 struct list_head flow_cache_gc_list;
73 spinlock_t flow_cache_gc_lock;
74 struct work_struct flow_cache_gc_work;
75 struct work_struct flow_cache_flush_work;
76 struct mutex flow_flush_sem;
Alexey Dobriyand62ddc22008-11-25 17:14:31 -080077};
78
79#endif