xfrm.h 2.1 KB

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