Improve consistency, no functional change intended.
@@ -3297,7 +3297,7 @@ usrsctp_conninput(void *addr, const void *buffer, size_t length, uint8_t ecn_bit
struct mbuf *m, *mm;
struct sctphdr *sh;
struct sctp_chunkhdr *ch;
- int remaining;
+ int remaining, offset;
SCTP_STAT_INCR(sctps_recvpackets);
SCTP_STAT_INCR_COUNTER64(sctps_inpackets);
@@ -3327,17 +3327,19 @@ usrsctp_conninput(void *addr, const void *buffer, size_t length, uint8_t ecn_bit
}
KASSERT(remaining == 0, ("usrsctp_conninput: %zu bytes left", remaining));
m_copyback(m, 0, (int)length, (caddr_t)buffer);
- if (SCTP_BUF_LEN(m) < (int)(sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))) {
- if ((m = m_pullup(m, sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))) == NULL) {
+ offset = sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr);
+ if (SCTP_BUF_LEN(m) < offset) {
+ if ((m = m_pullup(m, offset)) == NULL) {
SCTP_STAT_INCR(sctps_hdrops);
return;
}
}
- sh = mtod(m, struct sctphdr *);;
+ sh = mtod(m, struct sctphdr *);
ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(struct sctphdr));
+ offset -= sizeof(struct sctp_chunkhdr);
src.sconn_port = sh->src_port;
dst.sconn_port = sh->dest_port;
- sctp_common_input_processing(&m, 0, sizeof(struct sctphdr), (int)length,
+ sctp_common_input_processing(&m, 0, offset, (int)length,
(struct sockaddr *)&src,
(struct sockaddr *)&dst,
sh, ch,
