summaryrefslogtreecommitdiff
path: root/sbin/ping
AgeCommit message (Collapse)Author
2020-02-11Simplify and unify wording for the -I sourceaddr option in various places.Theo de Raadt
This is somewhat related to the "-b bind_addr" option some programs have, which should get some cleanup also... input florian claudio jmc
2020-01-04ping(8): improve "-i wait" parsing and error-checking codecheloha
- Never accept negative values. - Cap the interval at UINT_MAX seconds to avoid strange rounding behavior at the end of the input range. - Use error messages that resemble other parts of the tree where we are able to use strtonum(3). - Leverage modf(3) for cleaner code. - Call it "-i interval" to avoid accidental visual similarity to "-w maxwait". With input from cjeker@, kettenis@, kn@. ok kn@
2019-08-28At startup, unveil entire filesystem to read-only. If after privdrop, someTheo de Raadt
implausible bug existed in the socket setup (mostly dns-related and setsockopt) it would be largely neutered. of course, a very restrictive pledge is installed soon after that... ok mestre brynet florian
2019-07-20ping(8): don't round inter-packet delay up to HZcheloha
ping(8) doesn't know the value of HZ and shouldn't round the user's packet wait up to whatever it thinks HZ is. If the period is too small the interrupt will simply fire less often than instructed. The kernel will do the right thing regardless. Given the rarity of this usage we don't really need to print a warning, either. ok millert@
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-03-19delay dropping privs a bit when root so that setrtable works.Ted Unangst
traceroute bits from benno. ok benno claudio
2018-11-13Fix previous, which broke ping -T.David Hill
ok dlg@
2018-11-11make all the setsockopt calls consistent.David Gwynne
do not cast the arguments unnecessarily, and always err() on failure. an earlier diff just tweaking the v6 calls was oked by bluhm@ kn@ deraadt@
2018-11-10let -D work on ping6 too.David Gwynne
the manpage was discussed with many
2018-11-10add support for setting the traffic class on ipv6 packets.David Gwynne
it reuses the toskeyword handling that ipv4 uses for setting the tos field, which is equiavlent to traffic class. ok florian@ denis@
2018-10-14Fix ID commentskn
Left behind in revision 1.225. OK benno
2018-10-14Remove unneeded sockaddr size checkskn
With hints set appropiately and switching on address family, the actual size of the socket address returned by getaddrinfo(3) and it's specified length is guaranteed to match. This is probably a leftover "from ping6 which was much more paranoid" before merging it ping. OK florian
2018-07-21There is no need to initialise global and static local variables to zero,Claudio Jeker
they are like that by default. OK florian@
2018-07-18replace manual zero initialization of various fields with memset;Florian Obser
makes the code shorter and easier to read. suggested by & OK claudio
2018-07-18When running flood ping with count packets (-c) set an alarm afterFlorian Obser
sending all packets otherwise ping will wait forever to see all answers - which might not arrive on lossy links. Problem pointed out by, input & OK claudio
2018-04-11Two fixes in ping:Vadim Zhukov
1. Stop telling our PID to the world: the ident values could overlap anyway since PID space is larger than 16 bits for some time already. 2. No need for htons/ntohs dance with ident in IPv6 case. okay benno@ deraadt@ florian@
2017-11-08Add a type cast to force signed comparison. This fixes a loopVisa Hankala
termination issue that can arise when parsing IP options. The bug was found by Hrvoje Popovski with ping -R. Fix tested by Hrvoje, OK millert@
2017-07-08Consistently use if ((option & F_FOO) && (option & F_BAR)) instead ofFlorian Obser
if (option & F_FOO && option & F_BAR). Prompted by a reverse diff from Klemens Nanni. Both forms are equivalent due to operator precedence, I consider the later to be easier on the eyes.
2017-07-08Consistently use if (option & F_FOO); from Klemens Nanni, thanks!Florian Obser
2017-07-05remove useless (void)printf casts, diff from Klemens Nanni, massagedFlorian Obser
by me.
2017-07-04calculate multiples of 4 smarter; from Klemens NanniFlorian Obser
2017-07-04replace perror(3) with err(3); from Klemens NanniFlorian Obser
2017-02-22Unbreak "ping6 -L"Renato Westphal
$ ping6 -L ff02::1%em1 ping6: setsockopt IP6_MULTICAST_LOOP: Invalid argument Unfortunately we have this inconsistency in the sockets API where we need to pass an unsigned char for IP_MULTICAST_LOOP but we need an unsigned int for IPV6_MULTICAST_LOOP. While here, fix a typo in the error message. OK millert@ florian@
2016-10-26in florian;s last commit i urged him to change "twenty-four" toJason McIntyre
"twenty four", arguing, i think, that the internet is wrong; well seemingly i'm wrong, and you should hyphenate numbers when spelled out - who'd have thought it. apologies to florian and the diff submitter (and the internet); still, what i should have advised, and what i've done here, is use "24", which is much simpler, fits the surrounding text, and agrees with oed style advice;
2016-10-26Due to 64 bit seconds + 64 bit nano seconds resolution and theFlorian Obser
addition of a MAC we need at least 24 bytes packet size these days to show timing information. Pointed out by Tamas Horvath, thanks! OK jmc
2016-10-20Only drop to _ping user if invoked as root. If invoked as anFlorian Obser
unprivileged user just shed the setuid privs as previously. sthen@ pointed out that you cannot kill(2) your own ping. With this we rely on pledge(2) for unprivileged users. OK sthen@, deraadt@ is happy with the middle ground
2016-09-28Always do the setgroups, setresgid and setresuid even if if theFlorian Obser
unprivileged user is not present instead of erroring out. This lets ping and traceroute work in restricted enviornments like the bgplg chroot. Problem reported by sthen@ input & prodding deraadt@
2016-09-26Drop privileges to newly added _ping user/group.Florian Obser
It does not buy us much when called as a unpriv user. But if run as root we can now lose privileges. OK natano@, deraadt@ is happy
2016-09-20whitespaceTheo de Raadt
2016-09-20various cleanup; ok florianJason McIntyre
2016-09-19Only allow standard dot notation for IPv4 addresses.Florian Obser
We can get rid of inet_aton(3) and use the AF independent getaddrinfo(3). OK natano@, krw@, millert@, claudio@
2016-09-18unbreak IPv6 source selectionFlorian Obser
2016-09-18simplify startup, since we know earlier which type of socket we needTheo de Raadt
ok florian
2016-09-18whitespaceTheo de Raadt
2016-09-18If running in verbose mode and no source address has been specifiedFlorian Obser
with -I find the kernel selected address and print it even for v4 addresses. OK phessler@, natano@, mpi@, claudio@, benno@, sthen@, millert@
2016-09-18Do not print 'ping6' in reporting output, just 'ping'.Florian Obser
OK tom@, natano@, claudio@, sthen@, millert@
2016-09-18minor tweaks;Jason McIntyre
2016-09-17backwards if(v6flag); pointed out by naddyFlorian Obser
2016-09-17Merge ping6(8) manual into ping(8).Florian Obser
Tweak & OK jmc@
2016-09-17ping6(8) is now a hardlink to ping(8).Florian Obser
The instbin stuff looks good to deraadt@
2016-09-17The final merge ping6 into ping.Florian Obser
"why slow down?" deraadt@
2016-09-17Use ECHOTMLEN define; no functional change.Florian Obser
2016-09-17iov_base is already set in this case; reduce diff to ping6(8).Florian Obser
2016-09-17MAXPAYLOAD is different between ping and ping6.Florian Obser
2016-09-17Just use AF_INET like everywhere else.Florian Obser
2016-09-17malloc sets errno; use err not errxFlorian Obser
2016-09-17whitespaceFlorian Obser
2016-09-17Make getting source address more AF independent.Florian Obser
2016-09-17If -I was not given hoist getting source address up.Florian Obser
2016-09-17Make source address selection more AF independent.Florian Obser