diff options
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/ipv6.c | 27 | ||||
-rw-r--r-- | net/sctp/protocol.c | 2 | ||||
-rw-r--r-- | net/sctp/socket.c | 37 |
3 files changed, 26 insertions, 40 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 9fb5d37c37ad..732689140fb8 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -232,7 +232,7 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport) | |||
232 | if (!(transport->param_flags & SPP_PMTUD_ENABLE)) | 232 | if (!(transport->param_flags & SPP_PMTUD_ENABLE)) |
233 | skb->local_df = 1; | 233 | skb->local_df = 1; |
234 | 234 | ||
235 | return ip6_xmit(sk, skb, &fl, np->opt, 0); | 235 | return ip6_xmit(sk, skb, &fl, np->opt); |
236 | } | 236 | } |
237 | 237 | ||
238 | /* Returns the dst cache entry for the given source and destination ip | 238 | /* Returns the dst cache entry for the given source and destination ip |
@@ -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/protocol.c b/net/sctp/protocol.c index a56f98e82f92..704298f4b284 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -854,7 +854,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
854 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; | 854 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; |
855 | 855 | ||
856 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); | 856 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); |
857 | return ip_queue_xmit(skb, 0); | 857 | return ip_queue_xmit(skb); |
858 | } | 858 | } |
859 | 859 | ||
860 | static struct sctp_af sctp_af_inet; | 860 | static struct sctp_af sctp_af_inet; |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 44a1ab03a3f0..bae764005d2d 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -3720,9 +3720,6 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) | |||
3720 | 3720 | ||
3721 | SCTP_DBG_OBJCNT_INC(sock); | 3721 | SCTP_DBG_OBJCNT_INC(sock); |
3722 | 3722 | ||
3723 | /* Set socket backlog limit. */ | ||
3724 | sk->sk_backlog.limit = sysctl_sctp_rmem[1]; | ||
3725 | |||
3726 | local_bh_disable(); | 3723 | local_bh_disable(); |
3727 | percpu_counter_inc(&sctp_sockets_allocated); | 3724 | percpu_counter_inc(&sctp_sockets_allocated); |
3728 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); | 3725 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); |
@@ -5482,7 +5479,6 @@ pp_found: | |||
5482 | */ | 5479 | */ |
5483 | int reuse = sk->sk_reuse; | 5480 | int reuse = sk->sk_reuse; |
5484 | struct sock *sk2; | 5481 | struct sock *sk2; |
5485 | struct hlist_node *node; | ||
5486 | 5482 | ||
5487 | SCTP_DEBUG_PRINTK("sctp_get_port() found a possible match\n"); | 5483 | SCTP_DEBUG_PRINTK("sctp_get_port() found a possible match\n"); |
5488 | if (pp->fastreuse && sk->sk_reuse && | 5484 | if (pp->fastreuse && sk->sk_reuse && |
@@ -5703,7 +5699,7 @@ unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
5703 | struct sctp_sock *sp = sctp_sk(sk); | 5699 | struct sctp_sock *sp = sctp_sk(sk); |
5704 | unsigned int mask; | 5700 | unsigned int mask; |
5705 | 5701 | ||
5706 | poll_wait(file, sk->sk_sleep, wait); | 5702 | poll_wait(file, sk_sleep(sk), wait); |
5707 | 5703 | ||
5708 | /* A TCP-style listening socket becomes readable when the accept queue | 5704 | /* A TCP-style listening socket becomes readable when the accept queue |
5709 | * is not empty. | 5705 | * is not empty. |
@@ -5944,7 +5940,7 @@ static int sctp_wait_for_packet(struct sock * sk, int *err, long *timeo_p) | |||
5944 | int error; | 5940 | int error; |
5945 | DEFINE_WAIT(wait); | 5941 | DEFINE_WAIT(wait); |
5946 | 5942 | ||
5947 | prepare_to_wait_exclusive(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 5943 | prepare_to_wait_exclusive(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
5948 | 5944 | ||
5949 | /* Socket errors? */ | 5945 | /* Socket errors? */ |
5950 | error = sock_error(sk); | 5946 | error = sock_error(sk); |
@@ -5981,14 +5977,14 @@ static int sctp_wait_for_packet(struct sock * sk, int *err, long *timeo_p) | |||
5981 | sctp_lock_sock(sk); | 5977 | sctp_lock_sock(sk); |
5982 | 5978 | ||
5983 | ready: | 5979 | ready: |
5984 | finish_wait(sk->sk_sleep, &wait); | 5980 | finish_wait(sk_sleep(sk), &wait); |
5985 | return 0; | 5981 | return 0; |
5986 | 5982 | ||
5987 | interrupted: | 5983 | interrupted: |
5988 | error = sock_intr_errno(*timeo_p); | 5984 | error = sock_intr_errno(*timeo_p); |
5989 | 5985 | ||
5990 | out: | 5986 | out: |
5991 | finish_wait(sk->sk_sleep, &wait); | 5987 | finish_wait(sk_sleep(sk), &wait); |
5992 | *err = error; | 5988 | *err = error; |
5993 | return error; | 5989 | return error; |
5994 | } | 5990 | } |
@@ -6062,14 +6058,14 @@ static void __sctp_write_space(struct sctp_association *asoc) | |||
6062 | wake_up_interruptible(&asoc->wait); | 6058 | wake_up_interruptible(&asoc->wait); |
6063 | 6059 | ||
6064 | if (sctp_writeable(sk)) { | 6060 | if (sctp_writeable(sk)) { |
6065 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 6061 | if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk))) |
6066 | wake_up_interruptible(sk->sk_sleep); | 6062 | wake_up_interruptible(sk_sleep(sk)); |
6067 | 6063 | ||
6068 | /* Note that we try to include the Async I/O support | 6064 | /* Note that we try to include the Async I/O support |
6069 | * here by modeling from the current TCP/UDP code. | 6065 | * here by modeling from the current TCP/UDP code. |
6070 | * We have not tested with it yet. | 6066 | * We have not tested with it yet. |
6071 | */ | 6067 | */ |
6072 | if (sock->fasync_list && | 6068 | if (sock->wq->fasync_list && |
6073 | !(sk->sk_shutdown & SEND_SHUTDOWN)) | 6069 | !(sk->sk_shutdown & SEND_SHUTDOWN)) |
6074 | sock_wake_async(sock, | 6070 | sock_wake_async(sock, |
6075 | SOCK_WAKE_SPACE, POLL_OUT); | 6071 | SOCK_WAKE_SPACE, POLL_OUT); |
@@ -6191,12 +6187,15 @@ do_nonblock: | |||
6191 | 6187 | ||
6192 | void sctp_data_ready(struct sock *sk, int len) | 6188 | void sctp_data_ready(struct sock *sk, int len) |
6193 | { | 6189 | { |
6194 | read_lock_bh(&sk->sk_callback_lock); | 6190 | struct socket_wq *wq; |
6195 | if (sk_has_sleeper(sk)) | 6191 | |
6196 | wake_up_interruptible_sync_poll(sk->sk_sleep, POLLIN | | 6192 | rcu_read_lock(); |
6193 | wq = rcu_dereference(sk->sk_wq); | ||
6194 | if (wq_has_sleeper(wq)) | ||
6195 | wake_up_interruptible_sync_poll(&wq->wait, POLLIN | | ||
6197 | POLLRDNORM | POLLRDBAND); | 6196 | POLLRDNORM | POLLRDBAND); |
6198 | sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); | 6197 | sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); |
6199 | read_unlock_bh(&sk->sk_callback_lock); | 6198 | rcu_read_unlock(); |
6200 | } | 6199 | } |
6201 | 6200 | ||
6202 | /* If socket sndbuf has changed, wake up all per association waiters. */ | 6201 | /* If socket sndbuf has changed, wake up all per association waiters. */ |
@@ -6307,7 +6306,7 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo) | |||
6307 | 6306 | ||
6308 | 6307 | ||
6309 | for (;;) { | 6308 | for (;;) { |
6310 | prepare_to_wait_exclusive(sk->sk_sleep, &wait, | 6309 | prepare_to_wait_exclusive(sk_sleep(sk), &wait, |
6311 | TASK_INTERRUPTIBLE); | 6310 | TASK_INTERRUPTIBLE); |
6312 | 6311 | ||
6313 | if (list_empty(&ep->asocs)) { | 6312 | if (list_empty(&ep->asocs)) { |
@@ -6333,7 +6332,7 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo) | |||
6333 | break; | 6332 | break; |
6334 | } | 6333 | } |
6335 | 6334 | ||
6336 | finish_wait(sk->sk_sleep, &wait); | 6335 | finish_wait(sk_sleep(sk), &wait); |
6337 | 6336 | ||
6338 | return err; | 6337 | return err; |
6339 | } | 6338 | } |
@@ -6343,7 +6342,7 @@ static void sctp_wait_for_close(struct sock *sk, long timeout) | |||
6343 | DEFINE_WAIT(wait); | 6342 | DEFINE_WAIT(wait); |
6344 | 6343 | ||
6345 | do { | 6344 | do { |
6346 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 6345 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
6347 | if (list_empty(&sctp_sk(sk)->ep->asocs)) | 6346 | if (list_empty(&sctp_sk(sk)->ep->asocs)) |
6348 | break; | 6347 | break; |
6349 | sctp_release_sock(sk); | 6348 | sctp_release_sock(sk); |
@@ -6351,7 +6350,7 @@ static void sctp_wait_for_close(struct sock *sk, long timeout) | |||
6351 | sctp_lock_sock(sk); | 6350 | sctp_lock_sock(sk); |
6352 | } while (!signal_pending(current) && timeout); | 6351 | } while (!signal_pending(current) && timeout); |
6353 | 6352 | ||
6354 | finish_wait(sk->sk_sleep, &wait); | 6353 | finish_wait(sk_sleep(sk), &wait); |
6355 | } | 6354 | } |
6356 | 6355 | ||
6357 | static void sctp_skb_set_owner_r_frag(struct sk_buff *skb, struct sock *sk) | 6356 | static void sctp_skb_set_owner_r_frag(struct sk_buff *skb, struct sock *sk) |