aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2017-10-09 08:52:10 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-09 13:28:25 -0400
commit996b44fcef8f216ea0b6b6e74468c5a77b5e341f (patch)
treee21b0278971b7764f40b74768cb51150c0d3b8c7 /net
parent41c87425a1ac9b633e0fcc78eb1f19640c8fb5a0 (diff)
udp: fix bcast packet reception
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/udp.c14
1 files 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)
2240 iph = ip_hdr(skb); 2240 iph = ip_hdr(skb);
2241 uh = udp_hdr(skb); 2241 uh = udp_hdr(skb);
2242 2242
2243 if (skb->pkt_type == PACKET_BROADCAST || 2243 if (skb->pkt_type == PACKET_MULTICAST) {
2244 skb->pkt_type == PACKET_MULTICAST) {
2245 in_dev = __in_dev_get_rcu(skb->dev); 2244 in_dev = __in_dev_get_rcu(skb->dev);
2246 2245
2247 if (!in_dev) 2246 if (!in_dev)
2248 return 0; 2247 return 0;
2249 2248
2250 /* we are supposed to accept bcast packets */ 2249 ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
2251 if (skb->pkt_type == PACKET_MULTICAST) { 2250 iph->protocol);
2252 ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr, 2251 if (!ours)
2253 iph->protocol); 2252 return 0;
2254 if (!ours)
2255 return 0;
2256 }
2257 2253
2258 sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, 2254 sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr,
2259 uh->source, iph->saddr, 2255 uh->source, iph->saddr,