Jiri Slaby a23e55
From: Marco Oliverio <marco.oliverio@tanaza.com>
Jiri Slaby a23e55
Date: Mon, 2 Dec 2019 19:54:30 +0100
Jiri Slaby a23e55
Subject: netfilter: nf_queue: enqueue skbs with NULL dst
Jiri Slaby a23e55
Git-commit: 0b9173f4688dfa7c5d723426be1d979c24ce3d51
Jiri Slaby a23e55
Patch-mainline: 5.5-rc3
Jiri Slaby a23e55
References: git-fixes
Jiri Slaby a23e55
Jiri Slaby a23e55
Bridge packets that are forwarded have skb->dst == NULL and get
Jiri Slaby a23e55
dropped by the check introduced by
Jiri Slaby a23e55
b60a77386b1d4868f72f6353d35dabe5fbe981f2 (net: make skb_dst_force
Jiri Slaby a23e55
return true when dst is refcounted).
Jiri Slaby a23e55
Jiri Slaby a23e55
To fix this we check skb_dst() before skb_dst_force(), so we don't
Jiri Slaby a23e55
drop skb packet with dst == NULL. This holds also for skb at the
Jiri Slaby a23e55
PRE_ROUTING hook so we remove the second check.
Jiri Slaby a23e55
Jiri Slaby a23e55
Fixes: b60a77386b1d ("net: make skb_dst_force return true when dst is refcounted")
Jiri Slaby a23e55
Signed-off-by: Marco Oliverio <marco.oliverio@tanaza.com>
Jiri Slaby a23e55
Signed-off-by: Rocco Folino <rocco.folino@tanaza.com>
Jiri Slaby a23e55
Acked-by: Florian Westphal <fw@strlen.de>
Jiri Slaby a23e55
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Jiri Slaby a23e55
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Jiri Slaby a23e55
---
Jiri Slaby a23e55
 net/netfilter/nf_queue.c |    2 +-
Jiri Slaby a23e55
 1 file changed, 1 insertion(+), 1 deletion(-)
Jiri Slaby a23e55
Jiri Slaby a23e55
--- a/net/netfilter/nf_queue.c
Jiri Slaby a23e55
+++ b/net/netfilter/nf_queue.c
Jiri Slaby a23e55
@@ -136,7 +136,7 @@ static int __nf_queue(struct sk_buff *sk
Jiri Slaby a23e55
 		goto err;
Jiri Slaby a23e55
 	}
Jiri Slaby a23e55
 
Jiri Slaby a23e55
-	if (!skb_dst_force(skb) && state->hook != NF_INET_PRE_ROUTING) {
Jiri Slaby a23e55
+	if (skb_dst(skb) && !skb_dst_force(skb)) {
Jiri Slaby a23e55
 		status = -ENETDOWN;
Jiri Slaby a23e55
 		goto err;
Jiri Slaby a23e55
 	}