Date: Wed, 16 Oct 2024 02:42:45 +0000 (UTC) From: maxim@freebsd.org To: "Pedro F. Giffuni" <pfg@FreeBSD.org> Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 80a5b26871e9 - main - sbin/ping: allow normal users to specify larger packets Message-ID: <4c41b78e-b560-08ef-0070-017f21d4c8eb@maxim.int.ru> In-Reply-To: <202410160106.49G16qS7012339@gitrepo.freebsd.org> References: <202410160106.49G16qS7012339@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4c41b78e-b560-08ef-0070-017f21d4c8eb>