src/liboping.c: Declare a variable at the shortest possible scope.
src/liboping.c: Use sizeof(*ptr) instead of sizeof(type_t).
Also remove an unnecessary cast from void* to pingobj_t*.
Also remove an unnecessary cast from void* to pingobj_t*.
src/liboping.c: Use composite literals when calling setsockopt().
src/liboping.c: Don't check for NULL when calling free().
free(3) handles NULL pointers correctly, so these checks are not needed.
free(3) handles NULL pointers correctly, so these checks are not needed.
Merge remote-tracking branch 'github/pr/11'
Bump ABI version.
The new symbol ping_iterator_count() was introduced in
7950f924afbd902b506bbaedfc5f7f1bce6eacc9.
Pull-Request: #23
The new symbol ping_iterator_count() was introduced in
7950f924afbd902b506bbaedfc5f7f1bce6eacc9.
Pull-Request: #23
Add perl binding and documentation for new ping_iterator_count function
Fix up code style
Handle duplicate hosts without visual corruption
Add a helper to count the size of an iterator
Clean up screen in the case where we are adding a new row
Merge remote-tracking branch 'github/pr/20'
configure: Check if PKG_INSTALLDIR is defined before using it.
Add .travis.yml
src/liboping.c: Ensure ping_send() returns non-zero on success.
This is the documented behavior.
This is the documented behavior.
src/liboping.c: Fix debugging statement.
The dprintf() macro referred to a variable which no longer exists,
which only surfaced when compiling with --enable-debug.
The dprintf() macro referred to a variable which no longer exists,
which only surfaced when compiling with --enable-debug.
src/liboping.c: Refactor ping_send() further.
* Give more meaningful names to the central "ptr" and "pings" variables
(now "host_to_ping" and "pings_in_flight").
* Remove special case for (errno == EINTR); effectively we only printed a
different debugging message in that case.
* Remove err_fds. We were not checking it at all.
* Simplify the logic so only one receive or send operation happens per
loop iteration. Previously, one IPv4 and one IPv6 operation might happen
in the same loop iteration. The new logic always receives all replies
before starting to send out more requests.
* Assign the write file descriptor to its own variable to make clear that
only file descriptor is set in the write_fds bitmask.
* Give more meaningful names to the central "ptr" and "pings" variables
(now "host_to_ping" and "pings_in_flight").
* Remove special case for (errno == EINTR); effectively we only printed a
different debugging message in that case.
* Remove err_fds. We were not checking it at all.
* Simplify the logic so only one receive or send operation happens per
loop iteration. Previously, one IPv4 and one IPv6 operation might happen
in the same loop iteration. The new logic always receives all replies
before starting to send out more requests.
* Assign the write file descriptor to its own variable to make clear that
only file descriptor is set in the write_fds bitmask.
src/liboping.c: Start refactoring ping_send().
* Avoid the unnecessary copies of obj->head (ph), obj->fd4 (fd4) and
obj->fd6 (fd6). Assigning these to local variables suggests that the
decoupling is necessary, which is confusing when this is not really the
case.
* Only scan for IPv4 and IPv6 hosts when resetting their latency and TTL
and make sure appropriate sockets are open outside of the loop. This
makes it easier to read and understand under which circumstances which
socket is opened.
* Move some variables to inside the while loop.
* Avoid the unnecessary copies of obj->head (ph), obj->fd4 (fd4) and
obj->fd6 (fd6). Assigning these to local variables suggests that the
decoupling is necessary, which is confusing when this is not really the
case.
* Only scan for IPv4 and IPv6 hosts when resetting their latency and TTL
and make sure appropriate sockets are open outside of the loop. This
makes it easier to read and understand under which circumstances which
socket is opened.
* Move some variables to inside the while loop.
src/liboping.c: Document ping_open_socket().
Also make sure that obj->errmsg is set on all error paths and evaluate
errno as soon as possible so that calls to close() and such don't reset it.
Also make sure that obj->errmsg is set on all error paths and evaluate
errno as soon as possible so that calls to close() and such don't reset it.
src/liboping.c: Improve coding style.
Don't have the if-condition and if-body in the same line.
Don't have the if-condition and if-body in the same line.
src/liboping.c: Clean up untidy whitespace.
Merge remote-tracking branch 'github/master' into lh/performance
Improve docstring of the history_received field.
Refactor context_create().
Assure that no large file descriptors are passed to FD_SET().
When passing a large file descriptor, on many systems large means >= 1024,
FD_SET()s behavior is undefined. Mostly, it will corrupt the stack
because an out-of-bounds bit is flipped.
When passing a large file descriptor, on many systems large means >= 1024,
FD_SET()s behavior is undefined. Mostly, it will corrupt the stack
because an out-of-bounds bit is flipped.
src/oping.c: Coding style fixes.
This also removes a "for loop initial declaration" which GCC complains
about when not in C99 mode. *sigh*
This also removes a "for loop initial declaration" which GCC complains
about when not in C99 mode. *sigh*
Use the correct macro for hostname max length
Whitespace changes
* Ensure that all touched lines use tabs for indentation
* Ensure operators have visible spaces around them
* Ensure that all touched lines use tabs for indentation
* Ensure operators have visible spaces around them
Merge commit 'refs/pull/15/head' of github.com:octo/liboping
Merge commit 'refs/pull/18/head' of github.com:octo/liboping
Fixes: #17
Fixes: #17
oping: Uset gettimeofday(2) instead of clock_gettime(2).
clock_gettime is not available on Mac OS X :(
Fixes: #19
clock_gettime is not available on Mac OS X :(
Fixes: #19
Document the live add key press
Remove attempt to scroll old data in main window
Allow adding a new host after noping has started
Ensure that impossibly latency values do not affect stats
Remove unused variable
Modified noping to follow terminal emulators color palette
configure: Make use of ncurses configurable
When ncurses is found the current build system will use it to build the
"noping" utility. However, that will create an automagic dependencies on
ncurses which is a problem for some distributions.
This commit adds the ability to control the ncurses usage:
a) If the user calls "configure" like before nothing changes: Configure
tries to find a suitable ncurses installation to build "noping". If
not found build system will just skip building of "noping" utility.
b) If the user calls "configure" with new "--with-ncurses" option,
configure will now fail if no suitable ncurses installation was
found.
c) If the user calls "configure" with new "--without-ncurses" option, the
build system will now skip building of "noping" utility and ncurses
will not be used.
In addition, this commit also changes the way configure will detect
ncurses: Configure now tries to use pkg-config to find ncurses but still
falls back to previous legacy checks. This will add support for ncurses
installation built with "--with-termlib" which causes several symbols to
get moved from libncurses.so to libtinfo.so.
When ncurses is found the current build system will use it to build the
"noping" utility. However, that will create an automagic dependencies on
ncurses which is a problem for some distributions.
This commit adds the ability to control the ncurses usage:
a) If the user calls "configure" like before nothing changes: Configure
tries to find a suitable ncurses installation to build "noping". If
not found build system will just skip building of "noping" utility.
b) If the user calls "configure" with new "--with-ncurses" option,
configure will now fail if no suitable ncurses installation was
found.
c) If the user calls "configure" with new "--without-ncurses" option, the
build system will now skip building of "noping" utility and ncurses
will not be used.
In addition, this commit also changes the way configure will detect
ncurses: Configure now tries to use pkg-config to find ncurses but still
falls back to previous legacy checks. This will add support for ncurses
installation built with "--with-termlib" which causes several symbols to
get moved from libncurses.so to libtinfo.so.
Merge branch 'pr/6'
add bell output on successful pings
the rationale here is that it's actually pretty hard to do this with a
regular ping. you need a silly shell loop and it doesn't always work
right everywhere, because the output of the system ping is
platform-dependant. it also buffers stdout in some weird ways sometimes.
therefore, i think it's a great addition to oping.
the purpose of this is that it can be useful to "hear" ping packets
come back when doing network diagnostics. obviously, this will be
useless in finding out *failed* hosts if multiple hosts are selected,
as any sucessful host will produce a beep. but it can nevertheless be
used to trace network cables or problems without looking at the
console. i also use audible pings to let me know when a hosts returns
after a reboot.
Note that I had to struggle quite a bit to make my terminal bell work,
the following articles were used to generate documentation on how to
make that work reliably:
https://askubuntu.com/questions/228096/terminal-bell-doesnt-ring
also see the following for the original inspiration for this:
http://catb.org/jargon/html/P/ping.html
https://groups.google.com/forum/#!msg/comp.sys.next/JDaeD8oqarU/v8xaDS8kXM0J
the rationale here is that it's actually pretty hard to do this with a
regular ping. you need a silly shell loop and it doesn't always work
right everywhere, because the output of the system ping is
platform-dependant. it also buffers stdout in some weird ways sometimes.
therefore, i think it's a great addition to oping.
the purpose of this is that it can be useful to "hear" ping packets
come back when doing network diagnostics. obviously, this will be
useless in finding out *failed* hosts if multiple hosts are selected,
as any sucessful host will produce a beep. but it can nevertheless be
used to trace network cables or problems without looking at the
console. i also use audible pings to let me know when a hosts returns
after a reboot.
Note that I had to struggle quite a bit to make my terminal bell work,
the following articles were used to generate documentation on how to
make that work reliably:
https://askubuntu.com/questions/228096/terminal-bell-doesnt-ring
also see the following for the original inspiration for this:
http://catb.org/jargon/html/P/ping.html
https://groups.google.com/forum/#!msg/comp.sys.next/JDaeD8oqarU/v8xaDS8kXM0J
src/liboping.c: Simplify packet creation and parsing.
src/liboping.c: Replace sizeof(struct icmphdr) with ICMP_MINLEN.
The definitions of struct icmphdr differ between platforms, while
ICMP_MINLEN is always 8, which is what we need here.
The definitions of struct icmphdr differ between platforms, while
ICMP_MINLEN is always 8, which is what we need here.
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.
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.
Fixed wrong icmp header length (20 extra zeros incorrectly appended to header)
configure: also check for clockgettime()
clock_gettime() is also in -lrt so we also need to
check for it.
Use AC_SEARCH_LIBS() instead of our canned combo of
AC_CHECK_FUNC() + AC_CHECK_LIB(). AC_SEARCH_LIBS()
will automatically add the necessary -l flags to the
LIBS variable, so we don't need out AM_CONDITIONAL()
construct either, now.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
clock_gettime() is also in -lrt so we also need to
check for it.
Use AC_SEARCH_LIBS() instead of our canned combo of
AC_CHECK_FUNC() + AC_CHECK_LIB(). AC_SEARCH_LIBS()
will automatically add the necessary -l flags to the
LIBS variable, so we don't need out AM_CONDITIONAL()
construct either, now.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
src/oping.c: Add missing "break" in handling of the "O" option.
src/oping.c: Actually _comma_ separate output lines.
src/oping.c: Fix calculation of fractional time.
It's "ns", not "us", stoopid!
It's "ns", not "us", stoopid!
Update copyright notices.
Bump version to 1.9.0; Update ChangeLog.
src/oping.c: Implement the "-O" option.
This new option allows to write RTT measurements to a CSV file for later
reporting.
This new option allows to write RTT measurements to a CSV file for later
reporting.
src/oping.c: Code style fixes.
oping(1): Document the "-m <mark>" command line option.
oping(1): Correct the lower bound of the box plot.
oping(1): Document the "-w timeout" option.
Merge branches 'mark' and 'timeout'
src/oping.c: Minor coding style changes.
Implement the "-w <timeout>" command line option.
oping: Add the "-m <mark>" command line option.
This exposes the new "MARK" functionatlity to command line users.
This exposes the new "MARK" functionatlity to command line users.
liboping: Add support for SO_MARK.
Marks packets, which can be used for filtering and routing in Linux.
Marks packets, which can be used for filtering and routing in Linux.
oping(1): Update fping's URL.
Thanks to Vincent Legout for reporting this issue.
Thanks to Vincent Legout for reporting this issue.
Change the project's website to noping.cc/ everywhere.
Also change my preferred email address.
Also change my preferred email address.
Bump version to 1.8.0; Update ChangeLog.
src/oping.c: Fix status output.
This is a really dirty hack: If the percentile and/or median output
decreases, the output may have less characters than previously. Add
spaces at the end of the string to clear digits with may have been
there, to avoid the "maximum" value be appear to go through the roof.
This is a really dirty hack: If the percentile and/or median output
decreases, the output may have less characters than previously. Add
spaces at the end of the string to clear digits with may have been
there, to avoid the "maximum" value be appear to go through the roof.
src/oping.c: Fix pretty ping graph movement.
Fixed the wrap-around case and adds support for windows larger than the
history size.
Fixed the wrap-around case and adds support for windows larger than the
history size.
src/oping.c: Improve comments.
Also remove dead code.
Also remove dead code.
src/oping.c: Change the order of graphs.
src/oping.c: Switch graphs when pressing "g".
src/oping.c: Rewrite of the percentile code.
Rather than bucketizing RTTs and approximating the percentile, keep the
last 900 replies (15 minutes by default) in memory and calculate the
percentile from that.
This allows the "prettyping" graph to "move to the left", which is a much
nicer user experience IMHO.
Rather than bucketizing RTTs and approximating the percentile, keep the
last 900 replies (15 minutes by default) in memory and calculate the
percentile from that.
This allows the "prettyping" graph to "move to the left", which is a much
nicer user experience IMHO.
src/oping.c: Add median and 'n'th percentile, remove average and stddev.
Average and standard deviation are not very useful for network latency.
Median and (95th) percentiles are routinely used to measure network
performance, so provide them instead.
Average and standard deviation are not very useful for network latency.
Median and (95th) percentiles are routinely used to measure network
performance, so provide them instead.
src/oping.c: Exit early if no host could be resolved.
Otherwise "noping" would drop the user into an empty ncurses window,
which is very confusing, annoying and unexpected.
Otherwise "noping" would drop the user into an empty ncurses window,
which is very confusing, annoying and unexpected.
src/oping.c: Define thresholds for coloring green and yellow in a central place.
src/oping.c: Make sure the reported percentile value doesn't exceed the maximum.
noping: Color response times based on their percentile.
Update the histogram's "ratio" array after ever response and use that to
color the response time in the noping application.
Update the histogram's "ratio" array after ever response and use that to
color the response time in the noping application.
oping manual page: Document the "-g histogram" option.
src/oping.c: Add a "-g histrogram" option.
noping: Add the "-g" option.
Initial implementation of a box plot.
Still needs a command line switch and documentation.
Still needs a command line switch and documentation.
oping, noping: Implement percentile reporting.
configure.ac: Change homepage and bug report address.
liboping.pc: Let configure create the pkg-config file.
Bump version to 1.7.0; Update ChangeLog.
Merge pull request #4 from barak/upstream
minor build system tweaks, to generate oping.pc file for pkg-config oping
minor build system tweaks, to generate oping.pc file for pkg-config oping
Merge branch 'bp/exit'
Conflicts:
src/mans/oping.pod
src/oping.c
Conflicts:
src/mans/oping.pod
src/oping.c
Merge branch 'ab/prettyping'
Make the prettyping output work with and without colors.
simplify autogen.sh
generate and install oping.pc file, for pkg-config oping
add bug email and project url to configure.ac AC_INIT
ping_receive_all(): Return immediately when select(2) is interrupted.
Previously the function would continue and only return when all hosts
were received or a timeout occurred. This meant that hitting ^C would
only stop "oping" after half a second or so. This this, oping also exits
immediately.
Previously the function would continue and only return when all hosts
were received or a timeout occurred. This meant that hitting ^C would
only stop "oping" after half a second or so. This this, oping also exits
immediately.
Add support for both, ncurses and ncursesw.
Add documentation for the "-u" and "-U" options.
src/oping.h: Don't use the ncurses internal _nc_unicode_locale() function.
The "-u" and "-U" options are now handled in a single variable so that the
last option "wins".
The "-u" and "-U" options are now handled in a single variable so that the
last option "wins".
add commandline flag for forcing or disabling unicode
note that "forcing" may not work: ncurses still expects your locale to
be correct, so maybe the force flag should also explicitely set a utf8
locale?
note that "forcing" may not work: ncurses still expects your locale to
be correct, so maybe the force flag should also explicitely set a utf8
locale?
move unicode detection to a separate function
this will ease transition to a commandline option override
this will ease transition to a commandline option override
autodetect unicode, and fallback to ACS scancodes on failure
this is fairly ugly - we use a hidden ncurses function to detect
unicode (but at least we don't reimplement it), then we mess around
with the character arrays to display the rights symbols
i am not sure i like this, but i prefer to braindump than to stall, so
let's move forward.
this is fairly ugly - we use a hidden ncurses function to detect
unicode (but at least we don't reimplement it), then we mess around
with the character arrays to display the rights symbols
i am not sure i like this, but i prefer to braindump than to stall, so
let's move forward.
Refactor the graph printing into its own function.
This makes it much easier and cleaner to add a second, non-Unicode
implementation and possibly even a non-color version.
This makes it much easier and cleaner to add a second, non-Unicode
implementation and possibly even a non-color version.
switch to ncursesw in the build chain
Merge remote-tracking branch 'anarcat/autogen'
ignore generated file