svn commit: r252929 - stable/9/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Sun Jul 7 11:41:13 UTC 2013


Author: tuexen
Date: Sun Jul  7 11:41:12 2013
New Revision: 252929
URL: http://svnweb.freebsd.org/changeset/base/252929

Log:
  MFC r240198:
  Don't include a structure containing a flexible array in another
  structure.

Modified:
  stable/9/sys/netinet/sctp_header.h
  stable/9/sys/netinet/sctp_indata.c
  stable/9/sys/netinet/sctp_input.c
  stable/9/sys/netinet/sctp_input.h
  stable/9/sys/netinet/sctp_structs.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/sctp_header.h
==============================================================================
--- stable/9/sys/netinet/sctp_header.h	Sun Jul  7 11:36:46 2013	(r252928)
+++ stable/9/sys/netinet/sctp_header.h	Sun Jul  7 11:41:12 2013	(r252929)
@@ -510,16 +510,6 @@ struct sctp_stream_reset_add_strm {
  * streams then the request will need to be an overlay structure.
  */
 
-struct sctp_stream_reset_out_req {
-	struct sctp_chunkhdr ch;
-	struct sctp_stream_reset_out_request sr_req;
-}                         SCTP_PACKED;
-
-struct sctp_stream_reset_in_req {
-	struct sctp_chunkhdr ch;
-	struct sctp_stream_reset_in_request sr_req;
-}                        SCTP_PACKED;
-
 struct sctp_stream_reset_tsn_req {
 	struct sctp_chunkhdr ch;
 	struct sctp_stream_reset_tsn_request sr_req;

Modified: stable/9/sys/netinet/sctp_indata.c
==============================================================================
--- stable/9/sys/netinet/sctp_indata.c	Sun Jul  7 11:36:46 2013	(r252928)
+++ stable/9/sys/netinet/sctp_indata.c	Sun Jul  7 11:41:12 2013	(r252929)
@@ -2113,7 +2113,7 @@ finish_express_del:
 		 */
 		struct sctp_queued_to_read *ctl, *nctl;
 
-		sctp_reset_in_stream(stcb, liste->number_entries, liste->req.list_of_streams);
+		sctp_reset_in_stream(stcb, liste->number_entries, liste->list_of_streams);
 		TAILQ_REMOVE(&asoc->resetHead, liste, next_resp);
 		SCTP_FREE(liste, SCTP_M_STRESET);
 		/* sa_ignore FREED_MEMORY */

Modified: stable/9/sys/netinet/sctp_input.c
==============================================================================
--- stable/9/sys/netinet/sctp_input.c	Sun Jul  7 11:36:46 2013	(r252928)
+++ stable/9/sys/netinet/sctp_input.c	Sun Jul  7 11:41:12 2013	(r252929)
@@ -3455,9 +3455,9 @@ process_chunk_drop(struct sctp_tcb *stcb
 }
 
 void
-sctp_reset_in_stream(struct sctp_tcb *stcb, int number_entries, uint16_t * list)
+sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list)
 {
-	int i;
+	uint32_t i;
 	uint16_t temp;
 
 	/*
@@ -3511,7 +3511,7 @@ struct sctp_stream_reset_out_request *
 sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk)
 {
 	struct sctp_association *asoc;
-	struct sctp_stream_reset_out_req *req;
+	struct sctp_chunkhdr *ch;
 	struct sctp_stream_reset_out_request *r;
 	struct sctp_tmit_chunk *chk;
 	int len, clen;
@@ -3534,8 +3534,8 @@ sctp_find_stream_reset(struct sctp_tcb *
 		*bchk = chk;
 	}
 	clen = chk->send_size;
-	req = mtod(chk->data, struct sctp_stream_reset_out_req *);
-	r = &req->sr_req;
+	ch = mtod(chk->data, struct sctp_chunkhdr *);
+	r = (struct sctp_stream_reset_out_request *)(ch + 1);
 	if (ntohl(r->request_seq) == seq) {
 		/* found it */
 		return (r);
@@ -3888,8 +3888,7 @@ sctp_handle_str_reset_request_out(struct
 			}
 			liste->tsn = tsn;
 			liste->number_entries = number_entries;
-			memcpy(&liste->req, req,
-			    (sizeof(struct sctp_stream_reset_out_request) + (number_entries * sizeof(uint16_t))));
+			memcpy(&liste->list_of_streams, req->list_of_streams, number_entries * sizeof(uint16_t));
 			TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp);
 			asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED;
 		}
@@ -4059,7 +4058,7 @@ __attribute__((noinline))
 #endif
 	static int
 	    sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset,
-        struct sctp_stream_reset_out_req *sr_req)
+        struct sctp_chunkhdr *ch_req)
 {
 	int chk_length, param_len, ptype;
 	struct sctp_paramhdr pstore;
@@ -4074,7 +4073,7 @@ __attribute__((noinline))
 	int num_param = 0;
 
 	/* now it may be a reset or a reset-response */
-	chk_length = ntohs(sr_req->ch.chunk_length);
+	chk_length = ntohs(ch_req->chunk_length);
 
 	/* setup for adding the response */
 	sctp_alloc_a_chunk(stcb, chk);
@@ -5413,7 +5412,7 @@ process_control_chunks:
 				 */
 				stcb->asoc.peer_supports_strreset = 1;
 			}
-			if (sctp_handle_stream_reset(stcb, m, *offset, (struct sctp_stream_reset_out_req *)ch)) {
+			if (sctp_handle_stream_reset(stcb, m, *offset, ch)) {
 				/* stop processing */
 				*offset = length;
 				return (NULL);

Modified: stable/9/sys/netinet/sctp_input.h
==============================================================================
--- stable/9/sys/netinet/sctp_input.h	Sun Jul  7 11:36:46 2013	(r252928)
+++ stable/9/sys/netinet/sctp_input.h	Sun Jul  7 11:41:12 2013	(r252929)
@@ -53,7 +53,7 @@ sctp_find_stream_reset(struct sctp_tcb *
     struct sctp_tmit_chunk **bchk);
 
 void 
-sctp_reset_in_stream(struct sctp_tcb *stcb, int number_entries,
+sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries,
     uint16_t * list);
 
 

Modified: stable/9/sys/netinet/sctp_structs.h
==============================================================================
--- stable/9/sys/netinet/sctp_structs.h	Sun Jul  7 11:36:46 2013	(r252928)
+++ stable/9/sys/netinet/sctp_structs.h	Sun Jul  7 11:41:12 2013	(r252929)
@@ -77,8 +77,8 @@ TAILQ_HEAD(sctpnetlisthead, sctp_nets);
 struct sctp_stream_reset_list {
 	TAILQ_ENTRY(sctp_stream_reset_list) next_resp;
 	uint32_t tsn;
-	int number_entries;
-	struct sctp_stream_reset_out_request req;
+	uint32_t number_entries;
+	uint16_t list_of_streams[];
 };
 
 TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list);


More information about the svn-src-all mailing list