xfrm.h 2.1 KB

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