fib_rules.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #define FIB_RULES_IPMR 128
  21. struct fib_rule_hdr {
  22. __u8 family;
  23. __u8 dst_len;
  24. __u8 src_len;
  25. __u8 tos;
  26. __u8 table;
  27. __u8 res1; /* reserved */
  28. __u8 res2; /* reserved */
  29. __u8 action;
  30. __u32 flags;
  31. };
  32. enum {
  33. FRA_UNSPEC,
  34. FRA_DST, /* destination address */
  35. FRA_SRC, /* source address */
  36. FRA_IIFNAME, /* interface name */
  37. #define FRA_IFNAME FRA_IIFNAME
  38. FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
  39. FRA_UNUSED2,
  40. FRA_PRIORITY, /* priority/preference */
  41. FRA_UNUSED3,
  42. FRA_UNUSED4,
  43. FRA_UNUSED5,
  44. FRA_FWMARK, /* mark */
  45. FRA_FLOW, /* flow/class id */
  46. FRA_UNUSED6,
  47. FRA_UNUSED7,
  48. FRA_UNUSED8,
  49. FRA_TABLE, /* Extended table id */
  50. FRA_FWMASK, /* mask for netfilter mark */
  51. FRA_OIFNAME,
  52. __FRA_MAX
  53. };
  54. #define FRA_MAX (__FRA_MAX - 1)
  55. enum {
  56. FR_ACT_UNSPEC,
  57. FR_ACT_TO_TBL, /* Pass to fixed table */
  58. FR_ACT_GOTO, /* Jump to another rule */
  59. FR_ACT_NOP, /* No operation */
  60. FR_ACT_RES3,
  61. FR_ACT_RES4,
  62. FR_ACT_BLACKHOLE, /* Drop without notification */
  63. FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */
  64. FR_ACT_PROHIBIT, /* Drop with EACCES */
  65. __FR_ACT_MAX,
  66. };
  67. #define FR_ACT_MAX (__FR_ACT_MAX - 1)
  68. #endif