For a netdev filter table's ingress hook I'd like to store the device name in a variable, but I somehow can't figure out the correct syntax.
It works as follows:
table netdev filter { chain ingress { type filter hook ingress device ens33 priority -500; # ... } } ... but I would like to use a variable in place of ens33 on the line:
type filter hook ingress device ens33 priority -500; When I use the following, I get an error:
define extif = ens33 table netdev filter { chain ingress { type filter hook ingress device $extif priority -500; # ... } } The error reads:
Error: syntax error, unexpected '$', expecting string or quoted string or string with a trailing asterisk Now I also tried ens* hoping for it to be similar to ens+ in iptables, but then the error changes to the one I also encounter when giving an invalid device name:
Error: Could not process rule: No such file or directory chain ingress { ^^^^^^^ Similarly quoting didn't work for me. The documentation also didn't provide the clue that could make it work.
How can I place the name (or names) of my external interfaces in a variable in order to use them as parameter for device on the type filter hook ... stanza?
The kernel is 5.8 and the system is Ubuntu 20.04. nftables reports as v0.9.3 (Topsy).