From e8bd25cef965b7ea6bdd4de6cd9f337124662158 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sat, 30 Jun 2001 06:46:33 +0000 Subject: [PATCH] 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 --- sbin/ping/ping.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 1209dc89409..a0117f415f4 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));