ip6_output: fix regression introduced in r358167 for ipv6 fragmentation

When moving the calculations for the optlen into the if (opt) block
which deals with possible extension headers I failed to initialise
unfragpartlen to the ipv6 header length if there were no extension
headers present.  Correct that mistake to make IPv6 fragment length
calculcations work again.

Reported by:	hselasky, kp
OKed by:	hselasky, kp
MFC after:	3 days
X-MFC with:	r358167
PR:		244393
This commit is contained in:
Bjoern A. Zeeb 2020-02-25 15:03:41 +00:00
parent 0ba490729b
commit 3db6053160
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358311

View file

@ -497,7 +497,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
*/
bzero(&exthdrs, sizeof(exthdrs));
optlen = 0;
unfragpartlen = 0;
unfragpartlen = sizeof(struct ip6_hdr);
if (opt) {
/* Hop-by-Hop options header. */
MAKE_EXTHDR(opt->ip6po_hbh, &exthdrs.ip6e_hbh, optlen);
@ -535,7 +535,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
/* Routing header. */
MAKE_EXTHDR(opt->ip6po_rthdr, &exthdrs.ip6e_rthdr, optlen);
unfragpartlen = optlen + sizeof(struct ip6_hdr);
unfragpartlen += optlen;
/*
* NOTE: we don't add AH/ESP length here (done in