All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] udp: fix bcast packet reception
@ 2017-10-09 12:52 Paolo Abeni
  2017-10-09 17:29 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Abeni @ 2017-10-09 12:52 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Hannes Frederic Sowa

The commit bc044e8db796 ("udp: perform source validation for
mcast early demux") does not take into account that broadcast packets
lands in the same code path and they need different checks for the
source address - notably, zero source address are valid for bcast
and invalid for mcast.

As a result, 2nd and later broadcast packets with 0 source address
landing to the same socket are dropped. This breaks dhcp servers.

Since we don't have stringent performance requirements for ingress
broadcast traffic, fix it by disabling UDP early demux such traffic.

Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Fixes: bc044e8db796 ("udp: perform source validation for mcast early demux")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/ipv4/udp.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 5676237d2b0f..e45177ceb0ee 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2240,20 +2240,16 @@ int udp_v4_early_demux(struct sk_buff *skb)
 	iph = ip_hdr(skb);
 	uh = udp_hdr(skb);
 
-	if (skb->pkt_type == PACKET_BROADCAST ||
-	    skb->pkt_type == PACKET_MULTICAST) {
+	if (skb->pkt_type == PACKET_MULTICAST) {
 		in_dev = __in_dev_get_rcu(skb->dev);
 
 		if (!in_dev)
 			return 0;
 
-		/* 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 0;
-		}
+		ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
+				       iph->protocol);
+		if (!ours)
+			return 0;
 
 		sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr,
 						   uh->source, iph->saddr,
-- 
2.13.6

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

* Re: [PATCH net] udp: fix bcast packet reception
  2017-10-09 12:52 [PATCH net] udp: fix bcast packet reception Paolo Abeni
@ 2017-10-09 17:29 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-10-09 17:29 UTC (permalink / raw)
  To: pabeni; +Cc: netdev, hannes

From: Paolo Abeni <pabeni@redhat.com>
Date: Mon,  9 Oct 2017 14:52:10 +0200

> The commit bc044e8db796 ("udp: perform source validation for
> mcast early demux") does not take into account that broadcast packets
> lands in the same code path and they need different checks for the
> source address - notably, zero source address are valid for bcast
> and invalid for mcast.
> 
> As a result, 2nd and later broadcast packets with 0 source address
> landing to the same socket are dropped. This breaks dhcp servers.
> 
> Since we don't have stringent performance requirements for ingress
> broadcast traffic, fix it by disabling UDP early demux such traffic.
> 
> Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Fixes: bc044e8db796 ("udp: perform source validation for mcast early demux")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Applied and queued up for -stable.

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

end of thread, other threads:[~2017-10-09 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09 12:52 [PATCH net] udp: fix bcast packet reception Paolo Abeni
2017-10-09 17:29 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.