From: Xiao Liang Date: Tue, 25 Feb 2025 10:02:17 +0000 (+0800) Subject: fib: Change data type of fib oifname to "ifname" X-Git-Tag: v1.0.6.1~147 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d1e2d3efc30f87c146c7c12dac1b3c3636c854a;p=thirdparty%2Fnftables.git fib: Change data type of fib oifname to "ifname" commit 316d99246644268e5e0453afa3ade163fda21d7f upstream. Change data type of fib oifname from "string" to "ifname", so that it can be matched against a set of ifnames: set x { type ifname } chain y { fib saddr oifname @x drop } Signed-off-by: Xiao Liang Signed-off-by: Florian Westphal --- diff --git a/doc/primary-expression.txt b/doc/primary-expression.txt index 782494bd..80db3a19 100644 --- a/doc/primary-expression.txt +++ b/doc/primary-expression.txt @@ -323,10 +323,10 @@ functions. |Keyword| Description| Type |oif| Output interface index| -integer (32 bit) +iface_index |oifname| Output interface name| -string +ifname |type| Address type | fib_addrtype diff --git a/src/fib.c b/src/fib.c index c6ad0f9c..08d113c1 100644 --- a/src/fib.c +++ b/src/fib.c @@ -178,7 +178,7 @@ struct expr *fib_expr_alloc(const struct location *loc, type = &ifindex_type; break; case NFT_FIB_RESULT_OIFNAME: - type = &string_type; + type = &ifname_type; len = IFNAMSIZ * BITS_PER_BYTE; break; case NFT_FIB_RESULT_ADDRTYPE: diff --git a/tests/shell/testcases/sets/0029named_ifname_dtype_0 b/tests/shell/testcases/sets/0029named_ifname_dtype_0 index 2dbcd22b..ea581406 100755 --- a/tests/shell/testcases/sets/0029named_ifname_dtype_0 +++ b/tests/shell/testcases/sets/0029named_ifname_dtype_0 @@ -40,6 +40,7 @@ EXPECTED="table inet t { chain c { iifname @s accept oifname @s accept + fib saddr oifname @s accept tcp dport . meta iifname @sc accept meta iifname . meta mark @nv accept } diff --git a/tests/shell/testcases/sets/dumps/0029named_ifname_dtype_0.nft b/tests/shell/testcases/sets/dumps/0029named_ifname_dtype_0.nft index 55cd4f26..6f9832a9 100644 --- a/tests/shell/testcases/sets/dumps/0029named_ifname_dtype_0.nft +++ b/tests/shell/testcases/sets/dumps/0029named_ifname_dtype_0.nft @@ -51,6 +51,7 @@ table inet t { chain c { iifname @s accept oifname @s accept + fib saddr oifname @s accept tcp dport . iifname @sc accept iifname . meta mark @nv accept }