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