net.h 797 B

123456789101112131415161718192021222324252627282930313233
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Landlock LSM - Network management and hooks
  4. *
  5. * Copyright © 2022-2023 Huawei Tech. Co., Ltd.
  6. */
  7. #ifndef _SECURITY_LANDLOCK_NET_H
  8. #define _SECURITY_LANDLOCK_NET_H
  9. #include "common.h"
  10. #include "ruleset.h"
  11. #include "setup.h"
  12. #if IS_ENABLED(CONFIG_INET)
  13. __init void landlock_add_net_hooks(void);
  14. int landlock_append_net_rule(struct landlock_ruleset *const ruleset,
  15. const u16 port, access_mask_t access_rights);
  16. #else /* IS_ENABLED(CONFIG_INET) */
  17. static inline void landlock_add_net_hooks(void)
  18. {
  19. }
  20. static inline int
  21. landlock_append_net_rule(struct landlock_ruleset *const ruleset, const u16 port,
  22. access_mask_t access_rights)
  23. {
  24. return -EAFNOSUPPORT;
  25. }
  26. #endif /* IS_ENABLED(CONFIG_INET) */
  27. #endif /* _SECURITY_LANDLOCK_NET_H */