liboping.git
8 years agosrc/liboping.c: Performance improvements.
Luke Heberling [Sat, 6 Aug 2016 12:46:30 +0000 (14:46 +0200)]
src/liboping.c: Performance improvements.

I'm finding collectd's ping plugin inadequate for host lists larger than
a few hundred. It consumes an entire 2.8Ghz CPU and reports random false
packet loss (Latest collectd and liboping from git.verplant.org on
debian squeeze and lenny). This seems to be because of some
inefficiencies in liboping. For instance, a FD is created for every
host. Since each raw socket receives all raw packets, only one FD would
be needed for all hosts (of the same addrfamily). Besides consuming all
those additional FD's, each reply packet is received and processed
separately on each FD causing O(n^2) complexity. Also for each packet
processed on each FD, a scan of all hosts is performed causing O(n^3).

So, I implemented some new features for liboping:
   * use icmp ident as "hash" for table lookup on RX
   * allocate one socket FD per addressfamily (not per host)
   * multiplex socket writes in the same select loop as reads
      * This was necessary because sometimes the first reply
         is received before last request is sent.

It's working well for me in testing so far. 1-3% CPU with 1000 hosts,
compared to 100% and useless at 500 hosts before these changes. If
there's interest I'll update this thread with any significant changes.
As always, changes to address style/portability/other issues that
inhibit integration upstream will be my pleasure.

13 years agosrc/Makefile.am: Make setcap and chmod fault-tolerant.
Florian Forster [Thu, 10 Mar 2011 16:10:16 +0000 (17:10 +0100)]
src/Makefile.am: Make setcap and chmod fault-tolerant.

This is required because this weird Debian fakeroot utility gives the
impression as if the install was run by root, when in fact it isn't.
What good this should do is beyond me.

13 years agosrc/liboping.c: Fix a compiler warning
Florian Forster [Mon, 7 Mar 2011 08:12:06 +0000 (09:12 +0100)]
src/liboping.c: Fix a compiler warning

… regarding a non-static format string. Thanks to Brian Edwards for
reporting this problem.

13 years agoBump version to 1.6.1; Update ChangeLog. liboping-1.6.1
Florian Forster [Sun, 6 Mar 2011 08:46:54 +0000 (09:46 +0100)]
Bump version to 1.6.1; Update ChangeLog.

13 years agoUpdate and unify copyright headers.
Florian Forster [Sun, 6 Mar 2011 08:41:02 +0000 (09:41 +0100)]
Update and unify copyright headers.

13 years agoBuild system: Automatically set capabilities flag / set-UID bit when installing as...
Florian Forster [Sun, 6 Mar 2011 08:34:22 +0000 (09:34 +0100)]
Build system: Automatically set capabilities flag / set-UID bit when installing as root.

13 years agonoping: Fix compatibility with ncurses 5.8.
Gaetan Bisson [Mon, 28 Feb 2011 13:41:24 +0000 (14:41 +0100)]
noping: Fix compatibility with ncurses 5.8.

Hello,

My name is Gaetan and I maintain liboping in Arch Linux; our distro is
in the process of switching to ncurses-5.8, and I wanted to report that
I had to patch liboping to make noping work with the newer ncurses.

Specifically, if I update ncurses and run the old noping binary, then
nothing is displayed in the ncurses window (although the summary output
displayed on stdout at the end is correct). Same if I recompile noping
against the new ncurses library.

The reason seems to be that calling newwin() with ncols=0 does not
produce a full width window anymore. Anyway, the simple patch attached
fixed this issue for me.

Cheers.

Signed-off-by: Florian Forster <octo@verplant.org>
13 years agosrc/oping.c: Fix a compiler warning about uninitialized variables.
Florian Forster [Wed, 16 Feb 2011 08:45:35 +0000 (09:45 +0100)]
src/oping.c: Fix a compiler warning about uninitialized variables.

Some verions of GGC don't notice that usage_qos_exit() won't return and
complain about the variables "prec" and "class" being used uninitalized.
This commit adds the "noreturn" attribute to that function and
initializes the variables. Thanks to James Bromberger for reporting this
problem.

13 years agoBump version to 1.6.0; Update ChangeLog. liboping-1.6.0
Florian Forster [Wed, 26 Jan 2011 08:48:28 +0000 (09:48 +0100)]
Bump version to 1.6.0; Update ChangeLog.

