Hacker News new | past | comments | ask | show | jobs | submit login

Try::

  $ dpkg -S /bin/ping
  iputils-ping: /bin/ping
  $ grep 'downloaded from' /usr/share/doc/iputils-ping/copyright
  It was downloaded from https://github.com/iputils/iputils
  $ git clone https://github.com/iputils/iputils
  ...
  $ cd iputils/ping
Then a bit of looking around shows that in acknowledge() (an inline helper defined in ping.h), pipesize records the largest difference between the sequence number of the (last) outbound probe and than the sequence number of the inbound probe we're receiving. That function is called from gather_statistics() (for the happy path) and in a couple of other locations when receiving an ICMP error.



Cool trick! For anyone who isn't conveniently on Linux: https://github.com/iputils/iputils/blob/master/ping/ping.h#L...


On Arch Linux, use

  $ pacman -Qqo $(which ping) # -Qqo is --query --quiet --own
  iputils
  $ asp export iputils && cd iputils
  $ # see PKGBUILD for URLs, or if you just want to have a look:
  $ gpg --import keys/pgp/*.asc # or pass --skippgpcheck to makepkg below
  $ makepkg -od && cd src # -od is --nobuild --nodeps
On NixOS with the new-style CLI, using

  $ nix eval nixpkgs#iputils.src.url
  "https://github.com/iputils/iputils/archive/20221126.tar.gz"
for the second step usually works, although I don’t know how to figure out the package name reliably (ls -l will usually point you in the right direction, but for ping it just gives you the wrapper).


Thanks for that. I like how you not only give us this particular fish but show how to catch other fish.

Edit: for those whose first language is not English, I’m referring to https://en.wiktionary.org/wiki/give_a_man_a_fish_and_you_fee...


Thank you for a great explanation!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: