diff options
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index b7faffe5c029..c47c989cb1fb 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1015,9 +1015,11 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
1015 | 1015 | ||
1016 | if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) { | 1016 | if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) { |
1017 | /* Note that an ENOMEM error is charged twice */ | 1017 | /* Note that an ENOMEM error is charged twice */ |
1018 | if (rc == -ENOMEM) | 1018 | if (rc == -ENOMEM) { |
1019 | UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, | 1019 | UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, |
1020 | is_udplite); | 1020 | is_udplite); |
1021 | atomic_inc(&sk->sk_drops); | ||
1022 | } | ||
1021 | goto drop; | 1023 | goto drop; |
1022 | } | 1024 | } |
1023 | 1025 | ||
@@ -1229,11 +1231,10 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
1229 | int proto) | 1231 | int proto) |
1230 | { | 1232 | { |
1231 | struct sock *sk; | 1233 | struct sock *sk; |
1232 | struct udphdr *uh = udp_hdr(skb); | 1234 | struct udphdr *uh; |
1233 | unsigned short ulen; | 1235 | unsigned short ulen; |
1234 | struct rtable *rt = (struct rtable*)skb->dst; | 1236 | struct rtable *rt = (struct rtable*)skb->dst; |
1235 | __be32 saddr = ip_hdr(skb)->saddr; | 1237 | __be32 saddr, daddr; |
1236 | __be32 daddr = ip_hdr(skb)->daddr; | ||
1237 | struct net *net = dev_net(skb->dev); | 1238 | struct net *net = dev_net(skb->dev); |
1238 | 1239 | ||
1239 | /* | 1240 | /* |
@@ -1242,6 +1243,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
1242 | if (!pskb_may_pull(skb, sizeof(struct udphdr))) | 1243 | if (!pskb_may_pull(skb, sizeof(struct udphdr))) |
1243 | goto drop; /* No space for header. */ | 1244 | goto drop; /* No space for header. */ |
1244 | 1245 | ||
1246 | uh = udp_hdr(skb); | ||
1245 | ulen = ntohs(uh->len); | 1247 | ulen = ntohs(uh->len); |
1246 | if (ulen > skb->len) | 1248 | if (ulen > skb->len) |
1247 | goto short_packet; | 1249 | goto short_packet; |
@@ -1256,6 +1258,9 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
1256 | if (udp4_csum_init(skb, uh, proto)) | 1258 | if (udp4_csum_init(skb, uh, proto)) |
1257 | goto csum_error; | 1259 | goto csum_error; |
1258 | 1260 | ||
1261 | saddr = ip_hdr(skb)->saddr; | ||
1262 | daddr = ip_hdr(skb)->daddr; | ||
1263 | |||
1259 | if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) | 1264 | if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) |
1260 | return __udp4_lib_mcast_deliver(net, skb, uh, | 1265 | return __udp4_lib_mcast_deliver(net, skb, uh, |
1261 | saddr, daddr, udptable); | 1266 | saddr, daddr, udptable); |