Fix IPv6 extension header parsing. The length field doesn't include the

first 8 octets.

Obtained from:	Yandex LLC
MFC after:	3 days
This commit is contained in:
Andrey V. Elsukov 2017-06-29 19:06:43 +00:00
parent d25c1ff64f
commit 785c0d4d97
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=320479
3 changed files with 3 additions and 3 deletions

View File

@ -1054,7 +1054,7 @@ nat64_getlasthdr(struct mbuf *m, int *offset)
if (proto == IPPROTO_HOPOPTS && ip6->ip6_plen == 0)
return (-1);
proto = hbh->ip6h_nxt;
hlen += hbh->ip6h_len << 3;
hlen += (hbh->ip6h_len + 1) << 3;
}
if (offset != NULL)
*offset = hlen;

View File

@ -125,7 +125,7 @@ nptv6_getlasthdr(struct nptv6_cfg *cfg, struct mbuf *m, int *offset)
if (m->m_len < hlen)
return (-1);
proto = hbh->ip6h_nxt;
hlen += hbh->ip6h_len << 3;
hlen += (hbh->ip6h_len + 1) << 3;
}
if (offset != NULL)
*offset = hlen;

View File

@ -137,7 +137,7 @@ tcpmod_ipv6_setmss(struct mbuf **mp, uint16_t mss)
proto == IPPROTO_DSTOPTS) {
hbh = mtodo(*mp, hlen);
proto = hbh->ip6h_nxt;
hlen += hbh->ip6h_len << 3;
hlen += (hbh->ip6h_len + 1) << 3;
}
tcp = mtodo(*mp, hlen);
plen = (*mp)->m_pkthdr.len - hlen;