fib_rules.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef __LINUX_FIB_RULES_H
  2. #define __LINUX_FIB_RULES_H
  3. #include <linux/types.h>
  4. #include <linux/rtnetlink.h>
  5. /* rule is permanent, and cannot be deleted */
  6. #define FIB_RULE_PERMANENT 0x00000001
  7. #define FIB_RULE_INVERT 0x00000002
  8. #define FIB_RULE_UNRESOLVED 0x00000004
  9. #define FIB_RULE_IIF_DETACHED 0x00000008
  10. #define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED
  11. #define FIB_RULE_OIF_DETACHED 0x00000010
  12. /* try to find source address in routing lookups */
  13. #define FIB_RULE_FIND_SADDR 0x00010000
  14. /* fib_rules families. values up to 127 are reserved for real address
  15. * families, values above 128 may be used arbitrarily.
  16. */
  17. #define FIB_RULES_IPV4 AF_INET
  18. #define FIB_RULES_IPV6 AF_INET6
  19. #define FIB_RULES_DECNET AF_DECnet
  20. struct fib_rule_hdr {
  21. __u8 family;
  22. __u8 dst_len;
  23. __u8 src_len;
  24. __u8 tos;
  25. __u8 table;
  26. __u8 res1; /* reserved */
  27. __u8 res2; /* reserved */
  28. __u8 action;
  29. __u32 flags;
  30. };
  31. enum {
  32. FRA_UNSPEC,
  33. FRA_DST, /* destination address */
  34. FRA_SRC, /* source address */
  35. FRA_IIFNAME, /* interface name */
  36. #define FRA_IFNAME FRA_IIFNAME
  37. FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
  38. FRA_UNUSED2,
  39. FRA_PRIORITY, /* priority/preference */
  40. FRA_UNUSED3,
  41. FRA_UNUSED4,
  42. FRA_UNUSED5,
  43. FRA_FWMARK, /* mark */
  44. FRA_FLOW, /* flow/class id */
  45. FRA_UNUSED6,
  46. FRA_UNUSED7,
  47. FRA_UNUSED8,
  48. FRA_TABLE, /* Extended table id */
  49. FRA_FWMASK, /* mask for netfilter mark */
  50. FRA_OIFNAME,
  51. __FRA_MAX
  52. };
  53. #define FRA_MAX (__FRA_MAX - 1)
  54. enum {
  55. FR_ACT_UNSPEC,
  56. FR_ACT_TO_TBL, /* Pass to fixed table */
  57. FR_ACT_GOTO, /* Jump to another rule */
  58. FR_ACT_NOP, /* No operation */
  59. FR_ACT_RES3,
  60. FR_ACT_RES4,
  61. FR_ACT_BLACKHOLE, /* Drop without notification */
  62. FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */
  63. FR_ACT_PROHIBIT, /* Drop with EACCES */
  64. __FR_ACT_MAX,
  65. };
  66. #define FR_ACT_MAX (__FR_ACT_MAX - 1)
  67. #endif