From nobody Fri Oct 18 21:18:45 2024 X-Original-To: dev-commits-src-all@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 4XVcyJ1jqpz5YxfW; Fri, 18 Oct 2024 21:18:48 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XVcyJ19lQz4NGQ; Fri, 18 Oct 2024 21:18:48 +0000 (UTC) (envelope-from glebius@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729286328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HEPYfVJex3hkTwameT/49Qy3ZPiLbdSzoBm6qVf5GQk=; b=NygIeFxFP/RT1eJ/XFnhaVtrqILIgOyjexXFL+RbBM6Sek+SKgjX40xyYD25Wb7F6O3/P6 Wg+NgjV1AsqVtzpVEpvCuXQRJ6o5uhVwbLR0+EenLBv3I2epWLBHSh1StHiH7ZhXNvB8wa CK1etJ6bBXy+WLwkez80upcKWxRfpr8T5e0zDCBqfpbeln/esfYoF71CwcHag+Qr5UvElm hgYX+h8HX1qexxh+yQemTAZM7BS4tqrGWNSTk6i5pgxmW+nkKI6eAdR5sg7g04DGMQfGRp QhMYHpmJcqknjWGKmYpcoY818HkVc295QkjNeDPMCfdJmuknzyq4GL3CknmNKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729286328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HEPYfVJex3hkTwameT/49Qy3ZPiLbdSzoBm6qVf5GQk=; b=mN5exmoRoNalQ5DwPifREFWPERc7bEjs3lulTTTJYOy+SBJc6K6agidGqzQv854U/5fD7W K73RJprlWsaob3yqC1OeBrzw7OdPGVYq2pBmw76u+uUEPWYxwc2WWRyNx61vW2R8LtUvaY CKbnCABU/RIzM6Fzfnoj/32XfRkYuJS/d3sUzd8ERdamX2nPmO/1/MTJcW4LGe0G+ZN4By ZxT1mxlfA5c9Ngs/+e9XKCoqCQFLL29XzvsMDbL4oIjHV/dN64KOesFJUrxRVopjHvAHl3 EEbJso+pcmZEwo9SxLIGty/Sjs2FUahGu1JxpM76QU11JexKhLQi+sJXDo0ChA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729286328; a=rsa-sha256; cv=none; b=rxiWrh+oT9y1cp6wypec+oMXBnPXkL4l57ohf9gmVuyKtQIfdR0eksDSURnxQFjn6GPVd2 vgoEo5F0rw86xI/kPW3vQB3fPEfHJOsf6c2R/Q41ZQXGbPmnpoG8xk3S5UnKaT00KtM53P hqW99mgLDiMTCZ/eNGLhp7BSMldAZGNoPWvX5z5/R6Fvfw9LI7+PSa9PXrq8RsL16b5owX 1DK2gu3/XUl8jSawThyp2m/HBnnB87OuSG5lI3zeLQPiW4KqvwPey12X7Ifz3U6e/FHSBl zkYu1/uDqn4OKlC1SNTS+61nEY/jicGoCUUE8FsnkyyqTjwKGX1wzVVV7iZ8sw== Received: from cell.glebi.us (glebi.us [162.251.186.162]) (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) (Authenticated sender: glebius) by smtp.freebsd.org (Postfix) with ESMTPSA id 4XVcyH3ckqzMgr; Fri, 18 Oct 2024 21:18:47 +0000 (UTC) (envelope-from glebius@freebsd.org) Date: Fri, 18 Oct 2024 14:18:45 -0700 From: Gleb Smirnoff To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b88df1e893c4 - main - Reapply "sbin/ping: allow normal users to specify larger packets" Message-ID: References: <202410161840.49GIe8CR000407@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="eGWoIZfGwRej9Y/v" Content-Disposition: inline In-Reply-To: --eGWoIZfGwRej9Y/v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 18, 2024 at 02:15:43PM -0700, Gleb Smirnoff wrote: T> To achieve what you want, you first need to fully revert your patch, and then T> apply the attached patch. It will consistently disable all the size checks T> that _our_ ping has, instead of incorrectly and blindly applying a diff from T> DragonflyBSD. T> T> HOWEVER, PLEASE DO NOT COMMIT the attached patch! Sorry, forgot the attach in the previous email. -- Gleb Smirnoff --eGWoIZfGwRej9Y/v Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ping.c.diff" diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index d9d544bc75c8..817889eaf599 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -320,11 +320,6 @@ ping(int argc, char *const *argv) optarg); } sweepmax = (int)ltmp; - if (uid != 0 && sweepmax > DEFDATALEN) { - errc(EX_NOPERM, EPERM, - "packet size too large: %d > %u", - sweepmax, DEFDATALEN); - } options |= F_SWEEP; break; case 'g': /* Minimum packet size for ping sweep */ @@ -334,11 +329,6 @@ ping(int argc, char *const *argv) optarg); } sweepmin = (int)ltmp; - if (uid != 0 && sweepmin > DEFDATALEN) { - errc(EX_NOPERM, EPERM, - "packet size too large: %d > %u", - sweepmin, DEFDATALEN); - } options |= F_SWEEP; break; case 'H': @@ -351,11 +341,6 @@ ping(int argc, char *const *argv) optarg); } sweepincr = (int)ltmp; - if (uid != 0 && sweepincr > DEFDATALEN) { - errc(EX_NOPERM, EPERM, - "packet size too large: %d > %u", - sweepincr, DEFDATALEN); - } options |= F_SWEEP; break; case 'I': /* multicast interface */ @@ -458,12 +443,6 @@ ping(int argc, char *const *argv) errx(EX_USAGE, "invalid packet size: `%s'", optarg); datalen = (int)ltmp; - if (uid != 0 && datalen > DEFDATALEN) { - errno = EPERM; - err(EX_NOPERM, - "packet size too large: %d > %u", - datalen, DEFDATALEN); - } break; case 'T': /* multicast TTL */ ltmp = strtonum(optarg, 0, MAXTTL, &errstr); @@ -811,9 +790,8 @@ ping(int argc, char *const *argv) cap_rights_init(&rights, CAP_RECV, CAP_EVENT); if (caph_rights_limit(srecv, &rights) < 0) err(1, "cap_rights_limit srecv setsockopt"); - if (uid == 0) - (void)setsockopt(ssend, SOL_SOCKET, SO_SNDBUF, (char *)&hold, - sizeof(hold)); + (void)setsockopt(ssend, SOL_SOCKET, SO_SNDBUF, (char *)&hold, + sizeof(hold)); /* CAP_SETSOCKOPT removed */ cap_rights_init(&rights, CAP_SEND); if (caph_rights_limit(ssend, &rights) < 0) --eGWoIZfGwRej9Y/v--