Allocate the mbuf for the signature in the COOKIE or the correct size.
While there, do also do some cleanups. MFC after: 1 week
This commit is contained in:
parent
889cd28520
commit
b231bff8b2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362178
@ -3831,8 +3831,6 @@ sctp_add_cookie(struct mbuf *init, int init_offset,
|
|||||||
struct mbuf *copy_init, *copy_initack, *m_at, *sig, *mret;
|
struct mbuf *copy_init, *copy_initack, *m_at, *sig, *mret;
|
||||||
struct sctp_state_cookie *stc;
|
struct sctp_state_cookie *stc;
|
||||||
struct sctp_paramhdr *ph;
|
struct sctp_paramhdr *ph;
|
||||||
uint8_t *foo;
|
|
||||||
int sig_offset;
|
|
||||||
uint16_t cookie_sz;
|
uint16_t cookie_sz;
|
||||||
|
|
||||||
mret = sctp_get_mbuf_for_msg((sizeof(struct sctp_state_cookie) +
|
mret = sctp_get_mbuf_for_msg((sizeof(struct sctp_state_cookie) +
|
||||||
@ -3896,25 +3894,21 @@ sctp_add_cookie(struct mbuf *init, int init_offset,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sig = sctp_get_mbuf_for_msg(SCTP_SECRET_SIZE, 0, M_NOWAIT, 1, MT_DATA);
|
sig = sctp_get_mbuf_for_msg(SCTP_SIGNATURE_SIZE, 0, M_NOWAIT, 1, MT_DATA);
|
||||||
if (sig == NULL) {
|
if (sig == NULL) {
|
||||||
/* no space, so free the entire chain */
|
/* no space, so free the entire chain */
|
||||||
sctp_m_freem(mret);
|
sctp_m_freem(mret);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
SCTP_BUF_LEN(sig) = 0;
|
|
||||||
SCTP_BUF_NEXT(m_at) = sig;
|
SCTP_BUF_NEXT(m_at) = sig;
|
||||||
sig_offset = 0;
|
SCTP_BUF_LEN(sig) = SCTP_SIGNATURE_SIZE;
|
||||||
foo = (uint8_t *)(mtod(sig, caddr_t)+sig_offset);
|
|
||||||
memset(foo, 0, SCTP_SIGNATURE_SIZE);
|
|
||||||
*signature = foo;
|
|
||||||
SCTP_BUF_LEN(sig) += SCTP_SIGNATURE_SIZE;
|
|
||||||
cookie_sz += SCTP_SIGNATURE_SIZE;
|
cookie_sz += SCTP_SIGNATURE_SIZE;
|
||||||
ph->param_length = htons(cookie_sz);
|
ph->param_length = htons(cookie_sz);
|
||||||
|
*signature = (uint8_t *)mtod(sig, caddr_t);
|
||||||
|
memset(*signature, 0, SCTP_SIGNATURE_SIZE);
|
||||||
return (mret);
|
return (mret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t
|
||||||
sctp_get_ect(struct sctp_tcb *stcb)
|
sctp_get_ect(struct sctp_tcb *stcb)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user