From c9eb4473b4ff0647f8a1254e82bef7c8b163d80e Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Thu, 7 Nov 2013 16:37:12 +0000 Subject: [PATCH] Use htons()/ntohs() appropriately. These issues were reported by Andrew Galante. MFC after: 3 days --- sys/netinet/sctp_asconf.c | 2 +- sys/netinet/sctputil.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index bc5e10cea5e..793c7481443 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -2737,7 +2737,7 @@ sctp_compose_asconf(struct sctp_tcb *stcb, int *retlen, int addr_locked) /* chain it all together */ SCTP_BUF_NEXT(m_asconf_chk) = m_asconf; *retlen = SCTP_BUF_LEN(m_asconf_chk) + SCTP_BUF_LEN(m_asconf); - acp->ch.chunk_length = ntohs(*retlen); + acp->ch.chunk_length = htons(*retlen); return (m_asconf_chk); } diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 89d4302df1e..567bf1ce1d6 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -2602,7 +2602,7 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT)) { notif_len = sizeof(struct sctp_assoc_change); if (abort != NULL) { - abort_len = htons(abort->ch.chunk_length); + abort_len = ntohs(abort->ch.chunk_length); } else { abort_len = 0; } @@ -3474,7 +3474,7 @@ sctp_notify_remote_error(struct sctp_tcb *stcb, uint16_t error, struct sctp_erro return; } if (chunk != NULL) { - chunk_len = htons(chunk->ch.chunk_length); + chunk_len = ntohs(chunk->ch.chunk_length); } else { chunk_len = 0; }