13 years agoREADME: Remove whitespace.
Florian Forster [Wed, 26 Jan 2011 08:45:11 +0000 (09:45 +0100)]
README: Remove whitespace.

13 years agosrc/liboping.c: Change coding style a bit.
Florian Forster [Sat, 15 Jan 2011 19:36:25 +0000 (20:36 +0100)]
src/liboping.c: Change coding style a bit.

13 years agoliboping: use SO_TIMESTAMP when available
Bruno Prémont [Sat, 15 Jan 2011 18:44:49 +0000 (19:44 +0100)]
liboping: use SO_TIMESTAMP when available

Current implementation of liboping relies on getting enough CPU shares
and getting those in a timely manner in order to determine correct ping
response times.

Avoid this limitation when kernel is able to provide packet reception
times using SO_TIMESTAMP. (as is done by iputils's ping utility)

Signed-off-by: Florian Forster <octo@verplant.org>
14 years agoREADME: Document Linux capabilities and UNIX set-UID root solutions.
Florian Forster [Sat, 27 Nov 2010 12:24:59 +0000 (13:24 +0100)]
README: Document Linux capabilities and UNIX set-UID root solutions.

14 years agooping(8): Document the new SetUID behavior in connection with the "-f" option. liboping-1.5.1
Florian Forster [Wed, 17 Nov 2010 10:04:47 +0000 (11:04 +0100)]
oping(8): Document the new SetUID behavior in connection with the "-f" option.

14 years agoBump version to 1.5.1; Update ChangeLog.
Florian Forster [Wed, 17 Nov 2010 09:09:47 +0000 (10:09 +0100)]
Bump version to 1.5.1; Update ChangeLog.

14 years agosrc/oping.c: Mark unused argument to avoid compiler warnings.
Florian Forster [Wed, 17 Nov 2010 09:02:56 +0000 (10:02 +0100)]
src/oping.c: Mark unused argument to avoid compiler warnings.

14 years agosrc/oping.c: Remove __attribute__ flags when using non-GNU compiler.
Florian Forster [Wed, 17 Nov 2010 09:02:37 +0000 (10:02 +0100)]
src/oping.c: Remove __attribute__ flags when using non-GNU compiler.

14 years agosrc/liboping.c: Always set the QoS member. Default to 0.
Florian Forster [Wed, 17 Nov 2010 08:01:19 +0000 (09:01 +0100)]
src/liboping.c: Always set the QoS member. Default to 0.

This should fix the following warning / error:
  liboping.c:599: warning: comparison is always true due to limited
    range of data type

Thanks to James Bromberger for reporting this!

14 years agooping: Add alias for the "Voice Admit" DSCP.
Florian Forster [Fri, 29 Oct 2010 08:09:58 +0000 (10:09 +0200)]
oping: Add alias for the "Voice Admit" DSCP.

14 years agoBump version to 1.5.0; Update ChangeLog. liboping-1.5.0
Florian Forster [Wed, 27 Oct 2010 13:40:32 +0000 (15:40 +0200)]
Bump version to 1.5.0; Update ChangeLog.

14 years agoping_iterator_get_info(3): Document the "PING_INFO_RECV_QOS" flag.
Florian Forster [Wed, 27 Oct 2010 13:40:06 +0000 (15:40 +0200)]
ping_iterator_get_info(3): Document the "PING_INFO_RECV_QOS" flag.

14 years agosrc/oping.h: Change the default payload message.
Florian Forster [Wed, 27 Oct 2010 13:18:15 +0000 (15:18 +0200)]
src/oping.h: Change the default payload message.

14 years agoMerge branch 'vm/qos'
Florian Forster [Wed, 27 Oct 2010 12:32:13 +0000 (14:32 +0200)]
Merge branch 'vm/qos'

14 years agooping(8): Document the displayed "qos=" field.
Florian Forster [Wed, 27 Oct 2010 12:31:54 +0000 (14:31 +0200)]
oping(8): Document the displayed "qos=" field.

14 years agosrc/oping.c: Only print QoS information if it's not 0/0.
Florian Forster [Wed, 27 Oct 2010 10:11:51 +0000 (12:11 +0200)]
src/oping.c: Only print QoS information if it's not 0/0.

14 years agoAUTHORS: Add Vladimir Melnikov.
Florian Forster [Wed, 27 Oct 2010 09:27:42 +0000 (11:27 +0200)]
AUTHORS: Add Vladimir Melnikov.

14 years agosrc/oping.c: Add function for formatted printing of the QoS byte.
Florian Forster [Wed, 27 Oct 2010 09:05:35 +0000 (11:05 +0200)]
src/oping.c: Add function for formatted printing of the QoS byte.

14 years agooping(8): Document the "be" and "cs<n>" DSCP abbreviations.
Florian Forster [Wed, 27 Oct 2010 08:30:40 +0000 (10:30 +0200)]
oping(8): Document the "be" and "cs<n>" DSCP abbreviations.

14 years agoRename "ToS" to "QoS" everywhere, to account for DSCP being used in IPv6 …
Florian Forster [Wed, 27 Oct 2010 07:59:09 +0000 (09:59 +0200)]
Rename "ToS" to "QoS" everywhere, to account for DSCP being used in IPv6 …

… and recommended for IPv4.

14 years agosrc/oping.c: Remove useless "strlen".
Florian Forster [Wed, 27 Oct 2010 07:53:18 +0000 (09:53 +0200)]
src/oping.c: Remove useless "strlen".

14 years agosrc/oping.c: Add the "be" and "cs[0-7]" DSCPs.
Florian Forster [Wed, 27 Oct 2010 06:58:08 +0000 (08:58 +0200)]
src/oping.c: Add the "be" and "cs[0-7]" DSCPs.

14 years agooping(8): Document the "-Q" option.
Florian Forster [Tue, 26 Oct 2010 16:22:37 +0000 (18:22 +0200)]
oping(8): Document the "-Q" option.

14 years agosrc/oping.c: Implement named arguments for DiffServ flags.
Florian Forster [Tue, 26 Oct 2010 15:42:38 +0000 (17:42 +0200)]
src/oping.c: Implement named arguments for DiffServ flags.

14 years agooping: Improve parsing of the "-z" argument.
Florian Forster [Tue, 26 Oct 2010 14:20:51 +0000 (16:20 +0200)]
oping: Improve parsing of the "-z" argument.

14 years agoFix printing the ToS value.
Florian Forster [Tue, 26 Oct 2010 13:49:09 +0000 (15:49 +0200)]
Fix printing the ToS value.

Apparently "%#04x" prints 0 as "0000" instead of "0x00". *sigh*

14 years agoping_set_tos: Improve error handling.
Florian Forster [Tue, 26 Oct 2010 13:48:24 +0000 (15:48 +0200)]
ping_set_tos: Improve error handling.

14 years agoping_receive_one: Fix a typo.
Florian Forster [Tue, 26 Oct 2010 13:47:49 +0000 (15:47 +0200)]
ping_receive_one: Fix a typo.

14 years agosrc/liboping.c: Fix building with debugging enabled.
Florian Forster [Tue, 26 Oct 2010 13:17:10 +0000 (15:17 +0200)]
src/liboping.c: Fix building with debugging enabled.

14 years agoRename "PING_INFO_TOS" → "PING_INFO_RECV_TOS".
Florian Forster [Tue, 26 Oct 2010 13:11:24 +0000 (15:11 +0200)]
Rename "PING_INFO_TOS" → "PING_INFO_RECV_TOS".

14 years agoping_setopt(3): Document the new "PING_OPT_TOS" option.
Florian Forster [Tue, 26 Oct 2010 13:10:04 +0000 (15:10 +0200)]
ping_setopt(3): Document the new "PING_OPT_TOS" option.

14 years agosrc/liboping.c: Set the "IP_RECVTOS" and "IPV6_RECVTCLASS" socket options.
Florian Forster [Tue, 26 Oct 2010 13:09:45 +0000 (15:09 +0200)]
src/liboping.c: Set the "IP_RECVTOS" and "IPV6_RECVTCLASS" socket options.

14 years agosrc/liboping.c: Use an uint8_t for storing the ToS.
Florian Forster [Tue, 26 Oct 2010 13:09:10 +0000 (15:09 +0200)]
src/liboping.c: Use an uint8_t for storing the ToS.

14 years agoImplement support for QoS / ToS fields.
Vladimir Melnikov [Tue, 26 Oct 2010 12:20:03 +0000 (14:20 +0200)]
Implement support for QoS / ToS fields.

Hello Florian,

I've made some functionality extension to debug QoS in the network -
ability to set tos (present in most standard "pings") and to verify
received tos field (didn't see any ping command with this feature).
May be it will need to someone else.

Best regards,
 Vladimir

14 years agosrc/Makefile.am: Use "LDADD" for applications, "LIBADD" for the library.
Florian Forster [Tue, 13 Jul 2010 14:07:53 +0000 (16:07 +0200)]
src/Makefile.am: Use "LDADD" for applications, "LIBADD" for the library.

Use "LDFLAGS" only for "-version-info".

14 years agoRelicense: Use the LGPL v2.1 (or later) for liboping.
Florian Forster [Sun, 27 Jun 2010 09:52:01 +0000 (11:52 +0200)]
Relicense: Use the LGPL v2.1 (or later) for liboping.

The "oping" and "noping" utilities are still GPL v2.

Sebastian Harl, the only other copyright holder on the library, agrees
with this license change.

14 years agooping(8): Document the colors used by noping. liboping-1.4.0
Florian Forster [Sun, 13 Jun 2010 18:33:57 +0000 (20:33 +0200)]
oping(8): Document the colors used by noping.

14 years agoBumbed version to 1.4.0, updated ChangeLog.
Florian Forster [Sun, 13 Jun 2010 17:58:30 +0000 (19:58 +0200)]
Bumbed version to 1.4.0, updated ChangeLog.

14 years agooping(8): Document "noping", too.
Florian Forster [Sun, 13 Jun 2010 17:50:26 +0000 (19:50 +0200)]
oping(8): Document "noping", too.

14 years agoREADME: Document "oping" and "noping".
Florian Forster [Sun, 13 Jun 2010 17:47:55 +0000 (19:47 +0200)]
README: Document "oping" and "noping".

14 years agoREADME: Convert to Unicode.
Florian Forster [Sun, 13 Jun 2010 17:39:30 +0000 (19:39 +0200)]
README: Convert to Unicode.

14 years agosrc/oping.c: Define NCURSES_OPAQUE.
Florian Forster [Sun, 13 Jun 2010 17:35:29 +0000 (19:35 +0200)]
src/oping.c: Define NCURSES_OPAQUE.

14 years agosrc/oping.c: Resizing the scrolling region seems to work with this parameters.
Florian Forster [Sat, 12 Jun 2010 14:04:02 +0000 (16:04 +0200)]
src/oping.c: Resizing the scrolling region seems to work with this parameters.

I don't understand what I'm doing different to previously, but whatever
it is it seems to do the trick.

14 years agonoping: Further cleanup of the curses stuff.
Florian Forster [Fri, 11 Jun 2010 22:28:01 +0000 (00:28 +0200)]
noping: Further cleanup of the curses stuff.

14 years agonoping: Use colors to highlight "unusual" response times.
Florian Forster [Tue, 8 Jun 2010 16:43:11 +0000 (18:43 +0200)]
noping: Use colors to highlight "unusual" response times.

14 years agonoping: Print host name in bold.
Florian Forster [Tue, 8 Jun 2010 16:04:11 +0000 (18:04 +0200)]
noping: Print host name in bold.

14 years agonoping: Handle resizing of X windows gracefully.
Florian Forster [Tue, 8 Jun 2010 15:52:38 +0000 (17:52 +0200)]
noping: Handle resizing of X windows gracefully.

14 years agosrc/oping.c: Move "context_get_packet_loss" into a separate function.
Florian Forster [Tue, 8 Jun 2010 14:02:46 +0000 (16:02 +0200)]
src/oping.c: Move "context_get_packet_loss" into a separate function.

14 years agosrc/oping.c: Move calculation of average and stddev to separate functions.
Florian Forster [Tue, 8 Jun 2010 08:20:59 +0000 (10:20 +0200)]
src/oping.c: Move calculation of average and stddev to separate functions.

14 years agosrc/oping.c: Add ncurses based front-end.
Florian Forster [Tue, 8 Jun 2010 07:37:33 +0000 (09:37 +0200)]
src/oping.c: Add ncurses based front-end.

14 years agosrc/oping.c: Move printing header and footer into separate functions.
Florian Forster [Tue, 8 Jun 2010 07:27:48 +0000 (09:27 +0200)]
src/oping.c: Move printing header and footer into separate functions.

14 years agocontrib/liboping.spec: Added "provided as is" header.
Florian Forster [Tue, 26 Jan 2010 20:11:51 +0000 (21:11 +0100)]
contrib/liboping.spec: Added "provided as is" header.

14 years agocontrib/liboping.spec: Added example spec file.
Benjamin Petrin [Tue, 26 Jan 2010 20:06:13 +0000 (21:06 +0100)]
contrib/liboping.spec: Added example spec file.

I'm using collectd and the ping plugin for a project I'm working on. I noticed
that collectd is distributing a starter spec file for building RPMs but that
there wa s no such spec file for liboping. I created one which I have attached
to this email. I'm not too familiar with creating RPMs but I think it's a good
start and I was able to get a package built and installed using it. I'm giving
it to you so if you wish to put in on your website for others to start with
when creating packages t hen you may. I hope others may find this useful.

14 years agominor doc fixes for liboping
Vadim Zeitlin [Sun, 20 Dec 2009 20:45:48 +0000 (21:45 +0100)]
minor doc fixes for liboping

 Hello,

 I was reading the documentation of your liboping library as I'd like to
use it for a small project of mine and couldn't help noticing a few typos
in the docs, please find attached a tiny patch fixing them.

 Thanks for writing this library!
VZ

Signed-off-by: Florian Forster <octo@verplant.org>
14 years agoChangeLog: Oops, there were actually a couple more changes in that release. liboping-1.3.4
Florian Forster [Sun, 20 Dec 2009 11:13:28 +0000 (12:13 +0100)]
ChangeLog: Oops, there were actually a couple more changes in that release.

14 years agoBumped version to 1.3.4 and updated ChangeLog.
Florian Forster [Sun, 20 Dec 2009 09:25:51 +0000 (10:25 +0100)]
Bumped version to 1.3.4 and updated ChangeLog.

14 years agosrc/liboping.c: ping_receive_all: Clear the timer when a FD signals an error.
Florian Forster [Thu, 10 Dec 2009 15:43:54 +0000 (16:43 +0100)]
src/liboping.c: ping_receive_all: Clear the timer when a FD signals an error.

The loop likely never ends if the error isn't handled, so the least we
can do is ignore the file descriptor in the future.

15 years agobindings/perl: Bumped version to 1.21 and updated Changes.
Florian Forster [Thu, 1 Oct 2009 12:33:02 +0000 (14:33 +0200)]
bindings/perl: Bumped version to 1.21 and updated Changes.

15 years agobindings/perl/Oping.xs: Fix an off-by-one error when allocating a Perl string.
Fredrik Soderblom [Thu, 1 Oct 2009 12:24:46 +0000 (14:24 +0200)]
bindings/perl/Oping.xs: Fix an off-by-one error when allocating a Perl string.

In the previous code the null byte was included in the Perl string,
making the string handling awkward.

15 years agooping: Temporarily drop privileges if supported by the system.
Florian Forster [Thu, 1 Oct 2009 08:28:10 +0000 (10:28 +0200)]
oping: Temporarily drop privileges if supported by the system.

This tries to solve the read-from-any-file-issue more elegantly by
dropping privileges first thing after start-up and regaining privileges
just to open the sockets.

This has the advantage that the "-f" option is available for all users
again and files are opened according to *their* permissions.

Systems not supporting the _POSIX_SAVED_IDS feature still behave as
before, i. e. if real and effective user IDs don't match, only "-" may
be specified as input file.

15 years agoChangeLog: Updated the changelog to reflect the last change. liboping-1.3.3
Florian Forster [Tue, 29 Sep 2009 16:10:57 +0000 (18:10 +0200)]
ChangeLog: Updated the changelog to reflect the last change.

15 years agooping: Allow “-f -” even if uid and euid differ.
Florian Forster [Tue, 29 Sep 2009 16:09:27 +0000 (18:09 +0200)]
oping: Allow “-f -” even if uid and euid differ.

Thanks to Sebastian for the idea :)

15 years agoBumped version to 1.3.3; Updated ChangeLog.
Florian Forster [Tue, 29 Sep 2009 16:00:25 +0000 (18:00 +0200)]
Bumped version to 1.3.3; Updated ChangeLog.

15 years agooping: Disable the “-f” option when real and effective user IDs don't match.
Florian Forster [Tue, 29 Sep 2009 15:44:05 +0000 (17:44 +0200)]
oping: Disable the “-f” option when real and effective user IDs don't match.

Thanks to Steve Kemp who reported this issue as Debian bug #548684.
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548684>

15 years agoBumped version to 1.3.2; Updated ChangeLog. liboping-1.3.2
Florian Forster [Mon, 27 Jul 2009 08:31:11 +0000 (10:31 +0200)]
Bumped version to 1.3.2; Updated ChangeLog.

15 years agosrc/oping.h: Do not check HAVE_*_H for system headers.
Sebastian Harl [Wed, 22 Jul 2009 13:35:55 +0000 (15:35 +0200)]
src/oping.h: Do not check HAVE_*_H for system headers.

Imho, this is not a good thing to do for an installed header since it requires
every user to define those macros as well.

15 years agoping_iterator_get_info(3): Document missing functionality under Debian Etch. liboping-1.3.1
Florian Forster [Mon, 20 Jul 2009 12:18:09 +0000 (14:18 +0200)]
ping_iterator_get_info(3): Document missing functionality under Debian Etch.

15 years agoCOPYING: Add GPLv2.
Florian Forster [Mon, 20 Jul 2009 11:53:52 +0000 (13:53 +0200)]
COPYING: Add GPLv2.

15 years agoBumped version to 1.3.1; Updated ChangeLog.
Florian Forster [Mon, 20 Jul 2009 11:51:23 +0000 (13:51 +0200)]
Bumped version to 1.3.1; Updated ChangeLog.

15 years agosrc/liboping.c: Fixed argument verification.
Sebastian Harl [Mon, 20 Jul 2009 07:40:32 +0000 (09:40 +0200)]
src/liboping.c: Fixed argument verification.

ping_iterator_get_info()'s 'buffer' argument _may_ be NULL, since the user
might only be interested in the size of the (to be) returned value. If
'buffer' is NULL, '*buffer_len' should be 0, though, to make sure nothing gets
written to 'buffer'.

This bug was introduced in commit 9ae85a09d919777c9be52e55b23c08bf2c8c1d0e.

15 years agoNet::Oping: Set the $VERSION variable correctly. liboping-1.3.0
Florian Forster [Sat, 18 Jul 2009 14:15:41 +0000 (16:15 +0200)]
Net::Oping: Set the $VERSION variable correctly.

15 years ago.gitignore: Add tarballs.
Florian Forster [Sat, 18 Jul 2009 13:04:17 +0000 (15:04 +0200)]
.gitignore: Add tarballs.

15 years agoChangeLog: Updated the date of the 1.3.0 entry.
Florian Forster [Sat, 18 Jul 2009 13:02:07 +0000 (15:02 +0200)]
ChangeLog: Updated the date of the 1.3.0 entry.

15 years agoNet::Oping: Bumped version to 1.20.
Florian Forster [Sat, 18 Jul 2009 12:59:55 +0000 (14:59 +0200)]
Net::Oping: Bumped version to 1.20.

15 years agoNet::Oping: Add the `device' method.
Florian Forster [Sat, 18 Jul 2009 12:59:16 +0000 (14:59 +0200)]
Net::Oping: Add the `device' method.

15 years agosrc/oping.h: Update OPING_VERSION.
Florian Forster [Sat, 18 Jul 2009 12:53:17 +0000 (14:53 +0200)]
src/oping.h: Update OPING_VERSION.

15 years agoBumped version to 1.3.0; Updated ChangeLog.
Florian Forster [Fri, 17 Jul 2009 12:59:15 +0000 (14:59 +0200)]
Bumped version to 1.3.0; Updated ChangeLog.

15 years agoMerge branch 'liboping-1.2'
Florian Forster [Fri, 17 Jul 2009 12:53:04 +0000 (14:53 +0200)]
Merge branch 'liboping-1.2'

15 years agosrc/oping.c: Added -D <interface name> command line option.
Sebastian Harl [Fri, 17 Jul 2009 12:14:18 +0000 (14:14 +0200)]
src/oping.c: Added -D <interface name> command line option.

This option sets the outgoing network device to use.

I decided not to reuse the -I command line option for that purpose (which is
what GNU ping is doing), for the following reasons:

 * In theory, an interface name could be confused with a host name.
 * Imho, it's better to specify things explicitly.
 * This approach is more flexible.

15 years agoAdded support for PING_OPT_DEVICE.
Sebastian Harl [Fri, 17 Jul 2009 12:05:17 +0000 (14:05 +0200)]
Added support for PING_OPT_DEVICE.

This option may be used to set the outgoing network device to be used. The
value passed must be a char-pointer to a null-terminated string specifying an
interface name (e.g. eth0).

Please note that this might not be supported by all operating systems. In that
case, ping_setopt() sets the error to "operation not supported".

15 years agosrc/liboping.c: Catch NULL pointers passed to public functions. liboping-1.2
Sebastian Harl [Fri, 17 Jul 2009 12:41:12 +0000 (14:41 +0200)]
src/liboping.c: Catch NULL pointers passed to public functions.

Libraries should not segfault - ever - no matter what a user is doing and how
stupid that might be.

15 years agoAdded .gitignore.
Sebastian Harl [Fri, 17 Jul 2009 12:20:01 +0000 (14:20 +0200)]
Added .gitignore.

15 years agosrc/liboping.c: Let ping_setopt() return -1 if 'value' is NULL.
Sebastian Harl [Fri, 17 Jul 2009 08:05:38 +0000 (10:05 +0200)]
src/liboping.c: Let ping_setopt() return -1 if 'value' is NULL.

The manpage states that 'value' must not be NULL. Anyway, imho, it's still
better to avoid segfaults inside a library.

15 years agosrc/liboping.c: Fix some format strings.
Florian Forster [Fri, 17 Jul 2009 12:32:56 +0000 (14:32 +0200)]
src/liboping.c: Fix some format strings.

15 years agosrc/liboping.c: Fixed the handling of multiple hosts.
Sebastian Harl [Fri, 17 Jul 2009 07:41:58 +0000 (09:41 +0200)]
src/liboping.c: Fixed the handling of multiple hosts.

ping_receive_all() used to always pass the first host object to
ping_receive_one() which used that host object to determine the expected
address family. Thus, when pinging v4 and v6 hosts in parallel, some of them
would have never been considered but assumed to be timed out.

While at it, the code has been clarified in regard to matching an ECHO_REPLY
with the appropriate host object.

15 years agosrc/liboping.c: Do not reset recv_ttl in ping_receive_one().
Sebastian Harl [Fri, 17 Jul 2009 07:39:35 +0000 (09:39 +0200)]
src/liboping.c: Do not reset recv_ttl in ping_receive_one().

Instead, reset the value of all host object in ping_receive_all().

ping_receive_one() does not necessarily get a pointer to the host object for
which we receive a reply, since ICMP messages may be received on _any_ raw
socket.

15 years agoMinor documentation fixes.
Sebastian Harl [Sat, 6 Jun 2009 19:25:38 +0000 (21:25 +0200)]
Minor documentation fixes.

15 years agosrc/oping.c: Exit successfully when using the -h option.
Sebastian Harl [Sat, 6 Jun 2009 19:21:28 +0000 (21:21 +0200)]
src/oping.c: Exit successfully when using the -h option.

15 years agosrc/oping.c: Improved the help output.
Sebastian Harl [Sat, 6 Jun 2009 19:18:23 +0000 (21:18 +0200)]
src/oping.c: Improved the help output.

A short description has been added for each option. Also, print the program
version and author.

15 years agosrc/oping.c: Improved and unified error messages when parsing CL options.
Sebastian Harl [Sat, 6 Jun 2009 19:09:33 +0000 (21:09 +0200)]
src/oping.c: Improved and unified error messages when parsing CL options.

15 years agoBumped version to 1.2.0; Updated ChangeLog. liboping-1.2.0
Florian Forster [Wed, 15 Jul 2009 12:13:29 +0000 (14:13 +0200)]
Bumped version to 1.2.0; Updated ChangeLog.