[NET] fib_rules: goto rule action

This patch adds a new rule action FR_ACT_GOTO which allows
to skip a set of rules by jumping to another rule. The rule
to jump to is specified via the FRA_GOTO attribute which
carries a rule preference.

Referring to a rule which doesn't exists is explicitely allowed.
Such goto rules are marked with the flag FIB_RULE_UNRESOLVED
and will act like a rule with a non-matching selector. The rule
will become functional as soon as its target is present.

The goto action enables performance optimizations by reducing
the average number of rules that have to be passed per lookup.

Example:
0:      from all lookup local
40:     not from all to 192.168.23.128 goto 32766
41:     from all fwmark 0xa blackhole
42:     from all fwmark 0xff blackhole
32766:  from all lookup main

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Thomas Graf
2007-03-26 17:14:15 -07:00
committed by David S. Miller
parent 2f7826c024
commit 0947c9fe56
3 changed files with 94 additions and 6 deletions

View File

@@ -7,6 +7,7 @@
/* rule is permanent, and cannot be deleted */
#define FIB_RULE_PERMANENT 1
#define FIB_RULE_INVERT 2
#define FIB_RULE_UNRESOLVED 4
struct fib_rule_hdr
{
@@ -29,7 +30,7 @@ enum
FRA_DST, /* destination address */
FRA_SRC, /* source address */
FRA_IFNAME, /* interface name */
FRA_UNUSED1,
FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
FRA_UNUSED2,
FRA_PRIORITY, /* priority/preference */
FRA_UNUSED3,
@@ -51,7 +52,7 @@ enum
{
FR_ACT_UNSPEC,
FR_ACT_TO_TBL, /* Pass to fixed table */
FR_ACT_RES1,
FR_ACT_GOTO, /* Jump to another rule */
FR_ACT_RES2,
FR_ACT_RES3,
FR_ACT_RES4,