xfrm.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. struct ctl_table_header;
  9. struct xfrm_policy_hash {
  10. struct hlist_head __rcu *table;
  11. unsigned int hmask;
  12. u8 dbits4;
  13. u8 sbits4;
  14. u8 dbits6;
  15. u8 sbits6;
  16. };
  17. struct xfrm_policy_hthresh {
  18. struct work_struct work;
  19. seqlock_t lock;
  20. u8 lbits4;
  21. u8 rbits4;
  22. u8 lbits6;
  23. u8 rbits6;
  24. };
  25. struct netns_xfrm {
  26. struct list_head state_all;
  27. /*
  28. * Hash table to find appropriate SA towards given target (endpoint of
  29. * tunnel or destination of transport mode) allowed by selector.
  30. *
  31. * Main use is finding SA after policy selected tunnel or transport
  32. * mode. Also, it can be used by ah/esp icmp error handler to find
  33. * offending SA.
  34. */
  35. struct hlist_head __rcu *state_bydst;
  36. struct hlist_head __rcu *state_bysrc;
  37. struct hlist_head __rcu *state_byspi;
  38. unsigned int state_hmask;
  39. unsigned int state_num;
  40. struct work_struct state_hash_work;
  41. struct list_head policy_all;
  42. struct hlist_head *policy_byidx;
  43. unsigned int policy_idx_hmask;
  44. struct hlist_head policy_inexact[XFRM_POLICY_MAX];
  45. struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX];
  46. unsigned int policy_count[XFRM_POLICY_MAX * 2];
  47. struct work_struct policy_hash_work;
  48. struct xfrm_policy_hthresh policy_hthresh;
  49. struct sock *nlsk;
  50. struct sock *nlsk_stash;
  51. u32 sysctl_aevent_etime;
  52. u32 sysctl_aevent_rseqth;
  53. int sysctl_larval_drop;
  54. u32 sysctl_acq_expires;
  55. #ifdef CONFIG_SYSCTL
  56. struct ctl_table_header *sysctl_hdr;
  57. #endif
  58. struct dst_ops xfrm4_dst_ops;
  59. #if IS_ENABLED(CONFIG_IPV6)
  60. struct dst_ops xfrm6_dst_ops;
  61. #endif
  62. spinlock_t xfrm_state_lock;
  63. spinlock_t xfrm_policy_lock;
  64. struct mutex xfrm_cfg_mutex;
  65. };
  66. #endif