fib_rules.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef __LINUX_FIB_RULES_H
  3. #define __LINUX_FIB_RULES_H
  4. #include <linux/types.h>
  5. #include <linux/rtnetlink.h>
  6. /* rule is permanent, and cannot be deleted */
  7. #define FIB_RULE_PERMANENT 0x00000001
  8. #define FIB_RULE_INVERT 0x00000002
  9. #define FIB_RULE_UNRESOLVED 0x00000004
  10. #define FIB_RULE_IIF_DETACHED 0x00000008
  11. #define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED
  12. #define FIB_RULE_OIF_DETACHED 0x00000010
  13. /* try to find source address in routing lookups */
  14. #define FIB_RULE_FIND_SADDR 0x00010000
  15. struct fib_rule_hdr {
  16. __u8 family;
  17. __u8 dst_len;
  18. __u8 src_len;
  19. __u8 tos;
  20. __u8 table;
  21. __u8 res1; /* reserved */
  22. __u8 res2; /* reserved */
  23. __u8 action;
  24. __u32 flags;
  25. };
  26. struct fib_rule_uid_range {
  27. __u32 start;
  28. __u32 end;
  29. };
  30. struct fib_rule_port_range {
  31. __u16 start;
  32. __u16 end;
  33. };
  34. enum {
  35. FRA_UNSPEC,
  36. FRA_DST, /* destination address */
  37. FRA_SRC, /* source address */
  38. FRA_IIFNAME, /* interface name */
  39. #define FRA_IFNAME FRA_IIFNAME
  40. FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
  41. FRA_UNUSED2,
  42. FRA_PRIORITY, /* priority/preference */
  43. FRA_UNUSED3,
  44. FRA_UNUSED4,
  45. FRA_UNUSED5,
  46. FRA_FWMARK, /* mark */
  47. FRA_FLOW, /* flow/class id */
  48. FRA_TUN_ID,
  49. FRA_SUPPRESS_IFGROUP,
  50. FRA_SUPPRESS_PREFIXLEN,
  51. FRA_TABLE, /* Extended table id */
  52. FRA_FWMASK, /* mask for netfilter mark */
  53. FRA_OIFNAME,
  54. FRA_PAD,
  55. FRA_L3MDEV, /* iif or oif is l3mdev goto its table */
  56. FRA_UID_RANGE, /* UID range */
  57. FRA_PROTOCOL, /* Originator of the rule */
  58. FRA_IP_PROTO, /* ip proto */
  59. FRA_SPORT_RANGE, /* sport */
  60. FRA_DPORT_RANGE, /* dport */
  61. __FRA_MAX
  62. };
  63. #define FRA_MAX (__FRA_MAX - 1)
  64. enum {
  65. FR_ACT_UNSPEC,
  66. FR_ACT_TO_TBL, /* Pass to fixed table */
  67. FR_ACT_GOTO, /* Jump to another rule */
  68. FR_ACT_NOP, /* No operation */
  69. FR_ACT_RES3,
  70. FR_ACT_RES4,
  71. FR_ACT_BLACKHOLE, /* Drop without notification */
  72. FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */
  73. FR_ACT_PROHIBIT, /* Drop with EACCES */
  74. __FR_ACT_MAX,
  75. };
  76. #define FR_ACT_MAX (__FR_ACT_MAX - 1)
  77. #endif