blob: 14404b3ebb89a54e9437ddeb2748907b0ff73d64 [file] [log] [blame]
Thomas Graf14c0b972006-08-04 03:38:38 -07001#ifndef __LINUX_FIB_RULES_H
2#define __LINUX_FIB_RULES_H
3
4#include <linux/types.h>
5#include <linux/rtnetlink.h>
6
7/* rule is permanent, and cannot be deleted */
YOSHIFUJI Hideaki29f6af72007-04-06 11:45:39 -07008#define FIB_RULE_PERMANENT 0x00000001
9#define FIB_RULE_INVERT 0x00000002
10#define FIB_RULE_UNRESOLVED 0x00000004
Patrick McHardy491deb24b2009-12-03 01:25:54 +000011#define FIB_RULE_IIF_DETACHED 0x00000008
12#define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED
Patrick McHardy1b038a52009-12-03 01:25:56 +000013#define FIB_RULE_OIF_DETACHED 0x00000010
YOSHIFUJI Hideaki29f6af72007-04-06 11:45:39 -070014
15/* try to find source address in routing lookups */
16#define FIB_RULE_FIND_SADDR 0x00010000
Thomas Graf14c0b972006-08-04 03:38:38 -070017
Eric Dumazetd94d9fe2009-11-04 09:50:58 -080018struct fib_rule_hdr {
Thomas Graf14c0b972006-08-04 03:38:38 -070019 __u8 family;
20 __u8 dst_len;
21 __u8 src_len;
22 __u8 tos;
23
24 __u8 table;
25 __u8 res1; /* reserved */
26 __u8 res2; /* reserved */
27 __u8 action;
28
29 __u32 flags;
30};
31
Eric Dumazetd94d9fe2009-11-04 09:50:58 -080032enum {
Thomas Graf14c0b972006-08-04 03:38:38 -070033 FRA_UNSPEC,
34 FRA_DST, /* destination address */
35 FRA_SRC, /* source address */
Patrick McHardy491deb24b2009-12-03 01:25:54 +000036 FRA_IIFNAME, /* interface name */
37#define FRA_IFNAME FRA_IIFNAME
Thomas Graf0947c9fe2007-03-26 17:14:15 -070038 FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
Thomas Graf14c0b972006-08-04 03:38:38 -070039 FRA_UNUSED2,
40 FRA_PRIORITY, /* priority/preference */
41 FRA_UNUSED3,
42 FRA_UNUSED4,
43 FRA_UNUSED5,
Thomas Grafb8964ed2006-11-09 15:22:18 -080044 FRA_FWMARK, /* mark */
Thomas Graf14c0b972006-08-04 03:38:38 -070045 FRA_FLOW, /* flow/class id */
Thomas Grafe7030872015-07-21 10:44:01 +020046 FRA_TUN_ID,
Stefan Tomanek6ef94cf2013-08-02 17:19:56 +020047 FRA_SUPPRESS_IFGROUP,
Stefan Tomanek73f56982013-08-03 14:14:43 +020048 FRA_SUPPRESS_PREFIXLEN,
Patrick McHardy9e762a42006-08-10 23:09:48 -070049 FRA_TABLE, /* Extended table id */
Patrick McHardybbfb39c2006-08-25 16:10:14 -070050 FRA_FWMASK, /* mask for netfilter mark */
Patrick McHardy1b038a52009-12-03 01:25:56 +000051 FRA_OIFNAME,
Nicolas Dichtelb46f6de2016-04-22 17:31:18 +020052 FRA_PAD,
David Ahern96c63fa2016-06-08 10:55:39 -070053 FRA_L3MDEV, /* iif or oif is l3mdev goto its table */
Thomas Graf14c0b972006-08-04 03:38:38 -070054 __FRA_MAX
55};
56
57#define FRA_MAX (__FRA_MAX - 1)
58
Eric Dumazetd94d9fe2009-11-04 09:50:58 -080059enum {
Thomas Graf14c0b972006-08-04 03:38:38 -070060 FR_ACT_UNSPEC,
61 FR_ACT_TO_TBL, /* Pass to fixed table */
Thomas Graf0947c9fe2007-03-26 17:14:15 -070062 FR_ACT_GOTO, /* Jump to another rule */
Thomas Graffa0b2d12007-03-26 17:38:53 -070063 FR_ACT_NOP, /* No operation */
Thomas Graf14c0b972006-08-04 03:38:38 -070064 FR_ACT_RES3,
65 FR_ACT_RES4,
66 FR_ACT_BLACKHOLE, /* Drop without notification */
67 FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */
68 FR_ACT_PROHIBIT, /* Drop with EACCES */
69 __FR_ACT_MAX,
70};
71
72#define FR_ACT_MAX (__FR_ACT_MAX - 1)
73
74#endif