diff options
-rw-r--r-- | net/ipv4/udp.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 144970704c2c..db313d964884 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -270,10 +270,10 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport, | |||
270 | struct sock *sk, *result = NULL; | 270 | struct sock *sk, *result = NULL; |
271 | struct hlist_node *node; | 271 | struct hlist_node *node; |
272 | unsigned int hash, hashwild; | 272 | unsigned int hash, hashwild; |
273 | int score, best = -1; | 273 | int score, best = -1, hport = ntohs(dport); |
274 | 274 | ||
275 | hash = hash_port_and_addr(ntohs(dport), daddr); | 275 | hash = hash_port_and_addr(hport, daddr); |
276 | hashwild = hash_port_and_addr(ntohs(dport), 0); | 276 | hashwild = hash_port_and_addr(hport, 0); |
277 | 277 | ||
278 | read_lock(&udp_hash_lock); | 278 | read_lock(&udp_hash_lock); |
279 | 279 | ||
@@ -283,7 +283,7 @@ lookup: | |||
283 | struct inet_sock *inet = inet_sk(sk); | 283 | struct inet_sock *inet = inet_sk(sk); |
284 | 284 | ||
285 | if (sk->sk_hash != hash || ipv6_only_sock(sk) || | 285 | if (sk->sk_hash != hash || ipv6_only_sock(sk) || |
286 | inet->num != dport) | 286 | inet->num != hport) |
287 | continue; | 287 | continue; |
288 | 288 | ||
289 | score = (sk->sk_family == PF_INET ? 1 : 0); | 289 | score = (sk->sk_family == PF_INET ? 1 : 0); |
@@ -327,11 +327,10 @@ found: | |||
327 | return result; | 327 | return result; |
328 | } | 328 | } |
329 | 329 | ||
330 | static inline struct sock *udp_v4_mcast_next( | 330 | static inline struct sock *udp_v4_mcast_next(struct sock *sk, unsigned int hnum, |
331 | struct sock *sk, | 331 | int hport, __be32 loc_addr, |
332 | unsigned int hnum, __be16 loc_port, __be32 loc_addr, | 332 | __be16 rmt_port, __be32 rmt_addr, |
333 | __be16 rmt_port, __be32 rmt_addr, | 333 | int dif) |
334 | int dif) | ||
335 | { | 334 | { |
336 | struct hlist_node *node; | 335 | struct hlist_node *node; |
337 | struct sock *s = sk; | 336 | struct sock *s = sk; |
@@ -340,7 +339,7 @@ static inline struct sock *udp_v4_mcast_next( | |||
340 | struct inet_sock *inet = inet_sk(s); | 339 | struct inet_sock *inet = inet_sk(s); |
341 | 340 | ||
342 | if (s->sk_hash != hnum || | 341 | if (s->sk_hash != hnum || |
343 | inet->num != loc_port || | 342 | inet->num != hport || |
344 | (inet->daddr && inet->daddr != rmt_addr) || | 343 | (inet->daddr && inet->daddr != rmt_addr) || |
345 | (inet->dport != rmt_port && inet->dport) || | 344 | (inet->dport != rmt_port && inet->dport) || |
346 | (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || | 345 | (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || |
@@ -1173,8 +1172,9 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb, | |||
1173 | { | 1172 | { |
1174 | struct sock *sk, *skw, *sknext; | 1173 | struct sock *sk, *skw, *sknext; |
1175 | int dif; | 1174 | int dif; |
1176 | unsigned int hash = hash_port_and_addr(ntohs(uh->dest), daddr); | 1175 | int hport = ntohs(uh->dest); |
1177 | unsigned int hashwild = hash_port_and_addr(ntohs(uh->dest), 0); | 1176 | unsigned int hash = hash_port_and_addr(hport, daddr); |
1177 | unsigned int hashwild = hash_port_and_addr(hport, 0); | ||
1178 | 1178 | ||
1179 | dif = skb->dev->ifindex; | 1179 | dif = skb->dev->ifindex; |
1180 | 1180 | ||
@@ -1183,20 +1183,20 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb, | |||
1183 | sk = sk_head(&udptable[hash & (UDP_HTABLE_SIZE - 1)]); | 1183 | sk = sk_head(&udptable[hash & (UDP_HTABLE_SIZE - 1)]); |
1184 | skw = sk_head(&udptable[hashwild & (UDP_HTABLE_SIZE - 1)]); | 1184 | skw = sk_head(&udptable[hashwild & (UDP_HTABLE_SIZE - 1)]); |
1185 | 1185 | ||
1186 | sk = udp_v4_mcast_next(sk, hash, uh->dest, daddr, uh->source, saddr, dif); | 1186 | sk = udp_v4_mcast_next(sk, hash, hport, daddr, uh->source, saddr, dif); |
1187 | if (!sk) { | 1187 | if (!sk) { |
1188 | hash = hashwild; | 1188 | hash = hashwild; |
1189 | sk = udp_v4_mcast_next(skw, hash, uh->dest, daddr, uh->source, | 1189 | sk = udp_v4_mcast_next(skw, hash, hport, daddr, uh->source, |
1190 | saddr, dif); | 1190 | saddr, dif); |
1191 | } | 1191 | } |
1192 | if (sk) { | 1192 | if (sk) { |
1193 | do { | 1193 | do { |
1194 | struct sk_buff *skb1 = skb; | 1194 | struct sk_buff *skb1 = skb; |
1195 | sknext = udp_v4_mcast_next(sk_next(sk), hash, uh->dest, | 1195 | sknext = udp_v4_mcast_next(sk_next(sk), hash, hport, |
1196 | daddr, uh->source, saddr, dif); | 1196 | daddr, uh->source, saddr, dif); |
1197 | if (!sknext && hash != hashwild) { | 1197 | if (!sknext && hash != hashwild) { |
1198 | hash = hashwild; | 1198 | hash = hashwild; |
1199 | sknext = udp_v4_mcast_next(skw, hash, uh->dest, | 1199 | sknext = udp_v4_mcast_next(skw, hash, hport, |
1200 | daddr, uh->source, saddr, dif); | 1200 | daddr, uh->source, saddr, dif); |
1201 | } | 1201 | } |
1202 | if (sknext) | 1202 | if (sknext) |
@@ -1295,7 +1295,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1295 | return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); | 1295 | return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); |
1296 | 1296 | ||
1297 | sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest, | 1297 | sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest, |
1298 | skb->dev->ifindex, udptable ); | 1298 | skb->dev->ifindex, udptable); |
1299 | 1299 | ||
1300 | if (sk != NULL) { | 1300 | if (sk != NULL) { |
1301 | int ret = udp_queue_rcv_skb(sk, skb); | 1301 | int ret = udp_queue_rcv_skb(sk, skb); |