summaryrefslogtreecommitdiffstats
path: root/sbin/ping
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2001-06-30 06:46:33 +0000
committerrwatson <rwatson@FreeBSD.org>2001-06-30 06:46:33 +0000
commit88f1ced765a0a817d02c72efd3fda58f6a846278 (patch)
treeba9a3b28965837d8de8e81027de449eb37589110 /sbin/ping
parent8c8f00c4db212cdeebea9c9d2abbc2c8831013a4 (diff)
downloadFreeBSD-src-88f1ced765a0a817d02c72efd3fda58f6a846278.zip
FreeBSD-src-88f1ced765a0a817d02c72efd3fda58f6a846278.tar.gz
Modify ping so that it increases the send socket buffer size if the
user runs with privilege, allowing the sending of icmp packets with larger size (up to 48k, the default receive buffer size in ping), which is useful for network driver development testing, as well as experimentation with fragmentation. Reviewed by: wpaul
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 1209dc8..a0117f4 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -565,6 +565,11 @@ main(argc, argv)
(void)setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&hold,
sizeof(hold));
+ if (!uid) {
+ (void)setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&hold,
+ sizeof(hold));
+ }
+
if (to->sin_family == AF_INET) {
(void)printf("PING %s (%s)", hostname,
inet_ntoa(to->sin_addr));
OpenPOWER on IntegriCloud