^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __NETNS_XFRM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __NETNS_XFRM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/wait.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/rhashtable-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/xfrm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/android_kabi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <net/dst_ops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct ctl_table_header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct xfrm_policy_hash {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct hlist_head __rcu *table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned int hmask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) u8 dbits4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) u8 sbits4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) u8 dbits6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) u8 sbits6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct xfrm_policy_hthresh {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct work_struct work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) seqlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) u8 lbits4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) u8 rbits4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) u8 lbits6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) u8 rbits6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct netns_xfrm {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct list_head state_all;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * Hash table to find appropriate SA towards given target (endpoint of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * tunnel or destination of transport mode) allowed by selector.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * Main use is finding SA after policy selected tunnel or transport
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * mode. Also, it can be used by ah/esp icmp error handler to find
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * offending SA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct hlist_head __rcu *state_bydst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct hlist_head __rcu *state_bysrc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct hlist_head __rcu *state_byspi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) unsigned int state_hmask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) unsigned int state_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct work_struct state_hash_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct list_head policy_all;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) struct hlist_head *policy_byidx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) unsigned int policy_idx_hmask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct hlist_head policy_inexact[XFRM_POLICY_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) unsigned int policy_count[XFRM_POLICY_MAX * 2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct work_struct policy_hash_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct xfrm_policy_hthresh policy_hthresh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct list_head inexact_bins;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) struct sock *nlsk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct sock *nlsk_stash;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) u32 sysctl_aevent_etime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) u32 sysctl_aevent_rseqth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) int sysctl_larval_drop;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) u32 sysctl_acq_expires;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #ifdef CONFIG_SYSCTL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) struct ctl_table_header *sysctl_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) struct dst_ops xfrm4_dst_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #if IS_ENABLED(CONFIG_IPV6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct dst_ops xfrm6_dst_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) spinlock_t xfrm_state_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) seqcount_t xfrm_state_hash_generation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) spinlock_t xfrm_policy_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) struct mutex xfrm_cfg_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #endif