From: Paolo Abeni Date: Tue, 22 Mar 2016 08:19:38 +0000 (+0100) Subject: ipv4: fix broadcast packets reception X-Git-Tag: v4.1.12-92~15^2~78 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=53efd1de47cbeeb84c1cae31f84156936179f565;p=users%2Fjedix%2Flinux-maple.git ipv4: fix broadcast packets reception Orabug: 25308060 [ Upstream commit ad0ea1989cc4d5905941d0a9e62c63ad6d859cef ] 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 Acked-by: Hannes Frederic Sowa Signed-off-by: David S. Miller Signed-off-by: Sasha Levin (cherry picked from commit 263a20bc8ce3c3cb2ad3078457dc7abd29bc9165) Signed-off-by: Dhaval Giani --- diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index a390174b96de6..031752efe1ab6 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1979,10 +1979,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) {