summaryrefslogtreecommitdiff
path: root/sbin/ping/ping.c
AgeCommit message (Collapse)Author
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-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-17backwards if(v6flag); pointed out by naddyFlorian Obser
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
2016-09-17Introduce AF independent from.Florian Obser
2016-09-17Use AF independent dst where possible.Florian Obser
2016-09-17Blindly s/dst/dst4/ or s/dst/dst6/, AF independent dst will beFlorian Obser
introduced next.
2016-09-17We will need the variable name "from" soon, so free it up by renamingFlorian Obser
to peer. While here move declaration down to where it's needed. No functional change.
2016-09-17Reduce diff in pinger().Florian Obser
2016-09-17styleFlorian Obser
2016-09-17Move more AF independent initialization around to reduce diff.Florian Obser
2016-09-17Normalize receive packet allocation.Florian Obser
2016-09-17Use ECHOTMLEN define.Florian Obser
2016-09-17ping(8): The IPv6 header has a payload length field while IPv4 has aFlorian Obser
length field for the whole packet. Make some room for IPv6 payload. ping6(8): Sync to ping(8).
2016-09-17Bring over includes, we will need them in a merge anyway.Florian Obser
2016-09-17If no source address is specified and we are running in verbose modeFlorian Obser
try to find it with getsockname(2) like ping6(8). Disable printing for now though because scripts might depend on ping(8)'s output.
2016-09-13Rearange option handling to reduce diff between ping(8) and ping6(8).Florian Obser
While here be explicit that timing and timinginfo are initialized to 0.
2016-09-13Make the raw socket non-global and pass it to retransmit()/pinger().Florian Obser
2016-09-13No need to have the destination global.Florian Obser
2016-09-13No need to have this global.Florian Obser
2016-09-13timinginfo is a global flag that we got at least one packet back withFlorian Obser
timing information for the summary line. Here we need to know if the current echo reply was long enough to carry timing information.
2016-09-12Bring over KAME copyright, there is now code from ping in ping6. WhileFlorian Obser
here nuke NetBSD, KAME and BSDI ids. With this the beginning of ping.c and ping6.c are in sync. prodding deraadt@
2016-09-12No need for have this unsigned, reduces diff to ping6(8).Florian Obser
2016-09-12Use ECHOLEN/ECHOTMLEN defines.Florian Obser
2016-09-11bring over LEN defines from ping6(8)Florian Obser
2016-09-11The canonical way to find out if we can have timing stats is timinginfo.Florian Obser
2016-09-11Normalize variable declarations in pr_pack. While here introduce seqFlorian Obser
variable in ping and normalize it's usage.
2016-09-11use fputc to put in sync with ping6Florian Obser
2016-09-11Introduce pr_ipopt() to remove IPv4 specifics from pr_pack(); smallFlorian Obser
step to make this AF independent.
2016-09-11Hoist pr_addr() up, it's AF independent; no obj change.Florian Obser
Diff between ping and ping6 is easier to read if all identical or as close as possible to being identical functions are in one place.
2016-09-11Hoist summary() up, it's AF independent; no obj change.Florian Obser
Diff between ping and ping6 is easier to read if all identical or as close as possible to being identical functions are in one place.
2016-09-11Hoist fill() up, it's AF independent; no obj change.Florian Obser
Diff between ping and ping6 is easier to read if all identical or as close as possible to being identical functions are in one place.
2016-09-11Pass from around as struct sockaddr.Florian Obser