blob: 611521646dd4daf6eca8843b15dfc1dc38f3888c [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>
Alexey Dobriyan9d4139c2008-11-25 17:16:11 -08009
Alexey Dobriyanb27aead2008-11-25 18:00:48 -080010struct ctl_table_header;
11
Alexey Dobriyana35f6c52008-11-25 17:23:48 -080012struct xfrm_policy_hash {
Florian Westphala7c442472016-08-11 15:17:56 +020013 struct hlist_head __rcu *table;
Alexey Dobriyana35f6c52008-11-25 17:23:48 -080014 unsigned int hmask;
Christophe Gouaultb58555f2014-08-29 16:16:04 +020015 u8 dbits4;
16 u8 sbits4;
17 u8 dbits6;
18 u8 sbits6;
Alexey Dobriyana35f6c52008-11-25 17:23:48 -080019};
20
Christophe Gouault880a6fa2014-08-29 16:16:05 +020021struct xfrm_policy_hthresh {
22 struct work_struct work;
23 seqlock_t lock;
24 u8 lbits4;
25 u8 rbits4;
26 u8 lbits6;
27 u8 rbits6;
28};
29
Alexey Dobriyand62ddc22008-11-25 17:14:31 -080030struct netns_xfrm {
Alexey Dobriyan9d4139c2008-11-25 17:16:11 -080031 struct list_head state_all;
Alexey Dobriyan73d189d2008-11-25 17:16:58 -080032 /*
33 * Hash table to find appropriate SA towards given target (endpoint of
34 * tunnel or destination of transport mode) allowed by selector.
35 *
36 * Main use is finding SA after policy selected tunnel or transport
37 * mode. Also, it can be used by ah/esp icmp error handler to find
38 * offending SA.
39 */
Florian Westphald737a582016-08-09 12:16:09 +020040 struct hlist_head __rcu *state_bydst;
41 struct hlist_head __rcu *state_bysrc;
42 struct hlist_head __rcu *state_byspi;
Alexey Dobriyan529983e2008-11-25 17:18:12 -080043 unsigned int state_hmask;
Alexey Dobriyan0bf7c5b2008-11-25 17:18:39 -080044 unsigned int state_num;
Alexey Dobriyan63082732008-11-25 17:19:07 -080045 struct work_struct state_hash_work;
Alexey Dobriyan50a30652008-11-25 17:21:01 -080046
Alexey Dobriyanadfcf0b2008-11-25 17:22:11 -080047 struct list_head policy_all;
Alexey Dobriyan93b851c2008-11-25 17:22:35 -080048 struct hlist_head *policy_byidx;
Alexey Dobriyan8100bea2008-11-25 17:22:58 -080049 unsigned int policy_idx_hmask;
Herbert Xu53c2e282014-11-13 17:09:49 +080050 struct hlist_head policy_inexact[XFRM_POLICY_MAX];
51 struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX];
Alexey Dobriyandc2caba2008-11-25 17:24:15 -080052 unsigned int policy_count[XFRM_POLICY_MAX * 2];
Alexey Dobriyan66caf622008-11-25 17:28:57 -080053 struct work_struct policy_hash_work;
Christophe Gouault880a6fa2014-08-29 16:16:05 +020054 struct xfrm_policy_hthresh policy_hthresh;
Alexey Dobriyana6483b72008-11-25 17:38:20 -080055
Alexey Dobriyand7c75442010-01-24 22:47:53 -080056
Alexey Dobriyana6483b72008-11-25 17:38:20 -080057 struct sock *nlsk;
Eric W. Biedermand79d7922009-12-03 02:29:05 +000058 struct sock *nlsk_stash;
Alexey Dobriyanb27aead2008-11-25 18:00:48 -080059
60 u32 sysctl_aevent_etime;
61 u32 sysctl_aevent_rseqth;
62 int sysctl_larval_drop;
63 u32 sysctl_acq_expires;
64#ifdef CONFIG_SYSCTL
65 struct ctl_table_header *sysctl_hdr;
66#endif
Eric Dumazet8e602ce2010-10-14 05:56:18 +000067
68 struct dst_ops xfrm4_dst_ops;
Eric Dumazetdfd56b82011-12-10 09:48:31 +000069#if IS_ENABLED(CONFIG_IPV6)
Eric Dumazet8e602ce2010-10-14 05:56:18 +000070 struct dst_ops xfrm6_dst_ops;
71#endif
Fan Du283bc9f2013-11-07 17:47:50 +080072 spinlock_t xfrm_state_lock;
Florian Westphal9d0380d2016-08-11 15:17:59 +020073 spinlock_t xfrm_policy_lock;
Fan Du283bc9f2013-11-07 17:47:50 +080074 struct mutex xfrm_cfg_mutex;
Alexey Dobriyand62ddc22008-11-25 17:14:31 -080075};
76
77#endif