浏览代码

[NET] fib_rules: Add no-operation action

The use of nop rules simplifies the usage of goto rules
and adds more flexibility as they allow targets to remain
while the actual content of the branches can change easly.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Thomas Graf 18 年之前
父节点
当前提交
fa0b2d1d21
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 1 1
      include/linux/fib_rules.h
  2. 3 1
      net/core/fib_rules.c

+ 1 - 1
include/linux/fib_rules.h

@@ -54,7 +54,7 @@ enum
 	FR_ACT_UNSPEC,
 	FR_ACT_TO_TBL,		/* Pass to fixed table */
 	FR_ACT_GOTO,		/* Jump to another rule */
-	FR_ACT_RES2,
+	FR_ACT_NOP,		/* No operation */
 	FR_ACT_RES3,
 	FR_ACT_RES4,
 	FR_ACT_BLACKHOLE,	/* Drop without notification */

+ 3 - 1
net/core/fib_rules.c

@@ -146,7 +146,9 @@ jumped:
 				rule = target;
 				goto jumped;
 			}
-		} else
+		} else if (rule->action == FR_ACT_NOP)
+			continue;
+		else
 			err = ops->action(rule, fl, flags, arg);
 
 		if (err != -EAGAIN) {