]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_tables: Make nft_meta expression more robust
authorPhil Sutter <phil@nwl.cc>
Tue, 23 Jul 2019 13:27:52 +0000 (15:27 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 25 Jul 2019 06:37:20 +0000 (08:37 +0200)
commit19379e051e36c0adcf75ea2b95ede4a63aed3b82
treea6d4fa40c2d04babdc5fd076295d0144f664979d
parent219b9f439ff8cf5032f2f4a76857c4a9a9a18551
netfilter: nf_tables: Make nft_meta expression more robust

nft_meta_get_eval()'s tendency to bail out setting NFT_BREAK verdict in
situations where required data is missing leads to unexpected behaviour
with inverted checks like so:

| meta iifname != eth0 accept

This rule will never match if there is no input interface (or it is not
known) which is not intuitive and, what's worse, breaks consistency of
iptables-nft with iptables-legacy.

Fix this by falling back to placing a value in dreg which never matches
(avoiding accidental matches), i.e. zero for interface index and an
empty string for interface name.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/bridge/netfilter/nft_meta_bridge.c
net/netfilter/nft_meta.c