Greg Kroah-Hartman | 6f52b16 | 2017-11-01 15:08:43 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -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 */ |
YOSHIFUJI Hideaki | 29f6af7 | 2007-04-06 11:45:39 -0700 | [diff] [blame] | 9 | #define FIB_RULE_PERMANENT 0x00000001 |
| 10 | #define FIB_RULE_INVERT 0x00000002 |
| 11 | #define FIB_RULE_UNRESOLVED 0x00000004 |
Patrick McHardy | 491deb2 | 2009-12-03 01:25:54 +0000 | [diff] [blame] | 12 | #define FIB_RULE_IIF_DETACHED 0x00000008 |
| 13 | #define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED |
Patrick McHardy | 1b038a5 | 2009-12-03 01:25:56 +0000 | [diff] [blame] | 14 | #define FIB_RULE_OIF_DETACHED 0x00000010 |
YOSHIFUJI Hideaki | 29f6af7 | 2007-04-06 11:45:39 -0700 | [diff] [blame] | 15 | |
| 16 | /* try to find source address in routing lookups */ |
| 17 | #define FIB_RULE_FIND_SADDR 0x00010000 |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -0700 | [diff] [blame] | 18 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 19 | struct fib_rule_hdr { |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -0700 | [diff] [blame] | 20 | __u8 family; |
| 21 | __u8 dst_len; |
| 22 | __u8 src_len; |
| 23 | __u8 tos; |
| 24 | |
| 25 | __u8 table; |
Donald Sharp | 1b71af6 | 2018-02-23 14:01:52 -0500 | [diff] [blame] | 26 | __u8 res1; /* reserved */ |
| 27 | __u8 res2; /* reserved */ |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -0700 | [diff] [blame] | 28 | __u8 action; |
| 29 | |
| 30 | __u32 flags; |
| 31 | }; |
| 32 | |
Lorenzo Colitti | 622ec2c | 2016-11-04 02:23:42 +0900 | [diff] [blame] | 33 | struct fib_rule_uid_range { |
| 34 | __u32 start; |
| 35 | __u32 end; |
| 36 | }; |
| 37 | |
Roopa Prabhu | bfff486 | 2018-02-28 22:40:16 -0500 | [diff] [blame] | 38 | struct fib_rule_port_range { |
| 39 | __u16 start; |
| 40 | __u16 end; |
| 41 | }; |
| 42 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 43 | enum { |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -0700 | [diff] [blame] | 44 | FRA_UNSPEC, |
| 45 | FRA_DST, /* destination address */ |
| 46 | FRA_SRC, /* source address */ |
Patrick McHardy | 491deb2 | 2009-12-03 01:25:54 +0000 | [diff] [blame] | 47 | FRA_IIFNAME, /* interface name */ |
| 48 | #define FRA_IFNAME FRA_IIFNAME |
Thomas Graf | 0947c9fe | 2007-03-26 17:14:15 -0700 | [diff] [blame] | 49 | FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -0700 | [diff] [blame] | 50 | FRA_UNUSED2, |
| 51 | FRA_PRIORITY, /* priority/preference */ |
| 52 | FRA_UNUSED3, |
| 53 | FRA_UNUSED4, |
| 54 | FRA_UNUSED5, |
Thomas Graf | b8964ed | 2006-11-09 15:22:18 -0800 | [diff] [blame] | 55 | FRA_FWMARK, /* mark */ |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -0700 | [diff] [blame] | 56 | FRA_FLOW, /* flow/class id */ |
Thomas Graf | e703087 | 2015-07-21 10:44:01 +0200 | [diff] [blame] | 57 | FRA_TUN_ID, |
Stefan Tomanek | 6ef94cf | 2013-08-02 17:19:56 +0200 | [diff] [blame] | 58 | FRA_SUPPRESS_IFGROUP, |
Stefan Tomanek | 73f5698 | 2013-08-03 14:14:43 +0200 | [diff] [blame] | 59 | FRA_SUPPRESS_PREFIXLEN, |
Patrick McHardy | 9e762a4 | 2006-08-10 23:09:48 -0700 | [diff] [blame] | 60 | FRA_TABLE, /* Extended table id */ |
Patrick McHardy | bbfb39c | 2006-08-25 16:10:14 -0700 | [diff] [blame] | 61 | FRA_FWMASK, /* mask for netfilter mark */ |
Patrick McHardy | 1b038a5 | 2009-12-03 01:25:56 +0000 | [diff] [blame] | 62 | FRA_OIFNAME, |
Nicolas Dichtel | b46f6de | 2016-04-22 17:31:18 +0200 | [diff] [blame] | 63 | FRA_PAD, |
David Ahern | 96c63fa | 2016-06-08 10:55:39 -0700 | [diff] [blame] | 64 | FRA_L3MDEV, /* iif or oif is l3mdev goto its table */ |
Lorenzo Colitti | 622ec2c | 2016-11-04 02:23:42 +0900 | [diff] [blame] | 65 | FRA_UID_RANGE, /* UID range */ |
Donald Sharp | 1b71af6 | 2018-02-23 14:01:52 -0500 | [diff] [blame] | 66 | FRA_PROTOCOL, /* Originator of the rule */ |
Roopa Prabhu | bfff486 | 2018-02-28 22:40:16 -0500 | [diff] [blame] | 67 | FRA_IP_PROTO, /* ip proto */ |
| 68 | FRA_SPORT_RANGE, /* sport */ |
| 69 | FRA_DPORT_RANGE, /* dport */ |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -0700 | [diff] [blame] | 70 | __FRA_MAX |
| 71 | }; |
| 72 | |
| 73 | #define FRA_MAX (__FRA_MAX - 1) |
| 74 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 75 | enum { |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -0700 | [diff] [blame] | 76 | FR_ACT_UNSPEC, |
| 77 | FR_ACT_TO_TBL, /* Pass to fixed table */ |
Thomas Graf | 0947c9fe | 2007-03-26 17:14:15 -0700 | [diff] [blame] | 78 | FR_ACT_GOTO, /* Jump to another rule */ |
Thomas Graf | fa0b2d1 | 2007-03-26 17:38:53 -0700 | [diff] [blame] | 79 | FR_ACT_NOP, /* No operation */ |
Thomas Graf | 14c0b97 | 2006-08-04 03:38:38 -0700 | [diff] [blame] | 80 | FR_ACT_RES3, |
| 81 | FR_ACT_RES4, |
| 82 | FR_ACT_BLACKHOLE, /* Drop without notification */ |
| 83 | FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ |
| 84 | FR_ACT_PROHIBIT, /* Drop with EACCES */ |
| 85 | __FR_ACT_MAX, |
| 86 | }; |
| 87 | |
| 88 | #define FR_ACT_MAX (__FR_ACT_MAX - 1) |
| 89 | |
| 90 | #endif |