Re: git: 80a5b26871e9 - main - sbin/ping: allow normal users to specify larger packets

From: Pedro Giffuni <pfg_at_freebsd.org>
Date: Wed, 16 Oct 2024 05:18:42 UTC
 Hi;
Yes sorry .. I will be reverting the commit.
Pedro.
    On Tuesday, October 15, 2024 at 09:43:00 PM GMT-5, <maxim@freebsd.org> wrote:  
 
 Hi Pedro,

> index d9d544bc75c8..e6b1247af497 100644
> --- a/sbin/ping/ping.c
> +++ b/sbin/ping/ping.c
> @@ -96,8 +96,8 @@
>  #define    DEFDATALEN    56        /* default data length */
>  #define    FLOOD_BACKOFF    20000        /* usecs to back off if F_FLOOD mode */
>                      /* runs out of buffer space */
> -#define    MAXIPLEN    (sizeof(struct ip) + MAX_IPOPTLEN)
> -#define    MAXICMPLEN    (ICMP_ADVLENMIN + MAX_IPOPTLEN)
> +#define    MAXIPLEN    ((int)sizeof(struct ip) + MAX_IPOPTLEN)
> +#define    MAXPAYLOAD    (IP_MAXPACKET - MAXIPLEN - ICMP_MINLEN)

This doesn't look right.

Before:

# ping -s 65507 -c 1 127.0.0.1
ING 127.0.0.1 (127.0.0.1): 65507 data bytes
65515 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.194 ms
..

Now:

# /usr/obj/usr/home/maxim/fbsd/src/amd64.amd64/sbin/ping/ping -s 65507
-c 1 127.0.0.1
ping: packet size too large: 65507 > 65467

Not sure if the tests catch this.

Maxim

-- 
Maxim Konovalov