diff options
Diffstat (limited to 'net/ipv4/udp.c')
| -rw-r--r-- | net/ipv4/udp.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index d10b7e0112eb..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> |
| @@ -1345,10 +1346,8 @@ csum_copy_err: | |||
| 1345 | } | 1346 | } |
| 1346 | unlock_sock_fast(sk, slow); | 1347 | unlock_sock_fast(sk, slow); |
| 1347 | 1348 | ||
| 1348 | if (noblock) | 1349 | /* starting over for a new packet, but check if we need to yield */ |
| 1349 | return -EAGAIN; | 1350 | cond_resched(); |
| 1350 | |||
| 1351 | /* starting over for a new packet */ | ||
| 1352 | msg->msg_flags &= ~MSG_TRUNC; | 1351 | msg->msg_flags &= ~MSG_TRUNC; |
| 1353 | goto try_again; | 1352 | goto try_again; |
| 1354 | } | 1353 | } |
| @@ -1962,6 +1961,7 @@ void udp_v4_early_demux(struct sk_buff *skb) | |||
| 1962 | struct sock *sk; | 1961 | struct sock *sk; |
| 1963 | struct dst_entry *dst; | 1962 | struct dst_entry *dst; |
| 1964 | int dif = skb->dev->ifindex; | 1963 | int dif = skb->dev->ifindex; |
| 1964 | int ours; | ||
| 1965 | 1965 | ||
| 1966 | /* validate the packet */ | 1966 | /* validate the packet */ |
| 1967 | 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))) |
| @@ -1971,14 +1971,24 @@ void udp_v4_early_demux(struct sk_buff *skb) | |||
| 1971 | uh = udp_hdr(skb); | 1971 | uh = udp_hdr(skb); |
| 1972 | 1972 | ||
| 1973 | if (skb->pkt_type == PACKET_BROADCAST || | 1973 | if (skb->pkt_type == PACKET_BROADCAST || |
| 1974 | 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; | ||
| 1975 | sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, | 1984 | sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, |
| 1976 | uh->source, iph->saddr, dif); | 1985 | uh->source, iph->saddr, dif); |
| 1977 | else if (skb->pkt_type == PACKET_HOST) | 1986 | } else if (skb->pkt_type == PACKET_HOST) { |
| 1978 | sk = __udp4_lib_demux_lookup(net, uh->dest, iph->daddr, | 1987 | sk = __udp4_lib_demux_lookup(net, uh->dest, iph->daddr, |
| 1979 | uh->source, iph->saddr, dif); | 1988 | uh->source, iph->saddr, dif); |
| 1980 | else | 1989 | } else { |
| 1981 | return; | 1990 | return; |
| 1991 | } | ||
| 1982 | 1992 | ||
| 1983 | if (!sk) | 1993 | if (!sk) |
| 1984 | return; | 1994 | return; |
