why is nftables 'iifname' not matching but 'iif' is, GNU Linux 4.9.59.
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
why is nftables 'iifname' not matching but 'iif' is, GNU Linux 4.9.59.
In GNU/Linux 4.9.59, my existing nftables filters which match on iifname do not get matched. If I change the rule to 'iif' it works, but I don't want that because my interface may not exist at the time of rule creation.
For example:
nft add rule ip filter input iifname "myInterface" counter accept
Also the following doesn't work:
nft add rule ip filter input meta iifname "myInterface" counter accept
both successfully create the following rule, which doesn't work:
iifname "myInterface" counter packets 0 bytes 0 accept
Packets received on the interface do not get counted under this rule, but they do enter the input chain (I have as the first line of the input chain "counter packets 0 bytes 0", ie not match criteria).
If I use 'iif', it matches.
What happened? Do I need to load a module by hand?
thanks!
According to documentation, if you use iifname, the interface does not have to exist prior to creation of the rule, but iif does require that the interface exists.
I have tested iifname on another linux box running 4.9.49 and it works fine.
On 4.9.59 it doesn't, BUT I am assuming that something so basic was not removed from support, and that I am just missing some module to load.
I can't figure out what is missing though!
this turned out to be a problem with string endianness, on big endian platforms. I upgraded to nftables v0.7 and this problem went away.
However, now I am unable to have both dport and sport matching on one rule line.
For example, I used to be able to have the following rule in nftables v0.5 :
tcp sport ssh tcp dport ssh counter accept
Now this does NOT match.
I have to separate into two rules
tcp sport ssh counter accept
tcp dport ssh counter accept
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.