From owner-svn-src-stable-10@FreeBSD.ORG Thu Sep 18 09:49:52 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D64BDAA4; Thu, 18 Sep 2014 09:49:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDF2F9AE; Thu, 18 Sep 2014 09:49:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8I9np81031025; Thu, 18 Sep 2014 09:49:51 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8I9nnbE031005; Thu, 18 Sep 2014 09:49:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201409180949.s8I9nnbE031005@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 18 Sep 2014 09:49:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r271750 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2014 09:49:52 -0000 Author: tuexen Date: Thu Sep 18 09:49:49 2014 New Revision: 271750 URL: http://svnweb.freebsd.org/changeset/base/271750 Log: MFC r271643: Chunk IDs are 8 bit entities, not 16 bit. Thanks to Peter Kasting from Google for drawing my attention to it. MFC r271665: The MTU is handled as a 32-bit entity within the SCTP stack. This was reported by Peter Kasting from Google. MFC r271670: Make a type conversion explicit. When compiling this code on Windows as part of the SCTP userland stack, this fixes a warning reported by Peter Kasting from Google. MFC r271672: Small cleanup which addresses a warning regaring the truncation of a 64-bit entity to a 32-bit entity. This issue was reported by Peter Kasting from Google. MFC r271673: Use a consistent type for the number of HMAC algorithms. This fixes a bug which resulted in a warning on the userland stack, when compiled on Windows. Thanks to Peter Kasting from Google for reporting the issue and provinding a potential fix. MFC r271674: Add a explict cast to silence a warning when building the userland stack on Windows. This issue was reported by Peter Kasting from Google. Approved by: re (kib) Modified: stable/10/sys/netinet/sctp_auth.c stable/10/sys/netinet/sctp_auth.h stable/10/sys/netinet/sctp_cc_functions.c stable/10/sys/netinet/sctp_os_bsd.h stable/10/sys/netinet/sctp_output.c stable/10/sys/netinet/sctp_pcb.c stable/10/sys/netinet/sctp_structs.h stable/10/sys/netinet/sctp_usrreq.c stable/10/sys/netinet/sctputil.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_auth.c ============================================================================== --- stable/10/sys/netinet/sctp_auth.c Thu Sep 18 09:22:37 2014 (r271749) +++ stable/10/sys/netinet/sctp_auth.c Thu Sep 18 09:49:49 2014 (r271750) @@ -631,7 +631,7 @@ sctp_copy_skeylist(const struct sctp_key sctp_hmaclist_t * -sctp_alloc_hmaclist(uint8_t num_hmacs) +sctp_alloc_hmaclist(uint16_t num_hmacs) { sctp_hmaclist_t *new_list; int alloc_size; @@ -1438,8 +1438,8 @@ sctp_auth_get_cookie_params(struct sctp_ p_random = (struct sctp_auth_random *)phdr; random_len = plen - sizeof(*p_random); } else if (ptype == SCTP_HMAC_LIST) { - int num_hmacs; - int i; + uint16_t num_hmacs; + uint16_t i; if (plen > sizeof(hmacs_store)) break; Modified: stable/10/sys/netinet/sctp_auth.h ============================================================================== --- stable/10/sys/netinet/sctp_auth.h Thu Sep 18 09:22:37 2014 (r271749) +++ stable/10/sys/netinet/sctp_auth.h Thu Sep 18 09:49:49 2014 (r271750) @@ -154,7 +154,7 @@ sctp_auth_key_release(struct sctp_tcb *s /* hmac list handling */ -extern sctp_hmaclist_t *sctp_alloc_hmaclist(uint8_t num_hmacs); +extern sctp_hmaclist_t *sctp_alloc_hmaclist(uint16_t num_hmacs); extern void sctp_free_hmaclist(sctp_hmaclist_t * list); extern int sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id); extern sctp_hmaclist_t *sctp_copy_hmaclist(sctp_hmaclist_t * list); Modified: stable/10/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/10/sys/netinet/sctp_cc_functions.c Thu Sep 18 09:22:37 2014 (r271749) +++ stable/10/sys/netinet/sctp_cc_functions.c Thu Sep 18 09:49:49 2014 (r271750) @@ -1130,12 +1130,9 @@ sctp_cwnd_update_after_packet_dropped(st uint32_t * bottle_bw, uint32_t * on_queue) { uint32_t bw_avail; - int rtt; unsigned int incr; int old_cwnd = net->cwnd; - /* need real RTT in msd for this calc */ - rtt = net->rtt / 1000; /* get bottle neck bw */ *bottle_bw = ntohl(cp->bottle_bw); /* and whats on queue */ @@ -1144,10 +1141,11 @@ sctp_cwnd_update_after_packet_dropped(st * adjust the on-queue if our flight is more it could be that the * router has not yet gotten data "in-flight" to it */ - if (*on_queue < net->flight_size) + if (*on_queue < net->flight_size) { *on_queue = net->flight_size; - /* calculate the available space */ - bw_avail = (*bottle_bw * rtt) / 1000; + } + /* rtt is measured in micro seconds, bottle_bw in bytes per second */ + bw_avail = (uint32_t) (((uint64_t) (*bottle_bw) * net->rtt) / (uint64_t) 1000000); if (bw_avail > *bottle_bw) { /* * Cap the growth to no more than the bottle neck. This can @@ -1167,7 +1165,6 @@ sctp_cwnd_update_after_packet_dropped(st int seg_inflight, seg_onqueue, my_portion; net->partial_bytes_acked = 0; - /* how much are we over queue size? */ incr = *on_queue - bw_avail; if (stcb->asoc.seen_a_sack_this_pkt) { Modified: stable/10/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/10/sys/netinet/sctp_os_bsd.h Thu Sep 18 09:22:37 2014 (r271749) +++ stable/10/sys/netinet/sctp_os_bsd.h Thu Sep 18 09:49:49 2014 (r271750) @@ -322,7 +322,7 @@ typedef struct callout sctp_os_timer_t; /* MTU */ /*************************/ #define SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index, af) ((struct ifnet *)ifn)->if_mtu -#define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, rt) ((rt != NULL) ? rt->rt_mtu : 0) +#define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, rt) ((uint32_t)((rt != NULL) ? rt->rt_mtu : 0)) #define SCTP_GATHER_MTU_FROM_INTFC(sctp_ifn) ((sctp_ifn->ifn_p != NULL) ? ((struct ifnet *)(sctp_ifn->ifn_p))->if_mtu : 0) #define SCTP_SET_MTU_OF_ROUTE(sa, rt, mtu) do { \ if (rt != NULL) \ Modified: stable/10/sys/netinet/sctp_output.c ============================================================================== --- stable/10/sys/netinet/sctp_output.c Thu Sep 18 09:22:37 2014 (r271749) +++ stable/10/sys/netinet/sctp_output.c Thu Sep 18 09:49:49 2014 (r271750) @@ -11301,7 +11301,7 @@ sctp_send_hb(struct sctp_tcb *stcb, stru hb->heartbeat.hb_info.time_value_1 = now.tv_sec; hb->heartbeat.hb_info.time_value_2 = now.tv_usec; /* Did our user request this one, put it in */ - hb->heartbeat.hb_info.addr_family = net->ro._l_addr.sa.sa_family; + hb->heartbeat.hb_info.addr_family = (uint8_t) net->ro._l_addr.sa.sa_family; hb->heartbeat.hb_info.addr_len = net->ro._l_addr.sa.sa_len; if (net->dest_state & SCTP_ADDR_UNCONFIRMED) { /* Modified: stable/10/sys/netinet/sctp_pcb.c ============================================================================== --- stable/10/sys/netinet/sctp_pcb.c Thu Sep 18 09:22:37 2014 (r271749) +++ stable/10/sys/netinet/sctp_pcb.c Thu Sep 18 09:49:49 2014 (r271750) @@ -6513,8 +6513,8 @@ sctp_load_addresses_from_init(struct sct } got_random = 1; } else if (ptype == SCTP_HMAC_LIST) { - int num_hmacs; - int i; + uint16_t num_hmacs; + uint16_t i; if (plen > sizeof(hmacs_store)) break; Modified: stable/10/sys/netinet/sctp_structs.h ============================================================================== --- stable/10/sys/netinet/sctp_structs.h Thu Sep 18 09:22:37 2014 (r271749) +++ stable/10/sys/netinet/sctp_structs.h Thu Sep 18 09:49:49 2014 (r271750) @@ -418,8 +418,8 @@ TAILQ_HEAD(sctpchunk_listhead, sctp_tmit #define CHUNK_FLAGS_FRAGMENT_OK 0x0100 struct chk_id { - uint16_t id; - uint16_t can_take_data; + uint8_t id; + uint8_t can_take_data; }; Modified: stable/10/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/10/sys/netinet/sctp_usrreq.c Thu Sep 18 09:22:37 2014 (r271749) +++ stable/10/sys/netinet/sctp_usrreq.c Thu Sep 18 09:49:49 2014 (r271750) @@ -4208,12 +4208,13 @@ sctp_setopt(struct socket *so, int optna uint32_t i; SCTP_CHECK_AND_CAST(shmac, optval, struct sctp_hmacalgo, optsize); - if (optsize < sizeof(struct sctp_hmacalgo) + shmac->shmac_number_of_idents * sizeof(uint16_t)) { + if ((optsize < sizeof(struct sctp_hmacalgo) + shmac->shmac_number_of_idents * sizeof(uint16_t)) || + (shmac->shmac_number_of_idents > 0xffff)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; } - hmaclist = sctp_alloc_hmaclist(shmac->shmac_number_of_idents); + hmaclist = sctp_alloc_hmaclist((uint16_t) shmac->shmac_number_of_idents); if (hmaclist == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM); error = ENOMEM; Modified: stable/10/sys/netinet/sctputil.c ============================================================================== --- stable/10/sys/netinet/sctputil.c Thu Sep 18 09:22:37 2014 (r271749) +++ stable/10/sys/netinet/sctputil.c Thu Sep 18 09:49:49 2014 (r271750) @@ -2403,8 +2403,8 @@ sctp_calculate_rto(struct sctp_tcb *stcb net->rtt = (uint64_t) 1000000 *(uint64_t) now.tv_sec + (uint64_t) now.tv_usec; - /* computer rtt in ms */ - rtt = net->rtt / 1000; + /* compute rtt in ms */ + rtt = (int32_t) (net->rtt / 1000); if ((asoc->cc_functions.sctp_rtt_calculated) && (rtt_from_sack == SCTP_RTT_FROM_DATA)) { /* * Tell the CC module that a new update has just occurred