svn commit: r228037 - releng/9.0/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Sun Nov 27 19:13:46 UTC 2011


Author: tuexen
Date: Sun Nov 27 19:13:45 2011
New Revision: 228037
URL: http://svn.freebsd.org/changeset/base/228037

Log:
  MFC r228031:
  
  Fix a warning reported by arundel at .
  Fix a bug where the parameter length of a supported address types
  parameter is set to a wrong value if the kernel is built with
  with either INET or INET6, but not both.
  
  Approved by: re@

Modified:
  releng/9.0/sys/netinet/sctp_header.h
  releng/9.0/sys/netinet/sctp_output.c
Directory Properties:
  releng/9.0/sys/   (props changed)
  releng/9.0/sys/amd64/include/xen/   (props changed)
  releng/9.0/sys/boot/   (props changed)
  releng/9.0/sys/boot/i386/efi/   (props changed)
  releng/9.0/sys/boot/ia64/efi/   (props changed)
  releng/9.0/sys/boot/ia64/ski/   (props changed)
  releng/9.0/sys/boot/powerpc/boot1.chrp/   (props changed)
  releng/9.0/sys/boot/powerpc/ofw/   (props changed)
  releng/9.0/sys/cddl/contrib/opensolaris/   (props changed)
  releng/9.0/sys/conf/   (props changed)
  releng/9.0/sys/contrib/dev/acpica/   (props changed)
  releng/9.0/sys/contrib/octeon-sdk/   (props changed)
  releng/9.0/sys/contrib/pf/   (props changed)
  releng/9.0/sys/contrib/x86emu/   (props changed)

Modified: releng/9.0/sys/netinet/sctp_header.h
==============================================================================
--- releng/9.0/sys/netinet/sctp_header.h	Sun Nov 27 19:09:31 2011	(r228036)
+++ releng/9.0/sys/netinet/sctp_header.h	Sun Nov 27 19:13:45 2011	(r228037)
@@ -81,8 +81,7 @@ struct sctp_host_name_param {
 /* supported address type */
 struct sctp_supported_addr_param {
 	struct sctp_paramhdr ph;/* type=SCTP_SUPPORTED_ADDRTYPE */
-	uint16_t addr_type[SCTP_ARRAY_MIN_LEN];	/* array of supported address
-						 * types */
+	uint16_t addr_type[2];	/* array of supported address types */
 }                         SCTP_PACKED;
 
 /* ECN parameter */

Modified: releng/9.0/sys/netinet/sctp_output.c
==============================================================================
--- releng/9.0/sys/netinet/sctp_output.c	Sun Nov 27 19:09:31 2011	(r228036)
+++ releng/9.0/sys/netinet/sctp_output.c	Sun Nov 27 19:13:45 2011	(r228037)
@@ -4668,24 +4668,24 @@ sctp_send_initiate(struct sctp_inpcb *in
 #ifdef INET6
 #ifdef INET
 	/* we support 2 types: IPv4/IPv6 */
-	sup_addr->ph.param_length = htons(sizeof(*sup_addr) + sizeof(uint16_t));
+	sup_addr->ph.param_length = htons(sizeof(struct sctp_paramhdr) + 2 * sizeof(uint16_t));
 	sup_addr->addr_type[0] = htons(SCTP_IPV4_ADDRESS);
 	sup_addr->addr_type[1] = htons(SCTP_IPV6_ADDRESS);
 #else
 	/* we support 1 type: IPv6 */
-	sup_addr->ph.param_length = htons(sizeof(*sup_addr) + sizeof(uint8_t));
+	sup_addr->ph.param_length = htons(sizeof(struct sctp_paramhdr) + sizeof(uint16_t));
 	sup_addr->addr_type[0] = htons(SCTP_IPV6_ADDRESS);
 	sup_addr->addr_type[1] = htons(0);	/* this is the padding */
 #endif
 #else
 	/* we support 1 type: IPv4 */
-	sup_addr->ph.param_length = htons(sizeof(*sup_addr) + sizeof(uint8_t));
+	sup_addr->ph.param_length = htons(sizeof(struct sctp_paramhdr) + sizeof(uint16_t));
 	sup_addr->addr_type[0] = htons(SCTP_IPV4_ADDRESS);
 	sup_addr->addr_type[1] = htons(0);	/* this is the padding */
 #endif
-	SCTP_BUF_LEN(m) += sizeof(*sup_addr) + sizeof(uint16_t);
+	SCTP_BUF_LEN(m) += sizeof(struct sctp_supported_addr_param);
 	/* adaptation layer indication parameter */
-	ali = (struct sctp_adaptation_layer_indication *)((caddr_t)sup_addr + sizeof(*sup_addr) + sizeof(uint16_t));
+	ali = (struct sctp_adaptation_layer_indication *)((caddr_t)sup_addr + sizeof(struct sctp_supported_addr_param));
 	ali->ph.param_type = htons(SCTP_ULP_ADAPTATION);
 	ali->ph.param_length = htons(sizeof(*ali));
 	ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator);


More information about the svn-src-all mailing list