Correctly get the payload length in host byte order. While we
already plan to support >64k payload here, the IPv6 header payload length obviously is only 16 bit and the calculations need to be right. Reported by: dim Tested by: dim MFC after: 1 day X-MFC: with r235958
This commit is contained in:
parent
73c77d2614
commit
c69baa7e91
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=236130
@ -189,13 +189,13 @@ in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset)
|
||||
{
|
||||
u_short csum;
|
||||
|
||||
csum = in_cksum_skip(m, ntohl(plen), offset);
|
||||
csum = in_cksum_skip(m, offset + plen, offset);
|
||||
if (m->m_pkthdr.csum_flags & CSUM_UDP && csum == 0)
|
||||
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 off: %d\n",
|
||||
printf("%s: delayed m_pullup, m->len: %d off: %d\n",
|
||||
__func__, m->m_len, offset);
|
||||
/*
|
||||
* XXX this should not happen, but if it does, the correct
|
||||
@ -962,7 +962,7 @@ skip_ipsec2:;
|
||||
*/
|
||||
if (sw_csum & CSUM_DELAY_DATA) {
|
||||
sw_csum &= ~CSUM_DELAY_DATA;
|
||||
in6_delayed_cksum(m, ip6->ip6_plen, sizeof(struct ip6_hdr));
|
||||
in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr));
|
||||
}
|
||||
#ifdef SCTP
|
||||
if (sw_csum & CSUM_SCTP) {
|
||||
@ -1077,7 +1077,7 @@ skip_ipsec2:;
|
||||
* XXX-BZ handle the hw offloading case. Need flags.
|
||||
*/
|
||||
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
|
||||
in6_delayed_cksum(m, ip6->ip6_plen, sizeof(*ip6));
|
||||
in6_delayed_cksum(m, plen, hlen);
|
||||
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
|
||||
}
|
||||
#ifdef SCTP
|
||||
|
Loading…
Reference in New Issue
Block a user