Date: Fri, 18 Oct 2024 14:18:45 -0700 From: Gleb Smirnoff <glebius@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: b88df1e893c4 - main - Reapply "sbin/ping: allow normal users to specify larger packets" Message-ID: <ZxLQtcdM-4TkYvoe@cell.glebi.us> In-Reply-To: <ZxLP_62a9cF6BXqE@cell.glebi.us> References: <202410161840.49GIe8CR000407@gitrepo.freebsd.org> <ZxLP_62a9cF6BXqE@cell.glebi.us>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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
[-- Attachment #2 --]
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZxLQtcdM-4TkYvoe>
