]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
netfilter: nf_queue: enqueue skbs with NULL dst
authorMarco Oliverio <marco.oliverio@tanaza.com>
Mon, 2 Dec 2019 18:54:30 +0000 (19:54 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:47:27 +0000 (23:47 -0500)
BugLink: https://bugs.launchpad.net/bugs/1860602
[ Upstream commit 0b9173f4688dfa7c5d723426be1d979c24ce3d51 ]

Bridge packets that are forwarded have skb->dst == NULL and get
dropped by the check introduced by
b60a77386b1d4868f72f6353d35dabe5fbe981f2 (net: make skb_dst_force
return true when dst is refcounted).

To fix this we check skb_dst() before skb_dst_force(), so we don't
drop skb packet with dst == NULL. This holds also for skb at the
PRE_ROUTING hook so we remove the second check.

Fixes: b60a77386b1d ("net: make skb_dst_force return true when dst is refcounted")
Signed-off-by: Marco Oliverio <marco.oliverio@tanaza.com>
Signed-off-by: Rocco Folino <rocco.folino@tanaza.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/netfilter/nf_queue.c

index 37efcc1c888777fe7af409525665735308142001..b06ef4c62522b3fbbbcef2a96a09a9e3f13b1e5d 100644 (file)
@@ -138,7 +138,7 @@ static int __nf_queue(struct sk_buff *skb, const struct nf_hook_state *state,
                goto err;
        }
 
-       if (!skb_dst_force(skb) && state->hook != NF_INET_PRE_ROUTING) {
+       if (skb_dst(skb) && !skb_dst_force(skb)) {
                status = -ENETDOWN;
                goto err;
        }