Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst
@ 2019-12-02 18:54 Marco Oliverio
  2019-12-02 18:58 ` Florian Westphal
  2019-12-02 19:04 ` Marco Oliverio
  0 siblings, 2 replies; 7+ messages in thread
From: Marco Oliverio @ 2019-12-02 18:54 UTC (permalink / raw)
  To: netfilter-devel; +Cc: netdev, fw, rocco.folino, Marco Oliverio

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: b60a773 ("net: make skb_dst_forcereturn true when dst is refcounted")

Signed-off-by: Marco Oliverio <marco.oliverio@tanaza.com>
Signed-off-by: Rocco Folino <rocco.folino@tanaza.com>
---
 net/netfilter/nf_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index a2b58de82600..f8f52ff99cfb 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -189,7 +189,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;
 	}
-- 
2.24.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst
  2019-12-02 18:54 [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst Marco Oliverio
@ 2019-12-02 18:58 ` Florian Westphal
  2019-12-02 19:04 ` Marco Oliverio
  1 sibling, 0 replies; 7+ messages in thread
From: Florian Westphal @ 2019-12-02 18:58 UTC (permalink / raw)
  To: Marco Oliverio; +Cc: netfilter-devel, netdev, fw, rocco.folino

Marco Oliverio <marco.oliverio@tanaza.com> wrote:
> 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).

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst
  2019-12-02 18:54 [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst Marco Oliverio
  2019-12-02 18:58 ` Florian Westphal
@ 2019-12-02 19:04 ` Marco Oliverio
  1 sibling, 0 replies; 7+ messages in thread
From: Marco Oliverio @ 2019-12-02 19:04 UTC (permalink / raw)
  To: Marco Oliverio; +Cc: netfilter-devel, netdev, fw, rocco.folino


Marco Oliverio writes:

> Bridge packets that are forwarded have skb->dst == NULL and get
> dropped by the check introduced by
> ...

ops. sorry for the multiple emails, made a mess :-)

Refer to this thread.

M

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst
  2019-12-02 18:42 Marco Oliverio
@ 2019-12-02 21:51 ` Matteo Croce
  0 siblings, 0 replies; 7+ messages in thread
From: Matteo Croce @ 2019-12-02 21:51 UTC (permalink / raw)
  To: Marco Oliverio; +Cc: rocco.folino, netdev, Florian Westphal

On Mon, Dec 2, 2019 at 7:43 PM Marco Oliverio <marco.oliverio@tanaza.com> wrote:
>
> 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: b60a773 ("net: make skb_dst_forcereturn true when dst is refcounted")
>
> Signed-off-by: Marco Oliverio <marco.oliverio@tanaza.com>
> Signed-off-by: Rocco Folino <rocco.folino@tanaza.com>

Tested-by: Matteo Croce <mcroce@redhat.com>

-- 
Matteo Croce
per aspera ad upstream


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst
@ 2019-12-02 18:45 Marco Oliverio
  0 siblings, 0 replies; 7+ messages in thread
From: Marco Oliverio @ 2019-12-02 18:45 UTC (permalink / raw)
  To: marco.oliverio; +Cc: netdev, fw, rocco.folino

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: b60a773 ("net: make skb_dst_forcereturn true when dst is refcounted")

Signed-off-by: Marco Oliverio <marco.oliverio@tanaza.com>
Signed-off-by: Rocco Folino <rocco.folino@tanaza.com>
---
 net/netfilter/nf_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index a2b58de82600..f8f52ff99cfb 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -189,7 +189,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;
 	}
-- 
2.24.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst
@ 2019-12-02 18:43 Marco Oliverio
  0 siblings, 0 replies; 7+ messages in thread
From: Marco Oliverio @ 2019-12-02 18:43 UTC (permalink / raw)
  To: rocco.folino; +Cc: netdev, fw, Marco Oliverio

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: b60a773 ("net: make skb_dst_forcereturn true when dst is refcounted")

Signed-off-by: Marco Oliverio <marco.oliverio@tanaza.com>
Signed-off-by: Rocco Folino <rocco.folino@tanaza.com>
---
 net/netfilter/nf_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index a2b58de82600..f8f52ff99cfb 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -189,7 +189,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;
 	}
-- 
2.24.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst
@ 2019-12-02 18:42 Marco Oliverio
  2019-12-02 21:51 ` Matteo Croce
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Oliverio @ 2019-12-02 18:42 UTC (permalink / raw)
  To: rocco.folino; +Cc: netdev, fw, Marco Oliverio

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: b60a773 ("net: make skb_dst_forcereturn true when dst is refcounted")

Signed-off-by: Marco Oliverio <marco.oliverio@tanaza.com>
Signed-off-by: Rocco Folino <rocco.folino@tanaza.com>
---
 net/netfilter/nf_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index a2b58de82600..f8f52ff99cfb 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -189,7 +189,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;
 	}
-- 
2.24.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 18:54 [PATCH nf] netfilter: nf_queue: enqueue skbs with NULL dst Marco Oliverio
2019-12-02 18:58 ` Florian Westphal
2019-12-02 19:04 ` Marco Oliverio
  -- strict thread matches above, loose matches on Subject: below --
2019-12-02 18:45 Marco Oliverio
2019-12-02 18:43 Marco Oliverio
2019-12-02 18:42 Marco Oliverio
2019-12-02 21:51 ` Matteo Croce

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git