aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2016-05-13 09:11:41 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2016-05-13 09:11:41 +0000
commit5f05199c1971b917f29bb0b8141367346fc3d1c2 (patch)
tree1dedb87431bbc10d2350912ad9db5eae89904516
parent1c159dbf25f0fc3cfcc6649877f6563b455633e7 (diff)
downloadsrc-5f05199c1971b917f29bb0b8141367346fc3d1c2.tar.gz
src-5f05199c1971b917f29bb0b8141367346fc3d1c2.zip
Fix a bug introduced by the implementation of I-DATA support.
There was the requirement that two structures are in sync, which is not valid anymore. Therefore don't rely on this in the code anymore. Thanks to Radek Malcic for reporting the issue. He found this when using the userland stack. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=299637
-rw-r--r--sys/netinet/sctp_structs.h5
-rw-r--r--sys/netinet/sctputil.c12
2 files changed, 10 insertions, 7 deletions
diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h
index 39fc94937875..84ee43ad4b55 100644
--- a/sys/netinet/sctp_structs.h
+++ b/sys/netinet/sctp_structs.h
@@ -452,11 +452,6 @@ struct sctp_tmit_chunk {
uint8_t window_probe;
};
-/*
- * The first part of this structure MUST be the entire sinfo structure. Maybe
- * I should have made it a sub structure... we can circle back later and do
- * that if we want.
- */
struct sctp_queued_to_read { /* sinfo structure Pluse more */
uint16_t sinfo_stream; /* off the wire */
uint32_t sinfo_ssn; /* off the wire */
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index b7b2c27580c7..cc18d9f05198 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -5545,8 +5545,16 @@ found_one:
stcb->asoc.strmin[control->sinfo_stream].delivery_started = 1;
}
/* First lets get off the sinfo and sockaddr info */
- if ((sinfo) && filling_sinfo) {
- memcpy(sinfo, control, sizeof(struct sctp_nonpad_sndrcvinfo));
+ if ((sinfo != NULL) && (filling_sinfo != 0)) {
+ sinfo->sinfo_stream = control->sinfo_stream;
+ sinfo->sinfo_ssn = (uint16_t) control->sinfo_ssn;
+ sinfo->sinfo_flags = control->sinfo_flags;
+ sinfo->sinfo_ppid = control->sinfo_ppid;
+ sinfo->sinfo_context = control->sinfo_context;
+ sinfo->sinfo_timetolive = control->sinfo_timetolive;
+ sinfo->sinfo_tsn = control->sinfo_tsn;
+ sinfo->sinfo_cumtsn = control->sinfo_cumtsn;
+ sinfo->sinfo_assoc_id = control->sinfo_assoc_id;
nxt = TAILQ_NEXT(control, next);
if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXT_RCVINFO) ||
sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVNXTINFO)) {