xfrm.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 __rcu *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 __rcu *state_bydst;
  37. struct hlist_head __rcu *state_bysrc;
  38. struct hlist_head __rcu *state_byspi;
  39. unsigned int state_hmask;
  40. unsigned int state_num;
  41. struct work_struct state_hash_work;
  42. struct list_head policy_all;
  43. struct hlist_head *policy_byidx;
  44. unsigned int policy_idx_hmask;
  45. struct hlist_head policy_inexact[XFRM_POLICY_MAX];
  46. struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX];
  47. unsigned int policy_count[XFRM_POLICY_MAX * 2];
  48. struct work_struct policy_hash_work;
  49. struct xfrm_policy_hthresh policy_hthresh;
  50. struct sock *nlsk;
  51. struct sock *nlsk_stash;
  52. u32 sysctl_aevent_etime;
  53. u32 sysctl_aevent_rseqth;
  54. int sysctl_larval_drop;
  55. u32 sysctl_acq_expires;
  56. #ifdef CONFIG_SYSCTL
  57. struct ctl_table_header *sysctl_hdr;
  58. #endif
  59. struct dst_ops xfrm4_dst_ops;
  60. #if IS_ENABLED(CONFIG_IPV6)
  61. struct dst_ops xfrm6_dst_ops;
  62. #endif
  63. spinlock_t xfrm_state_lock;
  64. spinlock_t xfrm_policy_lock;
  65. struct mutex xfrm_cfg_mutex;
  66. /* flow cache part */
  67. struct flow_cache flow_cache_global;
  68. atomic_t flow_cache_genid;
  69. struct list_head flow_cache_gc_list;
  70. atomic_t flow_cache_gc_count;
  71. spinlock_t flow_cache_gc_lock;
  72. struct work_struct flow_cache_gc_work;
  73. struct work_struct flow_cache_flush_work;
  74. struct mutex flow_flush_sem;
  75. };
  76. #endif