aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-12-16 05:23:45 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-12-16 05:23:45 -0500
commitc4de673b775e4db48cd2db6277e0c6714332ca0c (patch)
tree84f9e4728e6ccf257236d2ba063b6e784ec8b65d /net/sctp
parentbafdc614a1f4f8be8cde41b8ab10ac17e67c1837 (diff)
parent55957fb7a0b61d8ab6ff3f04e279b8fc22b738fa (diff)
Merge remote-tracking branch 'wireless-next/master' into mac80211-next
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/associola.c10
-rw-r--r--net/sctp/auth.c14
-rw-r--r--net/sctp/chunk.c2
-rw-r--r--net/sctp/ipv6.c26
-rw-r--r--net/sctp/objcnt.c9
-rw-r--r--net/sctp/output.c12
-rw-r--r--net/sctp/sm_make_chunk.c29
-rw-r--r--net/sctp/sm_sideeffect.c1
-rw-r--r--net/sctp/socket.c2
9 files changed, 43 insertions, 62 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index cef509985192..68a27f9796d2 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -602,7 +602,7 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,
602 602
603 /* Start a T3 timer here in case it wasn't running so 603 /* Start a T3 timer here in case it wasn't running so
604 * that these migrated packets have a chance to get 604 * that these migrated packets have a chance to get
605 * retrnasmitted. 605 * retransmitted.
606 */ 606 */
607 if (!timer_pending(&active->T3_rtx_timer)) 607 if (!timer_pending(&active->T3_rtx_timer))
608 if (!mod_timer(&active->T3_rtx_timer, 608 if (!mod_timer(&active->T3_rtx_timer,
@@ -665,7 +665,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
665 /* Set the path max_retrans. */ 665 /* Set the path max_retrans. */
666 peer->pathmaxrxt = asoc->pathmaxrxt; 666 peer->pathmaxrxt = asoc->pathmaxrxt;
667 667
668 /* And the partial failure retrnas threshold */ 668 /* And the partial failure retrans threshold */
669 peer->pf_retrans = asoc->pf_retrans; 669 peer->pf_retrans = asoc->pf_retrans;
670 670
671 /* Initialize the peer's SACK delay timeout based on the 671 /* Initialize the peer's SACK delay timeout based on the
@@ -907,8 +907,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
907 if (!first || t->last_time_heard > first->last_time_heard) { 907 if (!first || t->last_time_heard > first->last_time_heard) {
908 second = first; 908 second = first;
909 first = t; 909 first = t;
910 } 910 } else if (!second ||
911 if (!second || t->last_time_heard > second->last_time_heard) 911 t->last_time_heard > second->last_time_heard)
912 second = t; 912 second = t;
913 } 913 }
914 914
@@ -929,6 +929,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
929 first = asoc->peer.primary_path; 929 first = asoc->peer.primary_path;
930 } 930 }
931 931
932 if (!second)
933 second = first;
932 /* If we failed to find a usable transport, just camp on the 934 /* If we failed to find a usable transport, just camp on the
933 * primary, even if it is inactive. 935 * primary, even if it is inactive.
934 */ 936 */
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 8c4fa5dec824..46b5977978a1 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -539,18 +539,14 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc)
539 for (i = 0; i < n_elt; i++) { 539 for (i = 0; i < n_elt; i++) {
540 id = ntohs(hmacs->hmac_ids[i]); 540 id = ntohs(hmacs->hmac_ids[i]);
541 541
542 /* Check the id is in the supported range */ 542 /* Check the id is in the supported range. And
543 if (id > SCTP_AUTH_HMAC_ID_MAX) { 543 * see if we support the id. Supported IDs have name and
544 id = 0; 544 * length fields set, so that we can allocate and use
545 continue;
546 }
547
548 /* See is we support the id. Supported IDs have name and
549 * length fields set, so that we can allocated and use
550 * them. We can safely just check for name, for without the 545 * them. We can safely just check for name, for without the
551 * name, we can't allocate the TFM. 546 * name, we can't allocate the TFM.
552 */ 547 */
553 if (!sctp_hmac_list[id].hmac_name) { 548 if (id > SCTP_AUTH_HMAC_ID_MAX ||
549 !sctp_hmac_list[id].hmac_name) {
554 id = 0; 550 id = 0;
555 continue; 551 continue;
556 } 552 }
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
index 7bd5ed4a8657..f2044fcb9dd1 100644
--- a/net/sctp/chunk.c
+++ b/net/sctp/chunk.c
@@ -201,7 +201,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
201 201
202 max = asoc->frag_point; 202 max = asoc->frag_point;
203 /* If the the peer requested that we authenticate DATA chunks 203 /* If the the peer requested that we authenticate DATA chunks
204 * we need to accound for bundling of the AUTH chunks along with 204 * we need to account for bundling of the AUTH chunks along with
205 * DATA. 205 * DATA.
206 */ 206 */
207 if (sctp_auth_send_cid(SCTP_CID_DATA, asoc)) { 207 if (sctp_auth_send_cid(SCTP_CID_DATA, asoc)) {
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index e7b2d4fe2b6a..7567e6f1a920 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -279,7 +279,9 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
279 sctp_v6_to_addr(&dst_saddr, &fl6->saddr, htons(bp->port)); 279 sctp_v6_to_addr(&dst_saddr, &fl6->saddr, htons(bp->port));
280 rcu_read_lock(); 280 rcu_read_lock();
281 list_for_each_entry_rcu(laddr, &bp->address_list, list) { 281 list_for_each_entry_rcu(laddr, &bp->address_list, list) {
282 if (!laddr->valid || (laddr->state != SCTP_ADDR_SRC)) 282 if (!laddr->valid || laddr->state == SCTP_ADDR_DEL ||
283 (laddr->state != SCTP_ADDR_SRC &&
284 !asoc->src_out_of_asoc_ok))
283 continue; 285 continue;
284 286
285 /* Do not compare against v4 addrs */ 287 /* Do not compare against v4 addrs */
@@ -426,20 +428,20 @@ static void sctp_v6_from_sk(union sctp_addr *addr, struct sock *sk)
426{ 428{
427 addr->v6.sin6_family = AF_INET6; 429 addr->v6.sin6_family = AF_INET6;
428 addr->v6.sin6_port = 0; 430 addr->v6.sin6_port = 0;
429 addr->v6.sin6_addr = inet6_sk(sk)->rcv_saddr; 431 addr->v6.sin6_addr = sk->sk_v6_rcv_saddr;
430} 432}
431 433
432/* Initialize sk->sk_rcv_saddr from sctp_addr. */ 434/* Initialize sk->sk_rcv_saddr from sctp_addr. */
433static void sctp_v6_to_sk_saddr(union sctp_addr *addr, struct sock *sk) 435static void sctp_v6_to_sk_saddr(union sctp_addr *addr, struct sock *sk)
434{ 436{
435 if (addr->sa.sa_family == AF_INET && sctp_sk(sk)->v4mapped) { 437 if (addr->sa.sa_family == AF_INET && sctp_sk(sk)->v4mapped) {
436 inet6_sk(sk)->rcv_saddr.s6_addr32[0] = 0; 438 sk->sk_v6_rcv_saddr.s6_addr32[0] = 0;
437 inet6_sk(sk)->rcv_saddr.s6_addr32[1] = 0; 439 sk->sk_v6_rcv_saddr.s6_addr32[1] = 0;
438 inet6_sk(sk)->rcv_saddr.s6_addr32[2] = htonl(0x0000ffff); 440 sk->sk_v6_rcv_saddr.s6_addr32[2] = htonl(0x0000ffff);
439 inet6_sk(sk)->rcv_saddr.s6_addr32[3] = 441 sk->sk_v6_rcv_saddr.s6_addr32[3] =
440 addr->v4.sin_addr.s_addr; 442 addr->v4.sin_addr.s_addr;
441 } else { 443 } else {
442 inet6_sk(sk)->rcv_saddr = addr->v6.sin6_addr; 444 sk->sk_v6_rcv_saddr = addr->v6.sin6_addr;
443 } 445 }
444} 446}
445 447
@@ -447,12 +449,12 @@ static void sctp_v6_to_sk_saddr(union sctp_addr *addr, struct sock *sk)
447static void sctp_v6_to_sk_daddr(union sctp_addr *addr, struct sock *sk) 449static void sctp_v6_to_sk_daddr(union sctp_addr *addr, struct sock *sk)
448{ 450{
449 if (addr->sa.sa_family == AF_INET && sctp_sk(sk)->v4mapped) { 451 if (addr->sa.sa_family == AF_INET && sctp_sk(sk)->v4mapped) {
450 inet6_sk(sk)->daddr.s6_addr32[0] = 0; 452 sk->sk_v6_daddr.s6_addr32[0] = 0;
451 inet6_sk(sk)->daddr.s6_addr32[1] = 0; 453 sk->sk_v6_daddr.s6_addr32[1] = 0;
452 inet6_sk(sk)->daddr.s6_addr32[2] = htonl(0x0000ffff); 454 sk->sk_v6_daddr.s6_addr32[2] = htonl(0x0000ffff);
453 inet6_sk(sk)->daddr.s6_addr32[3] = addr->v4.sin_addr.s_addr; 455 sk->sk_v6_daddr.s6_addr32[3] = addr->v4.sin_addr.s_addr;
454 } else { 456 } else {
455 inet6_sk(sk)->daddr = addr->v6.sin6_addr; 457 sk->sk_v6_daddr = addr->v6.sin6_addr;
456 } 458 }
457} 459}
458 460
diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c
index 5ea573b37648..647396baa56f 100644
--- a/net/sctp/objcnt.c
+++ b/net/sctp/objcnt.c
@@ -79,12 +79,13 @@ static sctp_dbg_objcnt_entry_t sctp_dbg_objcnt[] = {
79 */ 79 */
80static int sctp_objcnt_seq_show(struct seq_file *seq, void *v) 80static int sctp_objcnt_seq_show(struct seq_file *seq, void *v)
81{ 81{
82 int i, len; 82 int i;
83 83
84 i = (int)*(loff_t *)v; 84 i = (int)*(loff_t *)v;
85 seq_printf(seq, "%s: %d%n", sctp_dbg_objcnt[i].label, 85 seq_setwidth(seq, 127);
86 atomic_read(sctp_dbg_objcnt[i].counter), &len); 86 seq_printf(seq, "%s: %d", sctp_dbg_objcnt[i].label,
87 seq_printf(seq, "%*s\n", 127 - len, ""); 87 atomic_read(sctp_dbg_objcnt[i].counter));
88 seq_pad(seq, '\n');
88 return 0; 89 return 0;
89} 90}
90 91
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 0ac3a65daccb..e650978daf27 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -390,7 +390,6 @@ int sctp_packet_transmit(struct sctp_packet *packet)
390 __u8 has_data = 0; 390 __u8 has_data = 0;
391 struct dst_entry *dst = tp->dst; 391 struct dst_entry *dst = tp->dst;
392 unsigned char *auth = NULL; /* pointer to auth in skb data */ 392 unsigned char *auth = NULL; /* pointer to auth in skb data */
393 __u32 cksum_buf_len = sizeof(struct sctphdr);
394 393
395 pr_debug("%s: packet:%p\n", __func__, packet); 394 pr_debug("%s: packet:%p\n", __func__, packet);
396 395
@@ -493,7 +492,6 @@ int sctp_packet_transmit(struct sctp_packet *packet)
493 if (chunk == packet->auth) 492 if (chunk == packet->auth)
494 auth = skb_tail_pointer(nskb); 493 auth = skb_tail_pointer(nskb);
495 494
496 cksum_buf_len += chunk->skb->len;
497 memcpy(skb_put(nskb, chunk->skb->len), 495 memcpy(skb_put(nskb, chunk->skb->len),
498 chunk->skb->data, chunk->skb->len); 496 chunk->skb->data, chunk->skb->len);
499 497
@@ -536,13 +534,9 @@ int sctp_packet_transmit(struct sctp_packet *packet)
536 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>. 534 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>.
537 */ 535 */
538 if (!sctp_checksum_disable) { 536 if (!sctp_checksum_disable) {
539 if (!(dst->dev->features & NETIF_F_SCTP_CSUM)) { 537 if (!(dst->dev->features & NETIF_F_SCTP_CSUM) ||
540 __u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len); 538 (dst_xfrm(dst) != NULL) || packet->ipfragok) {
541 539 sh->checksum = sctp_compute_cksum(nskb, 0);
542 /* 3) Put the resultant value into the checksum field in the
543 * common header, and leave the rest of the bits unchanged.
544 */
545 sh->checksum = sctp_end_cksum(crc32);
546 } else { 540 } else {
547 /* no need to seed pseudo checksum for SCTP */ 541 /* no need to seed pseudo checksum for SCTP */
548 nskb->ip_summed = CHECKSUM_PARTIAL; 542 nskb->ip_summed = CHECKSUM_PARTIAL;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index d244a23ab8d3..fe690320b1e4 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1297,6 +1297,13 @@ struct sctp_chunk *sctp_make_auth(const struct sctp_association *asoc)
1297 1297
1298/* Turn an skb into a chunk. 1298/* Turn an skb into a chunk.
1299 * FIXME: Eventually move the structure directly inside the skb->cb[]. 1299 * FIXME: Eventually move the structure directly inside the skb->cb[].
1300 *
1301 * sctpimpguide-05.txt Section 2.8.2
1302 * M1) Each time a new DATA chunk is transmitted
1303 * set the 'TSN.Missing.Report' count for that TSN to 0. The
1304 * 'TSN.Missing.Report' count will be used to determine missing chunks
1305 * and when to fast retransmit.
1306 *
1300 */ 1307 */
1301struct sctp_chunk *sctp_chunkify(struct sk_buff *skb, 1308struct sctp_chunk *sctp_chunkify(struct sk_buff *skb,
1302 const struct sctp_association *asoc, 1309 const struct sctp_association *asoc,
@@ -1314,29 +1321,9 @@ struct sctp_chunk *sctp_chunkify(struct sk_buff *skb,
1314 INIT_LIST_HEAD(&retval->list); 1321 INIT_LIST_HEAD(&retval->list);
1315 retval->skb = skb; 1322 retval->skb = skb;
1316 retval->asoc = (struct sctp_association *)asoc; 1323 retval->asoc = (struct sctp_association *)asoc;
1317 retval->has_tsn = 0;
1318 retval->has_ssn = 0;
1319 retval->rtt_in_progress = 0;
1320 retval->sent_at = 0;
1321 retval->singleton = 1; 1324 retval->singleton = 1;
1322 retval->end_of_packet = 0;
1323 retval->ecn_ce_done = 0;
1324 retval->pdiscard = 0;
1325
1326 /* sctpimpguide-05.txt Section 2.8.2
1327 * M1) Each time a new DATA chunk is transmitted
1328 * set the 'TSN.Missing.Report' count for that TSN to 0. The
1329 * 'TSN.Missing.Report' count will be used to determine missing chunks
1330 * and when to fast retransmit.
1331 */
1332 retval->tsn_missing_report = 0;
1333 retval->tsn_gap_acked = 0;
1334 retval->fast_retransmit = SCTP_CAN_FRTX;
1335 1325
1336 /* If this is a fragmented message, track all fragments 1326 retval->fast_retransmit = SCTP_CAN_FRTX;
1337 * of the message (for SEND_FAILED).
1338 */
1339 retval->msg = NULL;
1340 1327
1341 /* Polish the bead hole. */ 1328 /* Polish the bead hole. */
1342 INIT_LIST_HEAD(&retval->transmitted_list); 1329 INIT_LIST_HEAD(&retval->transmitted_list);
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 666c66842799..1a6eef39ab2f 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -860,7 +860,6 @@ static void sctp_cmd_delete_tcb(sctp_cmd_seq_t *cmds,
860 (!asoc->temp) && (sk->sk_shutdown != SHUTDOWN_MASK)) 860 (!asoc->temp) && (sk->sk_shutdown != SHUTDOWN_MASK))
861 return; 861 return;
862 862
863 BUG_ON(asoc->peer.primary_path == NULL);
864 sctp_unhash_established(asoc); 863 sctp_unhash_established(asoc);
865 sctp_association_free(asoc); 864 sctp_association_free(asoc);
866} 865}
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 911b71b26b0e..72046b9729a8 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5890,7 +5890,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
5890 int low, high, remaining, index; 5890 int low, high, remaining, index;
5891 unsigned int rover; 5891 unsigned int rover;
5892 5892
5893 inet_get_local_port_range(&low, &high); 5893 inet_get_local_port_range(sock_net(sk), &low, &high);
5894 remaining = (high - low) + 1; 5894 remaining = (high - low) + 1;
5895 rover = net_random() % remaining + low; 5895 rover = net_random() % remaining + low;
5896 5896