Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1511482

Re: [PATCH] [v2 netfilter-next] netfilter: nf_tables: fib warnings

From Florian Westphal <fw@strlen.de>
Newsgroups linux.kernel
Subject Re: [PATCH] [v2 netfilter-next] netfilter: nf_tables: fib warnings
Date 2016-10-29 01:30 +0200
Message-ID <sxoKZ-6sr-3@gated-at.bofh.it> (permalink)
References <sxlWN-4Ha-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Arnd Bergmann <arnd@arndb.de> wrote:
> The newly added nft fib code produces two warnings:
> 
> net/ipv4/netfilter/nft_fib_ipv4.c: In function 'nft_fib4_eval':
> net/ipv4/netfilter/nft_fib_ipv4.c:80:6: error: unused variable 'i' [-Werror=unused-variable]
> net/ipv4/netfilter/nft_fib_ipv4.c: In function ‘nft_fib4_eval’:
> net/ipv4/netfilter/nft_fib_ipv4.c:137:6: error: ‘oif’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> The first one is obvious as the only user of that variable is
> inside of an #ifdef
> 
> The second one is a bit trickier. It's clear that oif is in fact
> uninitialized when it gets used when neither NFTA_FIB_F_IIF nor
> NFTA_FIB_F_OIF are set, and just setting it to NULL won't work
> as it may later get dereferenced.
> 
> However, there is no need to search the result list if it is
> NULL, as Florian pointed out. This integrates his (untested)
> change to do so. I have confirmed that the combined patch
> solves both warnings, but as I don't fully understand Florian's
> change, I can't tell if it's correct.
> 
> Suggested-by: Florian Westphal <fw@strlen.de>
> Fixes: 84f5eedb983e ("netfilter: nf_tables: add fib expression")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

chain pre {
        type filter hook prerouting priority 0; policy accept;
        fib saddr oif "eth0"
}

eth0: default route, 192.168.7.10/16
eth1: 10.0.0.2/8

ping from 192.168.7.1 from peer on eth0: result eth0, ok
ping from 10.0.0.2 from peer on eth0: no result, ok
ping from 10.0.0.3 from peer on eth0: result eth1, ok

chain pre {
	        type filter hook prerouting priority 0; policy accept;
	        fib saddr . iif oif "eth0"
}

ping from 192.168.7.1 from peer on eth0: result eth0, ok
ping from 10.0.0.2 from peer on eth0: no result, ok
ping from 10.0.0.3 from peer on eth0: no result, ok

so:

Tested-by: Florian Westphal <fw@strlen.de>

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] [v2 netfilter-next] netfilter: nf_tables: fib warnings Arnd Bergmann <arnd@arndb.de> - 2016-10-28 22:30 +0200
  Re: [PATCH] [v2 netfilter-next] netfilter: nf_tables: fib warnings Florian Westphal <fw@strlen.de> - 2016-10-29 01:30 +0200
    Re: [PATCH] [v2 netfilter-next] netfilter: nf_tables: fib warnings Pablo Neira Ayuso <pablo@netfilter.org> - 2016-10-31 15:20 +0100

csiph-web