Date: Tue, 25 Feb 2020 13:44:17 +0100 From: "Kristof Provost" <kp@FreeBSD.org> To: "Hans Petter Selasky" <hps@selasky.org> Cc: "Bjoern A. Zeeb" <bz@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r358167 - head/sys/netinet6 Message-ID: <963E6D27-9320-4F84-A3BB-A597C829AAAB@FreeBSD.org> In-Reply-To: <7d9ea227-7208-5773-080c-5ebc365c4be0@selasky.org> References: <202002201056.01KAuC0N029186@repo.freebsd.org> <7d9ea227-7208-5773-080c-5ebc365c4be0@selasky.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 24 Feb 2020, at 15:21, Hans Petter Selasky wrote:
> On 2020-02-20 11:56, Bjoern A. Zeeb wrote:
>> +
>> + unfragpartlen = optlen + sizeof(struct ip6_hdr);
>> +
>
> Hi Bjoren,
>
> This change introduces a slight regression when a host replies to IPv6
> ping fragmented packets. The problem is the "unfragpartlen" must also
> be set in the else case of "if (opt)", else the payload offset
> computation for IPv6 fragments goes wrong by the size of the IPv6
> header!
>
Confirmed, because the pf fragmentation:v6 test also fails on this.
> After r358167:
>
>> ping6 -s 3000 fe80::ee0d:9aff:fed4:2c8c%mce2
>> PING6(3048=40+8+3000 bytes) fe80::ee0d:9aff:fed4:2c94%mce2 -->
>> fe80::ee0d:9aff:fed4:2c8c%mce2
>> ^C
>> --- fe80::ee0d:9aff:fed4:2c8c%mce2 ping6 statistics ---
>> 2 packets transmitted, 0 packets received, 100.0% packet loss
>
> With the patch mentioned in the end of this e-mail:
>
>> ping6 -s 3000 fe80::ee0d:9aff:fed4:2c8c%mce2
>> PING6(3048=40+8+3000 bytes) fe80::ee0d:9aff:fed4:2c8c%mce2 -->
>> fe80::ee0d:9aff:fed4:2c8c%mce2
>> 3008 bytes from fe80::ee0d:9aff:fed4:2c8c%mce2, icmp_seq=0 hlim=64
>> time=0.499 ms
>> 3008 bytes from fe80::ee0d:9aff:fed4:2c8c%mce2, icmp_seq=1 hlim=64
>> time=0.405 ms
>> 3008 bytes from fe80::ee0d:9aff:fed4:2c8c%mce2, icmp_seq=2 hlim=64
>> time=0.097 ms
>> ^C
>> --- fe80::ee0d:9aff:fed4:2c8c%mce2 ping6 statistics ---
>> 3 packets transmitted, 3 packets received, 0.0% packet loss
>> round-trip min/avg/max/std-dev = 0.097/0.334/0.499/0.172 ms
>
> Patch goes like this:
>
>> diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
>> index 06c57bcec48..a6c8d148833 100644
>> --- a/sys/netinet6/ip6_output.c
>> +++ b/sys/netinet6/ip6_output.c
>> @@ -459,7 +459,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts
>> *opt,
>> */
>> bzero(&exthdrs, sizeof(exthdrs));
>> optlen = 0;
>> - unfragpartlen = 0;
>> if (opt) {
>> /* Hop-by-Hop options header. */
>> MAKE_EXTHDR(opt->ip6po_hbh, &exthdrs.ip6e_hbh,
>> optlen);
>> @@ -497,8 +496,6 @@ 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);
>> -
>> /*
>> * NOTE: we don't add AH/ESP length here (done in
>> * ip6_ipsec_output()).
>> @@ -508,6 +505,8 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts
>> *opt,
>> MAKE_EXTHDR(opt->ip6po_dest2, &exthdrs.ip6e_dest2,
>> optlen);
>> }
>> + unfragpartlen = optlen + sizeof(struct ip6_hdr);
>> +
>> /*
>> * If there is at least one extension header,
>> * separate IP6 header from the payload.
>
And with this patch the test passes again.
Regards,
Kristof
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?963E6D27-9320-4F84-A3BB-A597C829AAAB>
