netlabel_user.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * NetLabel NETLINK Interface
  3. *
  4. * This file defines the NETLINK interface for the NetLabel system. The
  5. * NetLabel system manages static and dynamic label mappings for network
  6. * protocols such as CIPSO and RIPSO.
  7. *
  8. * Author: Paul Moore <paul.moore@hp.com>
  9. *
  10. */
  11. /*
  12. * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  22. * the GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  27. *
  28. */
  29. #include <linux/init.h>
  30. #include <linux/types.h>
  31. #include <linux/list.h>
  32. #include <linux/socket.h>
  33. #include <net/sock.h>
  34. #include <net/netlink.h>
  35. #include <net/genetlink.h>
  36. #include <net/netlabel.h>
  37. #include <asm/bug.h>
  38. #include "netlabel_mgmt.h"
  39. #include "netlabel_unlabeled.h"
  40. #include "netlabel_cipso_v4.h"
  41. #include "netlabel_user.h"
  42. /*
  43. * NetLabel NETLINK Setup Functions
  44. */
  45. /**
  46. * netlbl_netlink_init - Initialize the NETLINK communication channel
  47. *
  48. * Description:
  49. * Call out to the NetLabel components so they can register their families and
  50. * commands with the Generic NETLINK mechanism. Returns zero on success and
  51. * non-zero on failure.
  52. *
  53. */
  54. int netlbl_netlink_init(void)
  55. {
  56. int ret_val;
  57. ret_val = netlbl_mgmt_genl_init();
  58. if (ret_val != 0)
  59. return ret_val;
  60. ret_val = netlbl_cipsov4_genl_init();
  61. if (ret_val != 0)
  62. return ret_val;
  63. ret_val = netlbl_unlabel_genl_init();
  64. if (ret_val != 0)
  65. return ret_val;
  66. return 0;
  67. }