diff options
author | rwatson <rwatson@FreeBSD.org> | 2001-06-30 06:46:33 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2001-06-30 06:46:33 +0000 |
commit | 88f1ced765a0a817d02c72efd3fda58f6a846278 (patch) | |
tree | ba9a3b28965837d8de8e81027de449eb37589110 /sbin/ping/ping.c | |
parent | 8c8f00c4db212cdeebea9c9d2abbc2c8831013a4 (diff) | |
download | FreeBSD-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/ping.c')
-rw-r--r-- | sbin/ping/ping.c | 5 |
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)); |