]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
fib: Change data type of fib oifname to "ifname"
authorXiao Liang <shaw.leon@gmail.com>
Tue, 25 Feb 2025 10:02:17 +0000 (18:02 +0800)
committerFlorian Westphal <fw@strlen.de>
Tue, 25 Feb 2025 18:20:09 +0000 (19:20 +0100)
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 <shaw.leon@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
doc/primary-expression.txt
src/fib.c
tests/shell/testcases/sets/0029named_ifname_dtype_0
tests/shell/testcases/sets/dumps/0029named_ifname_dtype_0.nft

index c6a33bbe418445e5e9d003752e2486a6085cf438..40aca3d3fcf65d2b10dd76d92b211e94c9af6f55 100644 (file)
@@ -354,10 +354,10 @@ address types can be shown with *nft* *describe* *fib_addrtype*.
 |Keyword| Description| Result Type
 |oif|
 Output interface index|
-integer (32 bit)
+iface_index
 |oifname|
 Output interface name|
-string
+ifname
 |type|
 Address type |
 fib_addrtype (see *nft* *describe* *fib_addrtype* for a list)
index e95271c9dcb8c1dfebb85cf78a7b93d08f2d1194..5a7c1170b240ba8498600326ff7155da41eb7e94 100644 (file)
--- a/src/fib.c
+++ b/src/fib.c
@@ -179,7 +179,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:
index 2dbcd22bb2ce1e7c1ee109cb150a892880ca5ed7..ea5814069f78811f7951cc26ac538585f9beb0fc 100755 (executable)
@@ -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
        }
index 55cd4f262b3502f29f440ba9c4815090c416701b..6f9832a96188fb11c1bd0af91725a0446cb13d93 100644 (file)
@@ -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
        }