udp: fix bcast packet reception
The commitbc044e8db7
("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:bc044e8db7
("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>
This commit is contained in:
parent
41c87425a1
commit
996b44fcef
@ -2240,20 +2240,16 @@ int udp_v4_early_demux(struct sk_buff *skb)
|
|||||||
iph = ip_hdr(skb);
|
iph = ip_hdr(skb);
|
||||||
uh = udp_hdr(skb);
|
uh = udp_hdr(skb);
|
||||||
|
|
||||||
if (skb->pkt_type == PACKET_BROADCAST ||
|
if (skb->pkt_type == PACKET_MULTICAST) {
|
||||||
skb->pkt_type == PACKET_MULTICAST) {
|
|
||||||
in_dev = __in_dev_get_rcu(skb->dev);
|
in_dev = __in_dev_get_rcu(skb->dev);
|
||||||
|
|
||||||
if (!in_dev)
|
if (!in_dev)
|
||||||
return 0;
|
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,
|
ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
|
||||||
iph->protocol);
|
iph->protocol);
|
||||||
if (!ours)
|
if (!ours)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr,
|
sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr,
|
||||||
uh->source, iph->saddr,
|
uh->source, iph->saddr,
|
||||||
|
Loading…
Reference in New Issue
Block a user