Commit 263a20bc authored by Paolo Abeni's avatar Paolo Abeni Committed by Sasha Levin

ipv4: fix broadcast packets reception

[ Upstream commit ad0ea198 ]

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: 6e540309 ("ipv4/udp: Verify multicast group is ours in upd_v4_early_demux()")
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 6acfc65a
...@@ -1979,10 +1979,14 @@ void udp_v4_early_demux(struct sk_buff *skb) ...@@ -1979,10 +1979,14 @@ void udp_v4_early_demux(struct sk_buff *skb)
if (!in_dev) if (!in_dev)
return; 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, ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
iph->protocol); iph->protocol);
if (!ours) if (!ours)
return; return;
}
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, dif); uh->source, iph->saddr, dif);
} else if (skb->pkt_type == PACKET_HOST) { } else if (skb->pkt_type == PACKET_HOST) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment