calipso.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * CALIPSO - Common Architecture Label IPv6 Security Option
  3. *
  4. * This is an implementation of the CALIPSO protocol as specified in
  5. * RFC 5570.
  6. *
  7. * Authors: Paul Moore <paul@paul-moore.com>
  8. * Huw Davies <huw@codeweavers.com>
  9. *
  10. */
  11. /*
  12. * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  13. * (c) Copyright Huw Davies <huw@codeweavers.com>, 2015
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  23. * the GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  27. *
  28. */
  29. #ifndef _CALIPSO_H
  30. #define _CALIPSO_H
  31. #include <linux/types.h>
  32. #include <linux/rcupdate.h>
  33. #include <linux/list.h>
  34. #include <linux/net.h>
  35. #include <linux/skbuff.h>
  36. #include <net/netlabel.h>
  37. #include <net/request_sock.h>
  38. #include <linux/refcount.h>
  39. #include <asm/unaligned.h>
  40. /* known doi values */
  41. #define CALIPSO_DOI_UNKNOWN 0x00000000
  42. /* doi mapping types */
  43. #define CALIPSO_MAP_UNKNOWN 0
  44. #define CALIPSO_MAP_PASS 2
  45. /*
  46. * CALIPSO DOI definitions
  47. */
  48. /* DOI definition struct */
  49. struct calipso_doi {
  50. u32 doi;
  51. u32 type;
  52. refcount_t refcount;
  53. struct list_head list;
  54. struct rcu_head rcu;
  55. };
  56. /*
  57. * Sysctl Variables
  58. */
  59. extern int calipso_cache_enabled;
  60. extern int calipso_cache_bucketsize;
  61. #ifdef CONFIG_NETLABEL
  62. int __init calipso_init(void);
  63. void calipso_exit(void);
  64. bool calipso_validate(const struct sk_buff *skb, const unsigned char *option);
  65. #else
  66. static inline int __init calipso_init(void)
  67. {
  68. return 0;
  69. }
  70. static inline void calipso_exit(void)
  71. {
  72. }
  73. static inline bool calipso_validate(const struct sk_buff *skb,
  74. const unsigned char *option)
  75. {
  76. return true;
  77. }
  78. #endif /* CONFIG_NETLABEL */
  79. #endif /* _CALIPSO_H */