netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] ipv4: fix broadcast packets reception
@ 2016-03-22  8:19 Paolo Abeni
  2016-03-22 10:27 ` Hannes Frederic Sowa
  2016-03-22 19:54 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Abeni @ 2016-03-22  8:19 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Alexey Kuznetsov, Shawn Bohrer,
	Hannes Frederic Sowa

Currently, ingress ipv4 broadcast datagrams are dropped since,
in udp_v4_early_demux(), ip_check_mc_rcu() is invoked even on
bcast packets.

This patch addresses the issue, invoking ip_check_mc_rcu()
only for mcast packets.

Fixes: 6e5403093261 ("ipv4/udp: Verify multicast group is ours in upd_v4_early_demux()")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

--
 v1 -> v2 droped the route related bits, the fib_validate_source()
  failures are triggered by the in_device configuration
---
 net/ipv4/udp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 836abe5..08eed5e 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2070,10 +2070,14 @@ void udp_v4_early_demux(struct sk_buff *skb)
 		if (!in_dev)
 			return;
 
-		ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
-				       iph->protocol);
-		if (!ours)
-			return;
+		/* we are supposed to accept bcast packets */
+		if (skb->pkt_type == PACKET_MULTICAST) {
+			ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
+					       iph->protocol);
+			if (!ours)
+				return;
+		}
+
 		sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr,
 						   uh->source, iph->saddr, dif);
 	} else if (skb->pkt_type == PACKET_HOST) {
-- 
1.8.3.1

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

* Re: [PATCH net v2] ipv4: fix broadcast packets reception
  2016-03-22  8:19 [PATCH net v2] ipv4: fix broadcast packets reception Paolo Abeni
@ 2016-03-22 10:27 ` Hannes Frederic Sowa
  2016-03-22 19:54 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Frederic Sowa @ 2016-03-22 10:27 UTC (permalink / raw)
  To: Paolo Abeni, netdev; +Cc: David S. Miller, Alexey Kuznetsov, Shawn Bohrer

On 22.03.2016 09:19, Paolo Abeni wrote:
> Currently, ingress ipv4 broadcast datagrams are dropped since,
> in udp_v4_early_demux(), ip_check_mc_rcu() is invoked even on
> bcast packets.
>
> This patch addresses the issue, invoking ip_check_mc_rcu()
> only for mcast packets.
>
> Fixes: 6e5403093261 ("ipv4/udp: Verify multicast group is ours in upd_v4_early_demux()")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

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

* Re: [PATCH net v2] ipv4: fix broadcast packets reception
  2016-03-22  8:19 [PATCH net v2] ipv4: fix broadcast packets reception Paolo Abeni
  2016-03-22 10:27 ` Hannes Frederic Sowa
@ 2016-03-22 19:54 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-03-22 19:54 UTC (permalink / raw)
  To: pabeni; +Cc: netdev, kuznet, sbohrer, hannes

From: Paolo Abeni <pabeni@redhat.com>
Date: Tue, 22 Mar 2016 09:19:38 +0100

> Currently, ingress ipv4 broadcast datagrams are dropped since,
> in udp_v4_early_demux(), ip_check_mc_rcu() is invoked even on
> bcast packets.
> 
> This patch addresses the issue, invoking ip_check_mc_rcu()
> only for mcast packets.
> 
> Fixes: 6e5403093261 ("ipv4/udp: Verify multicast group is ours in upd_v4_early_demux()")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> 
> --
>  v1 -> v2 droped the route related bits, the fib_validate_source()
>   failures are triggered by the in_device configuration

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2016-03-22 19:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22  8:19 [PATCH net v2] ipv4: fix broadcast packets reception Paolo Abeni
2016-03-22 10:27 ` Hannes Frederic Sowa
2016-03-22 19:54 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).