diff options
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/ipv6.c | 25 | ||||
-rw-r--r-- | net/sctp/socket.c | 1 |
2 files changed, 6 insertions, 20 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 9fb5d37c37ad..14db5689fb89 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -277,20 +277,7 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc, | |||
277 | static inline int sctp_v6_addr_match_len(union sctp_addr *s1, | 277 | static inline int sctp_v6_addr_match_len(union sctp_addr *s1, |
278 | union sctp_addr *s2) | 278 | union sctp_addr *s2) |
279 | { | 279 | { |
280 | struct in6_addr *a1 = &s1->v6.sin6_addr; | 280 | return ipv6_addr_diff(&s1->v6.sin6_addr, &s2->v6.sin6_addr); |
281 | struct in6_addr *a2 = &s2->v6.sin6_addr; | ||
282 | int i, j; | ||
283 | |||
284 | for (i = 0; i < 4 ; i++) { | ||
285 | __be32 a1xora2; | ||
286 | |||
287 | a1xora2 = a1->s6_addr32[i] ^ a2->s6_addr32[i]; | ||
288 | |||
289 | if ((j = fls(ntohl(a1xora2)))) | ||
290 | return (i * 32 + 32 - j); | ||
291 | } | ||
292 | |||
293 | return (i*32); | ||
294 | } | 281 | } |
295 | 282 | ||
296 | /* Fills in the source address(saddr) based on the destination address(daddr) | 283 | /* Fills in the source address(saddr) based on the destination address(daddr) |
@@ -372,13 +359,13 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist, | |||
372 | } | 359 | } |
373 | 360 | ||
374 | read_lock_bh(&in6_dev->lock); | 361 | read_lock_bh(&in6_dev->lock); |
375 | for (ifp = in6_dev->addr_list; ifp; ifp = ifp->if_next) { | 362 | list_for_each_entry(ifp, &in6_dev->addr_list, if_list) { |
376 | /* Add the address to the local list. */ | 363 | /* Add the address to the local list. */ |
377 | addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC); | 364 | addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC); |
378 | if (addr) { | 365 | if (addr) { |
379 | addr->a.v6.sin6_family = AF_INET6; | 366 | addr->a.v6.sin6_family = AF_INET6; |
380 | addr->a.v6.sin6_port = 0; | 367 | addr->a.v6.sin6_port = 0; |
381 | addr->a.v6.sin6_addr = ifp->addr; | 368 | ipv6_addr_copy(&addr->a.v6.sin6_addr, &ifp->addr); |
382 | addr->a.v6.sin6_scope_id = dev->ifindex; | 369 | addr->a.v6.sin6_scope_id = dev->ifindex; |
383 | addr->valid = 1; | 370 | addr->valid = 1; |
384 | INIT_LIST_HEAD(&addr->list); | 371 | INIT_LIST_HEAD(&addr->list); |
@@ -419,7 +406,7 @@ static void sctp_v6_from_sk(union sctp_addr *addr, struct sock *sk) | |||
419 | { | 406 | { |
420 | addr->v6.sin6_family = AF_INET6; | 407 | addr->v6.sin6_family = AF_INET6; |
421 | addr->v6.sin6_port = 0; | 408 | addr->v6.sin6_port = 0; |
422 | addr->v6.sin6_addr = inet6_sk(sk)->rcv_saddr; | 409 | ipv6_addr_copy(&addr->v6.sin6_addr, &inet6_sk(sk)->rcv_saddr); |
423 | } | 410 | } |
424 | 411 | ||
425 | /* Initialize sk->sk_rcv_saddr from sctp_addr. */ | 412 | /* Initialize sk->sk_rcv_saddr from sctp_addr. */ |
@@ -432,7 +419,7 @@ static void sctp_v6_to_sk_saddr(union sctp_addr *addr, struct sock *sk) | |||
432 | inet6_sk(sk)->rcv_saddr.s6_addr32[3] = | 419 | inet6_sk(sk)->rcv_saddr.s6_addr32[3] = |
433 | addr->v4.sin_addr.s_addr; | 420 | addr->v4.sin_addr.s_addr; |
434 | } else { | 421 | } else { |
435 | inet6_sk(sk)->rcv_saddr = addr->v6.sin6_addr; | 422 | ipv6_addr_copy(&inet6_sk(sk)->rcv_saddr, &addr->v6.sin6_addr); |
436 | } | 423 | } |
437 | } | 424 | } |
438 | 425 | ||
@@ -445,7 +432,7 @@ static void sctp_v6_to_sk_daddr(union sctp_addr *addr, struct sock *sk) | |||
445 | inet6_sk(sk)->daddr.s6_addr32[2] = htonl(0x0000ffff); | 432 | inet6_sk(sk)->daddr.s6_addr32[2] = htonl(0x0000ffff); |
446 | inet6_sk(sk)->daddr.s6_addr32[3] = addr->v4.sin_addr.s_addr; | 433 | inet6_sk(sk)->daddr.s6_addr32[3] = addr->v4.sin_addr.s_addr; |
447 | } else { | 434 | } else { |
448 | inet6_sk(sk)->daddr = addr->v6.sin6_addr; | 435 | ipv6_addr_copy(&inet6_sk(sk)->daddr, &addr->v6.sin6_addr); |
449 | } | 436 | } |
450 | } | 437 | } |
451 | 438 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 007e8baba089..c1941276f6e3 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -5482,7 +5482,6 @@ pp_found: | |||
5482 | */ | 5482 | */ |
5483 | int reuse = sk->sk_reuse; | 5483 | int reuse = sk->sk_reuse; |
5484 | struct sock *sk2; | 5484 | struct sock *sk2; |
5485 | struct hlist_node *node; | ||
5486 | 5485 | ||
5487 | SCTP_DEBUG_PRINTK("sctp_get_port() found a possible match\n"); | 5486 | SCTP_DEBUG_PRINTK("sctp_get_port() found a possible match\n"); |
5488 | if (pp->fastreuse && sk->sk_reuse && | 5487 | if (pp->fastreuse && sk->sk_reuse && |