Use m_copyback() function to write delayed checksum when it isn't located

in the first mbuf of the chain.

MFC after:	1 week
This commit is contained in:
Andrey V. Elsukov 2018-06-06 10:46:24 +00:00
parent 59c8d5dc27
commit 4a089e6bc5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334707

View File

@ -199,18 +199,10 @@ in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset)
csum = 0xffff;
offset += m->m_pkthdr.csum_data; /* checksum offset */
if (offset + sizeof(u_short) > m->m_len) {
printf("%s: delayed m_pullup, m->len: %d plen %u off %u "
"csum_flags=%b\n", __func__, m->m_len, plen, offset,
(int)m->m_pkthdr.csum_flags, CSUM_BITS);
/*
* XXX this should not happen, but if it does, the correct
* behavior may be to insert the checksum in the appropriate
* next mbuf in the chain.
*/
return;
}
*(u_short *)(m->m_data + offset) = csum;
if (offset + sizeof(csum) > m->m_len)
m_copyback(m, offset, sizeof(csum), (caddr_t)&csum);
else
*(u_short *)mtodo(m, offset) = csum;
}
int