|mtu|
TCP maximum segment size of route |
integer (16 bit)
+|ipsec|
+route via ipsec tunnel or transport |
+boolean
|=================================
.Routing expression specific types
--------------------------
# IP family independent rt expression
filter output rt classid 10
+filter output rt ipsec missing
# IP family dependent rt expressions
ip filter output rt nexthop 192.168.0.1
NFT_RT_NEXTHOP4,
NFT_RT_NEXTHOP6,
NFT_RT_TCPMSS,
+ NFT_RT_XFRM,
__NFT_RT_MAX
};
#define NFT_RT_MAX (__NFT_RT_MAX - 1)
%token EXTHDR "exthdr"
+%token IPSEC "ipsec"
%type <string> identifier type_identifier string comment_spec
%destructor { xfree($$); } identifier type_identifier string comment_spec
rt_key : CLASSID { $$ = NFT_RT_CLASSID; }
| NEXTHOP { $$ = NFT_RT_NEXTHOP4; }
| MTU { $$ = NFT_RT_TCPMSS; }
+ | IPSEC { $$ = NFT_RT_XFRM; }
;
ct_expr : CT ct_key
{ "classid", NFT_RT_CLASSID },
{ "nexthop", NFT_RT_NEXTHOP4 },
{ "mtu", NFT_RT_TCPMSS },
+ { "ipsec", NFT_RT_XFRM },
};
unsigned int i, familyval = NFPROTO_UNSPEC;
const char *key, *family = NULL;
2 * BITS_PER_BYTE,
BYTEORDER_HOST_ENDIAN,
false),
+ [NFT_RT_XFRM] = RT_TEMPLATE("ipsec",
+ &boolean_type,
+ BITS_PER_BYTE,
+ BYTEORDER_HOST_ENDIAN,
+ false),
};
static void rt_expr_print(const struct expr *expr, struct output_ctx *octx)
"exthdr" { return EXTHDR; }
+"ipsec" { return IPSEC; }
{addrstring} {
yylval->string = xstrdup(yytext);
return STRING;
*inet;test-inet;output
rt classid "cosmos";ok
+rt ipsec exists;ok
+rt ipsec missing;ok
}
]
+# rt ipsec exists
+[
+ {
+ "match": {
+ "left": {
+ "rt": {
+ "key": "ipsec"
+ }
+ },
+ "op": "==",
+ "right": true
+ }
+ }
+]
+
+# rt ipsec missing
+[
+ {
+ "match": {
+ "left": {
+ "rt": {
+ "key": "ipsec"
+ }
+ },
+ "op": "==",
+ "right": false
+ }
+ }
+]
+
[ rt load classid => reg 1 ]
[ cmp eq reg 1 0x00000000 ]
+# rt ipsec exists
+ip test-ip4 input
+ [ rt load ipsec => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# rt ipsec missing
+ip test-ip4 input
+ [ rt load ipsec => reg 1 ]
+ [ cmp eq reg 1 0x00000000 ]
+