From nobody Wed Oct 16 05:24:18 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 4XSzsv0TYxz5ZWbg; Wed, 16 Oct 2024 05:24:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XSzst74RFz4Z0Q; Wed, 16 Oct 2024 05:24:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729056259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3jGwcfIN18puJUDtry0FmQheCMziNgL/Phg4RU2qKGo=; b=ienRossI5naeORiKbdvvMnqWVWoeVcOuuFLheY9+h5+6aHnwom6JI/PoUmW45zDHxbGIPf OhpU+dVxrZiaBiQN3/5KT7LLgr9sxR3/mOs59npZmpJL76uJbyMq05oKGXO4vGFTY87/Q6 aFkRaZcOHu+mIA1HjzFIhfBhCB7B4qZQyRb0d3wYrfRtkByrKjpW6RjxQ0SjS2O34v+Q9W zuygok5+h+MsxDL7ap2MEUl+LcPSciqhuW7Ku9m1zWSuCmxxF16WW3PjCUSRuYUwi4t1ja KF+JE3DWS1x9OHL4CQkj3vZ5ooD1AD+lqr2QPozMKYm2tR29PAMYntTEnyYNLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729056259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3jGwcfIN18puJUDtry0FmQheCMziNgL/Phg4RU2qKGo=; b=FHbUZcUU5vfNKy9nRgEa/1UGxTb6QgXhzTW5coKpz1UHJxlTCUp4GzVuaHbhCdu+JbDH2y O6q+Egu5gtB3Rs6+2dkp1oNL0SXYRd9gLmB1XXUGf6bxuRLFapvc13Xo37POGIX26+ViBG R+YJE+A++KOidf9mqhsD+dRzpDecCL7bLXYhY8drrQwsZZ9bE9YVBy9TGfkh63nIDHX6Qb Uj0HuvY9omxxtfmwy9QKTZdAkFCSfhyZpR/ENeJo8U5Nwx4gj8ZTiY0/tjnUh8X/BJaeAz Idl7oT1LBxvEaFGZcDuXs89o8We9sVBh726Ls/1OcHE+DkEgKO6JP69HELjtQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729056259; a=rsa-sha256; cv=none; b=ZPY9y8OnbRtSQgP6xyiDJEQSGBmvvnf7Dk5MQmb2AL2k60OCBkanhFkNbW0C4qseLbdBR0 oJfYVmsF8vrvGjdeehlTn2dbgFNoiJet64fMWbkzWjFAALY+lGQ5uNWO1V3sFXpYzsBwKl sDd2mcSBZYhEKL/JpYmEjTOpGIgSidlInV1+Bb/JL5wFPRH2ZwliZlO0ipy4U44WsZ6aY7 R4xMwUTDQyQyuil8Lgybwx3tmqDF6aPnCNsUWZIl2p6NO/zkb1fqeQOnoS5H2VUN0KnAB/ D6vIXUWJjBFmwzqyQTGcHN3hDCSsUza84osOrs3j5KuzFlme+1nGFiJVSncOog== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XSzst67cGzsdG; Wed, 16 Oct 2024 05:24:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49G5OICg056790; Wed, 16 Oct 2024 05:24:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49G5OIGr056787; Wed, 16 Oct 2024 05:24:18 GMT (envelope-from git) Date: Wed, 16 Oct 2024 05:24:18 GMT Message-Id: <202410160524.49G5OIGr056787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Pedro F. Giffuni" Subject: git: 7bc0cb91a2df - main - Revert "sbin/ping: allow normal users to specify larger packets" It is causing test failures. 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=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pfg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7bc0cb91a2dfc7e23d96efd0fb7866ee2a23ba88 Auto-Submitted: auto-generated The branch main has been updated by pfg: URL: https://cgit.FreeBSD.org/src/commit/?id=7bc0cb91a2dfc7e23d96efd0fb7866ee2a23ba88 commit 7bc0cb91a2dfc7e23d96efd0fb7866ee2a23ba88 Author: Pedro F. Giffuni AuthorDate: 2024-10-16 05:21:30 +0000 Commit: Pedro F. Giffuni CommitDate: 2024-10-16 05:23:58 +0000 Revert "sbin/ping: allow normal users to specify larger packets" It is causing test failures. This reverts commit 80a5b26871e90a0ad99d95bd129343471a7a36e3. --- sbin/ping/ping.8 | 3 ++- sbin/ping/ping.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sbin/ping/ping.8 b/sbin/ping/ping.8 index 951049d0f252..0eaec196e1e3 100644 --- a/sbin/ping/ping.8 +++ b/sbin/ping/ping.8 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 15, 2024 +.Dd September 15, 2023 .Dt PING 8 .Os .Sh NAME @@ -312,6 +312,7 @@ with the 8 bytes of ICMP header data. .Pp +For IPv4, only the super-user may specify values more than default. This option cannot be used with ping sweeps. .Pp For IPv6, you may need to specify diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index e6b1247af497..d9d544bc75c8 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 ((int)sizeof(struct ip) + MAX_IPOPTLEN) -#define MAXPAYLOAD (IP_MAXPACKET - MAXIPLEN - ICMP_MINLEN) +#define MAXIPLEN (sizeof(struct ip) + MAX_IPOPTLEN) +#define MAXICMPLEN (ICMP_ADVLENMIN + MAX_IPOPTLEN) #define MAXWAIT 10000 /* max ms to wait for response */ #define MAXALARM (60 * 60) /* max seconds for alarm timeout */ #define MAXTOS 255 @@ -458,10 +458,11 @@ ping(int argc, char *const *argv) errx(EX_USAGE, "invalid packet size: `%s'", optarg); datalen = (int)ltmp; - if (datalen > MAXPAYLOAD) { - errx(EX_USAGE, + if (uid != 0 && datalen > DEFDATALEN) { + errno = EPERM; + err(EX_NOPERM, "packet size too large: %d > %u", - datalen, MAXPAYLOAD); + datalen, DEFDATALEN); } break; case 'T': /* multicast TTL */