On Thu, Jul 18, 2019 at 08:10:34PM +0200, Pablo Neira Ayuso wrote:
> On Thu, Jul 18, 2019 at 05:37:29AM +0200, Phil Sutter wrote:
> > nft_meta_get_eval()'s tendency to bail out setting NFT_BREAK verdict in
> > situations where required data is missing breaks inverted checks
> > like e.g.:
> >
> > | 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,O}IF:
> > Use invalid ifindex value zero.
> >
> > {I,O}IFNAME, {I,O}IFKIND:
> > Use an empty string which is neither a valid interface name nor
> > kind.
> >
> > {I,O}IFTYPE:
> > Use ARPHRD_VOID (0xFFFF).
> >
> > Signed-off-by: Phil Sutter <[email protected]>
> > ---
> > net/netfilter/nft_meta.c | 45 +++++++++++++++++-----------------------
>
> Missing update for:
>
> net/bridge/netfilter/nft_meta_bridge.c
While you update this, would you also disentangle the default: case?
default:
goto out;
...
out:
return nft_meta_get_eval(expr, regs, pkt);
not good to use goto like that.
I'd suggest:
default:
nft_meta_get_eval(expr, regs, pkt);
return;
Thanks.