calipso.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * CALIPSO - Common Architecture Label IPv6 Security Option
  4. *
  5. * This is an implementation of the CALIPSO protocol as specified in
  6. * RFC 5570.
  7. *
  8. * Authors: Paul Moore <[email protected]>
  9. * Huw Davies <[email protected]>
  10. */
  11. /*
  12. * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  13. * (c) Copyright Huw Davies <[email protected]>, 2015
  14. */
  15. #ifndef _CALIPSO_H
  16. #define _CALIPSO_H
  17. #include <linux/types.h>
  18. #include <linux/rcupdate.h>
  19. #include <linux/list.h>
  20. #include <linux/net.h>
  21. #include <linux/skbuff.h>
  22. #include <net/netlabel.h>
  23. #include <net/request_sock.h>
  24. #include <linux/refcount.h>
  25. #include <asm/unaligned.h>
  26. /* known doi values */
  27. #define CALIPSO_DOI_UNKNOWN 0x00000000
  28. /* doi mapping types */
  29. #define CALIPSO_MAP_UNKNOWN 0
  30. #define CALIPSO_MAP_PASS 2
  31. /*
  32. * CALIPSO DOI definitions
  33. */
  34. /* DOI definition struct */
  35. struct calipso_doi {
  36. u32 doi;
  37. u32 type;
  38. refcount_t refcount;
  39. struct list_head list;
  40. struct rcu_head rcu;
  41. };
  42. /*
  43. * Sysctl Variables
  44. */
  45. extern int calipso_cache_enabled;
  46. extern int calipso_cache_bucketsize;
  47. #ifdef CONFIG_NETLABEL
  48. int __init calipso_init(void);
  49. void calipso_exit(void);
  50. bool calipso_validate(const struct sk_buff *skb, const unsigned char *option);
  51. #else
  52. static inline int __init calipso_init(void)
  53. {
  54. return 0;
  55. }
  56. static inline void calipso_exit(void)
  57. {
  58. }
  59. static inline bool calipso_validate(const struct sk_buff *skb,
  60. const unsigned char *option)
  61. {
  62. return true;
  63. }
  64. #endif /* CONFIG_NETLABEL */
  65. #endif /* _CALIPSO_H */