Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F101993483
D45774.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45774.diff
View Options
diff --git a/sbin/ping/ping.8 b/sbin/ping/ping.8
--- 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 September 15, 2023
+.Dd October 15, 2024
.Dt PING 8
.Os
.Sh NAME
@@ -312,7 +312,6 @@
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
--- 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)
#define MAXWAIT 10000 /* max ms to wait for response */
#define MAXALARM (60 * 60) /* max seconds for alarm timeout */
#define MAXTOS 255
@@ -458,11 +458,10 @@
errx(EX_USAGE, "invalid packet size: `%s'",
optarg);
datalen = (int)ltmp;
- if (uid != 0 && datalen > DEFDATALEN) {
- errno = EPERM;
- err(EX_NOPERM,
+ if (datalen > MAXPAYLOAD) {
+ errx(EX_USAGE,
"packet size too large: %d > %u",
- datalen, DEFDATALEN);
+ datalen, MAXPAYLOAD);
}
break;
case 'T': /* multicast TTL */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 7, 7:34 AM (21 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14506918
Default Alt Text
D45774.diff (1 KB)
Attached To
Mode
D45774: sbin/ping: allow normal users to specify larger packets
Attached
Detach File
Event Timeline
Log In to Comment