svn commit: r358167 - head/sys/netinet6

Hans Petter Selasky hps at selasky.org
Mon Feb 24 14:22:49 UTC 2020


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!

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.

--HPS


More information about the svn-src-head mailing list