]> 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)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 17 Jun 2025 09:27:50 +0000 (11:27 +0200)
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 <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 782494bda6f37a705d2193c043bb6ddb2af95db8..80db3a19fe43a4d4e140b13f02f03e6b63039841 100644 (file)
@@ -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
index c6ad0f9c5d15d7ab82985b187f446ba8dc3bb68c..08d113c18707e7289ef33c1ad57928ca5864e3dd 100644 (file)
--- 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:
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
        }