diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/udp.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 1c92ea67baef..83aa604f9273 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -90,6 +90,7 @@ | |||
90 | #include <linux/socket.h> | 90 | #include <linux/socket.h> |
91 | #include <linux/sockios.h> | 91 | #include <linux/sockios.h> |
92 | #include <linux/igmp.h> | 92 | #include <linux/igmp.h> |
93 | #include <linux/inetdevice.h> | ||
93 | #include <linux/in.h> | 94 | #include <linux/in.h> |
94 | #include <linux/errno.h> | 95 | #include <linux/errno.h> |
95 | #include <linux/timer.h> | 96 | #include <linux/timer.h> |
@@ -1960,6 +1961,7 @@ void udp_v4_early_demux(struct sk_buff *skb) | |||
1960 | struct sock *sk; | 1961 | struct sock *sk; |
1961 | struct dst_entry *dst; | 1962 | struct dst_entry *dst; |
1962 | int dif = skb->dev->ifindex; | 1963 | int dif = skb->dev->ifindex; |
1964 | int ours; | ||
1963 | 1965 | ||
1964 | /* validate the packet */ | 1966 | /* validate the packet */ |
1965 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct udphdr))) | 1967 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct udphdr))) |
@@ -1969,14 +1971,24 @@ void udp_v4_early_demux(struct sk_buff *skb) | |||
1969 | uh = udp_hdr(skb); | 1971 | uh = udp_hdr(skb); |
1970 | 1972 | ||
1971 | if (skb->pkt_type == PACKET_BROADCAST || | 1973 | if (skb->pkt_type == PACKET_BROADCAST || |
1972 | skb->pkt_type == PACKET_MULTICAST) | 1974 | skb->pkt_type == PACKET_MULTICAST) { |
1975 | struct in_device *in_dev = __in_dev_get_rcu(skb->dev); | ||
1976 | |||
1977 | if (!in_dev) | ||
1978 | return; | ||
1979 | |||
1980 | ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr, | ||
1981 | iph->protocol); | ||
1982 | if (!ours) | ||
1983 | return; | ||
1973 | sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, | 1984 | sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, |
1974 | uh->source, iph->saddr, dif); | 1985 | uh->source, iph->saddr, dif); |
1975 | else if (skb->pkt_type == PACKET_HOST) | 1986 | } else if (skb->pkt_type == PACKET_HOST) { |
1976 | sk = __udp4_lib_demux_lookup(net, uh->dest, iph->daddr, | 1987 | sk = __udp4_lib_demux_lookup(net, uh->dest, iph->daddr, |
1977 | uh->source, iph->saddr, dif); | 1988 | uh->source, iph->saddr, dif); |
1978 | else | 1989 | } else { |
1979 | return; | 1990 | return; |
1991 | } | ||
1980 | 1992 | ||
1981 | if (!sk) | 1993 | if (!sk) |
1982 | return; | 1994 | return; |