From nobody Wed Oct 16 02:42:45 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XSwHc4327z5ZMLH; Wed, 16 Oct 2024 02:42:52 +0000 (UTC) (envelope-from maxim@freebsd.org) Received: from maxim.int.ru (maxim.int.ru [167.71.75.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "maxim.int.ru", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XSwHb5kRHz4JqS; Wed, 16 Oct 2024 02:42:51 +0000 (UTC) (envelope-from maxim@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: from localhost (maxim@localhost [127.0.0.1]) by maxim.int.ru (8.17.1/8.17.1) with ESMTPS id 49G2gjgE025981 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 02:42:45 GMT (envelope-from maxim@freebsd.org) Date: Wed, 16 Oct 2024 02:42:45 +0000 (UTC) From: maxim@freebsd.org To: "Pedro F. Giffuni" 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 In-Reply-To: <202410160106.49G16qS7012339@gitrepo.freebsd.org> Message-ID: <4c41b78e-b560-08ef-0070-017f21d4c8eb@maxim.int.ru> References: <202410160106.49G16qS7012339@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:14061, ipnet:167.71.64.0/20, country:US] X-Rspamd-Queue-Id: 4XSwHb5kRHz4JqS X-Spamd-Bar: ---- 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