]> git.karo-electronics.de Git - linux-beck.git/commitdiff
netfilter: nft_fib_ipv4: initialize *dest to zero
authorLiping Zhang <zlpnobody@gmail.com>
Wed, 23 Nov 2016 14:12:21 +0000 (22:12 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 6 Dec 2016 20:42:21 +0000 (21:42 +0100)
Otherwise, if fib lookup fail, *dest will be filled with garbage value,
so reverse path filtering will not work properly:
 # nft add rule x prerouting fib saddr oif eq 0 drop

Fixes: f6d0cbcf09c5 ("netfilter: nf_tables: add fib expression")
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv4/netfilter/nft_fib_ipv4.c

index bfffa742f397c6cbaec8bca41894afc36b46865d..258136364f5ef8938e74ce7bbc88f6f65b9529ac 100644 (file)
@@ -122,6 +122,8 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
                fl4.saddr = get_saddr(iph->daddr);
        }
 
+       *dest = 0;
+
        if (fib_lookup(nft_net(pkt), &fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE))
                return;