Alexey Dobriyan | d62ddc2 | 2008-11-25 17:14:31 -0800 | [diff] [blame] | 1 | #ifndef __NETNS_XFRM_H |
| 2 | #define __NETNS_XFRM_H |
| 3 | |
Alexey Dobriyan | 9d4139c | 2008-11-25 17:16:11 -0800 | [diff] [blame] | 4 | #include <linux/list.h> |
Alexey Dobriyan | 50a3065 | 2008-11-25 17:21:01 -0800 | [diff] [blame] | 5 | #include <linux/wait.h> |
Alexey Dobriyan | 6308273 | 2008-11-25 17:19:07 -0800 | [diff] [blame] | 6 | #include <linux/workqueue.h> |
Alexey Dobriyan | 8b18f8e | 2008-11-25 17:23:26 -0800 | [diff] [blame] | 7 | #include <linux/xfrm.h> |
Alexey Dobriyan | d7c7544 | 2010-01-24 22:47:53 -0800 | [diff] [blame] | 8 | #include <net/dst_ops.h> |
Fan Du | ca925cf | 2014-01-18 09:55:27 +0800 | [diff] [blame] | 9 | #include <net/flowcache.h> |
Alexey Dobriyan | 9d4139c | 2008-11-25 17:16:11 -0800 | [diff] [blame] | 10 | |
Alexey Dobriyan | b27aead | 2008-11-25 18:00:48 -0800 | [diff] [blame] | 11 | struct ctl_table_header; |
| 12 | |
Alexey Dobriyan | a35f6c5 | 2008-11-25 17:23:48 -0800 | [diff] [blame] | 13 | struct xfrm_policy_hash { |
| 14 | struct hlist_head *table; |
| 15 | unsigned int hmask; |
Christophe Gouault | b58555f | 2014-08-29 16:16:04 +0200 | [diff] [blame] | 16 | u8 dbits4; |
| 17 | u8 sbits4; |
| 18 | u8 dbits6; |
| 19 | u8 sbits6; |
Alexey Dobriyan | a35f6c5 | 2008-11-25 17:23:48 -0800 | [diff] [blame] | 20 | }; |
| 21 | |
Christophe Gouault | 880a6fa | 2014-08-29 16:16:05 +0200 | [diff] [blame] | 22 | struct xfrm_policy_hthresh { |
| 23 | struct work_struct work; |
| 24 | seqlock_t lock; |
| 25 | u8 lbits4; |
| 26 | u8 rbits4; |
| 27 | u8 lbits6; |
| 28 | u8 rbits6; |
| 29 | }; |
| 30 | |
Alexey Dobriyan | d62ddc2 | 2008-11-25 17:14:31 -0800 | [diff] [blame] | 31 | struct netns_xfrm { |
Alexey Dobriyan | 9d4139c | 2008-11-25 17:16:11 -0800 | [diff] [blame] | 32 | struct list_head state_all; |
Alexey Dobriyan | 73d189d | 2008-11-25 17:16:58 -0800 | [diff] [blame] | 33 | /* |
| 34 | * Hash table to find appropriate SA towards given target (endpoint of |
| 35 | * tunnel or destination of transport mode) allowed by selector. |
| 36 | * |
| 37 | * Main use is finding SA after policy selected tunnel or transport |
| 38 | * mode. Also, it can be used by ah/esp icmp error handler to find |
| 39 | * offending SA. |
| 40 | */ |
| 41 | struct hlist_head *state_bydst; |
Alexey Dobriyan | d320bbb | 2008-11-25 17:17:24 -0800 | [diff] [blame] | 42 | struct hlist_head *state_bysrc; |
Alexey Dobriyan | b754a4f | 2008-11-25 17:17:47 -0800 | [diff] [blame] | 43 | struct hlist_head *state_byspi; |
Alexey Dobriyan | 529983e | 2008-11-25 17:18:12 -0800 | [diff] [blame] | 44 | unsigned int state_hmask; |
Alexey Dobriyan | 0bf7c5b | 2008-11-25 17:18:39 -0800 | [diff] [blame] | 45 | unsigned int state_num; |
Alexey Dobriyan | 6308273 | 2008-11-25 17:19:07 -0800 | [diff] [blame] | 46 | struct work_struct state_hash_work; |
Alexey Dobriyan | b8a0ae2 | 2008-11-25 17:20:11 -0800 | [diff] [blame] | 47 | struct hlist_head state_gc_list; |
Alexey Dobriyan | c783714 | 2008-11-25 17:20:36 -0800 | [diff] [blame] | 48 | struct work_struct state_gc_work; |
Alexey Dobriyan | 50a3065 | 2008-11-25 17:21:01 -0800 | [diff] [blame] | 49 | |
Alexey Dobriyan | adfcf0b | 2008-11-25 17:22:11 -0800 | [diff] [blame] | 50 | struct list_head policy_all; |
Alexey Dobriyan | 93b851c | 2008-11-25 17:22:35 -0800 | [diff] [blame] | 51 | struct hlist_head *policy_byidx; |
Alexey Dobriyan | 8100bea | 2008-11-25 17:22:58 -0800 | [diff] [blame] | 52 | unsigned int policy_idx_hmask; |
Herbert Xu | 53c2e28 | 2014-11-13 17:09:49 +0800 | [diff] [blame] | 53 | struct hlist_head policy_inexact[XFRM_POLICY_MAX]; |
| 54 | struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX]; |
Alexey Dobriyan | dc2caba | 2008-11-25 17:24:15 -0800 | [diff] [blame] | 55 | unsigned int policy_count[XFRM_POLICY_MAX * 2]; |
Alexey Dobriyan | 66caf62 | 2008-11-25 17:28:57 -0800 | [diff] [blame] | 56 | struct work_struct policy_hash_work; |
Christophe Gouault | 880a6fa | 2014-08-29 16:16:05 +0200 | [diff] [blame] | 57 | struct xfrm_policy_hthresh policy_hthresh; |
Alexey Dobriyan | a6483b7 | 2008-11-25 17:38:20 -0800 | [diff] [blame] | 58 | |
Alexey Dobriyan | d7c7544 | 2010-01-24 22:47:53 -0800 | [diff] [blame] | 59 | |
Alexey Dobriyan | a6483b7 | 2008-11-25 17:38:20 -0800 | [diff] [blame] | 60 | struct sock *nlsk; |
Eric W. Biederman | d79d792 | 2009-12-03 02:29:05 +0000 | [diff] [blame] | 61 | struct sock *nlsk_stash; |
Alexey Dobriyan | b27aead | 2008-11-25 18:00:48 -0800 | [diff] [blame] | 62 | |
| 63 | u32 sysctl_aevent_etime; |
| 64 | u32 sysctl_aevent_rseqth; |
| 65 | int sysctl_larval_drop; |
| 66 | u32 sysctl_acq_expires; |
| 67 | #ifdef CONFIG_SYSCTL |
| 68 | struct ctl_table_header *sysctl_hdr; |
| 69 | #endif |
Eric Dumazet | 8e602ce | 2010-10-14 05:56:18 +0000 | [diff] [blame] | 70 | |
| 71 | struct dst_ops xfrm4_dst_ops; |
Eric Dumazet | dfd56b8 | 2011-12-10 09:48:31 +0000 | [diff] [blame] | 72 | #if IS_ENABLED(CONFIG_IPV6) |
Eric Dumazet | 8e602ce | 2010-10-14 05:56:18 +0000 | [diff] [blame] | 73 | struct dst_ops xfrm6_dst_ops; |
| 74 | #endif |
Fan Du | 283bc9f | 2013-11-07 17:47:50 +0800 | [diff] [blame] | 75 | spinlock_t xfrm_state_lock; |
Fan Du | 283bc9f | 2013-11-07 17:47:50 +0800 | [diff] [blame] | 76 | rwlock_t xfrm_policy_lock; |
| 77 | struct mutex xfrm_cfg_mutex; |
Fan Du | ca925cf | 2014-01-18 09:55:27 +0800 | [diff] [blame] | 78 | |
| 79 | /* flow cache part */ |
| 80 | struct flow_cache flow_cache_global; |
Fan Du | ca925cf | 2014-01-18 09:55:27 +0800 | [diff] [blame] | 81 | atomic_t flow_cache_genid; |
| 82 | struct list_head flow_cache_gc_list; |
Steffen Klassert | 6ad3122 | 2016-02-22 10:40:07 +0100 | [diff] [blame] | 83 | atomic_t flow_cache_gc_count; |
Fan Du | ca925cf | 2014-01-18 09:55:27 +0800 | [diff] [blame] | 84 | spinlock_t flow_cache_gc_lock; |
| 85 | struct work_struct flow_cache_gc_work; |
| 86 | struct work_struct flow_cache_flush_work; |
| 87 | struct mutex flow_flush_sem; |
Alexey Dobriyan | d62ddc2 | 2008-11-25 17:14:31 -0800 | [diff] [blame] | 88 | }; |
| 89 | |
| 90 | #endif |