]> git.ipfire.org Git - thirdparty/mtr.git/log
thirdparty/mtr.git
8 years agobuild-sys: tell function locality explicitly 143/head
Sami Kerola [Sun, 21 Aug 2016 19:33:43 +0000 (20:33 +0100)] 
build-sys: tell function locality explicitly

Most of the function prototypes in header files are indeed external, with
few exceptions that can be set to local scope with static key word.
Additionally get rid of net_duplicate() prototype that does not exist
anywhere.

8 years agobuild-sys: use system getopt_long() when it is available
Sami Kerola [Sun, 21 Aug 2016 18:32:38 +0000 (19:32 +0100)] 
build-sys: use system getopt_long() when it is available

And move the getopt sources to portability support directory.

8 years agocleanup: move max port number to be a define in net.h
Sami Kerola [Sun, 21 Aug 2016 17:32:16 +0000 (18:32 +0100)] 
cleanup: move max port number to be a define in net.h

8 years agousage: use error(3) error-reporting function
Sami Kerola [Sun, 21 Aug 2016 17:13:53 +0000 (18:13 +0100)] 
usage: use error(3) error-reporting function

There are two benefits of using error(3).  First of all this function
unifies error printing nice way, and when done this way a programmer cannot
accidentally mix stderr and stdout error print outs.  Secondly the error(3)
appends program name to errors, making it clear what printed an error.  To
demonstrate this see below for old and new output, in which the old error
could have in theory been reported by sudo(8).

$ sudo mtr -u -T # old
-u , -T and -S are mutually exclusive.

$ sudo ./mtr -u -T # new
./mtr: -u , -T and -S are mutually exclusive

8 years agousage: be careful when parsing numeric user input
Sami Kerola [Sun, 21 Aug 2016 10:49:49 +0000 (11:49 +0100)] 
usage: be careful when parsing numeric user input

Functions atoi(3) and atof(3) do not perform any error checking.  Use
strtol(3) function family, with alterations to fail if input is not
expected.

8 years agoMerge pull request #142 from kerolasa/pkg-config
rewolff [Sun, 21 Aug 2016 16:05:06 +0000 (18:05 +0200)] 
Merge pull request #142 from kerolasa/pkg-config

configuration cleanup, Pkg config.

8 years agocleanup: remove preprocessor missing functions go-arounds 142/head
Sami Kerola [Sun, 21 Aug 2016 09:53:16 +0000 (10:53 +0100)] 
cleanup: remove preprocessor missing functions go-arounds

Calling empty functions when there is no support is messy, and harder to
read than not calling at all functionality that is not present.

8 years agousage: reflect ./configure choices in available command line options
Sami Kerola [Sun, 21 Aug 2016 09:00:11 +0000 (10:00 +0100)] 
usage: reflect ./configure choices in available command line options

Features that are turned off should not be available to users as an options.
This commit also ensures matching long and short options, and makes the
long-only --displaymode option to be totally unreachable with short options.

8 years agocleanup: remove obsolete herror() function
Sami Kerola [Sat, 20 Aug 2016 08:17:06 +0000 (09:17 +0100)] 
cleanup: remove obsolete herror() function

Applications should use getaddrinfo(3), getnameinfo(3), and gai_strerror(3)
instead.  Systems without getaddrinfo() are from now on considered too
broken to be supported.  These include for example platforms: HP-UX 11.11,
IRIX 6.5, OSF/1 5.1, Solaris 7, Cygwin 1.5.x, mingw, MSVC 9, Interix 3.5,
and BeOS.

8 years agobuild-sys: remove unused autoconf check values
Sami Kerola [Sat, 20 Aug 2016 08:09:01 +0000 (09:09 +0100)] 
build-sys: remove unused autoconf check values

Return values from checks are not used anywhere in this project.

8 years agobuild-sys: simplify finding resolver library
Sami Kerola [Sat, 20 Aug 2016 08:06:28 +0000 (09:06 +0100)] 
build-sys: simplify finding resolver library

8 years agocleanup: remove NO_SPLIT preprocessor check
Sami Kerola [Thu, 18 Aug 2016 21:36:18 +0000 (22:36 +0100)] 
cleanup: remove NO_SPLIT preprocessor check

Apparently ./configure --without-split was planned to be added in commit
433bf6c22ce90e25f3ffb0b4852631e5724ac608 but that has not happen in 17
years.  Time has come to get rid of a half implemented idea.

8 years agobuild-sys: get rid of double negative ipinfo autotools settings
Sami Kerola [Thu, 18 Aug 2016 21:22:56 +0000 (22:22 +0100)] 
build-sys: get rid of double negative ipinfo autotools settings

8 years agobuild-sys: use pkg-config to find ncurses
Sami Kerola [Thu, 18 Aug 2016 20:52:39 +0000 (21:52 +0100)] 
build-sys: use pkg-config to find ncurses

The curses function attron() has been part of posix since 1997.  There is no
need to go-around for it.

Reference: http://pubs.opengroup.org/onlinepubs/7908799/xcurses/attron.html

8 years agobuild-sys: use pkg-config to find gtk+-2.0
Sami Kerola [Thu, 18 Aug 2016 20:34:36 +0000 (21:34 +0100)] 
build-sys: use pkg-config to find gtk+-2.0

8 years agobuild-sys: check pkg-config availability
Sami Kerola [Thu, 18 Aug 2016 19:30:15 +0000 (20:30 +0100)] 
build-sys: check pkg-config availability

8 years agofixed #141 compile without SCTP if not available
Rogier Wolff [Sun, 21 Aug 2016 10:28:57 +0000 (12:28 +0200)] 
fixed #141 compile without SCTP if not available

8 years agofixed #27 and #35 where the fix was tested a long time ago.
Rogier Wolff [Fri, 19 Aug 2016 09:20:22 +0000 (11:20 +0200)] 
fixed #27 and #35 where the fix was tested a long time ago.

8 years agoMerge pull request #140 from aquerubin/stdev
rewolff [Thu, 18 Aug 2016 14:31:17 +0000 (16:31 +0200)] 
Merge pull request #140 from aquerubin/stdev

Fix standard deviation calculation.

8 years agoFix standard deviation calculation. 140/head
aquerubin [Thu, 18 Aug 2016 14:24:54 +0000 (04:24 -1000)] 
Fix standard deviation calculation.

8 years agoPartial reverse of 6bb5b6b3b.
R.E. Wolff [Thu, 18 Aug 2016 11:32:10 +0000 (13:32 +0200)] 
Partial reverse of 6bb5b6b3b.

The bug in automake does not create a vulnerable distirbution. It
allows local attackers that are logged in (or running in the
background) when a distributer types "make distcheck" to possibly gain
root access on the build system. This is NOT creating a vulnerable
distribution. The fact that automake has a vulnerability does not
warrant build failures on older systems.

8 years agomore cleanup
R.E. Wolff [Thu, 18 Aug 2016 07:25:44 +0000 (09:25 +0200)] 
more cleanup

8 years agoMerge pull request #138 from kerolasa/2016-08-17
rewolff [Thu, 18 Aug 2016 06:14:57 +0000 (08:14 +0200)] 
Merge pull request #138 from kerolasa/2016-08-17

2016 08 17 regression fixes and warnings removal

8 years agowarnings: fix --disable-ipv6 --without-ipinfo compilation warnings 138/head
Sami Kerola [Wed, 17 Aug 2016 21:51:44 +0000 (22:51 +0100)] 
warnings: fix --disable-ipv6 --without-ipinfo compilation warnings

Add include <strings.h> to avoid implicit declaration of built-in functions,
replace bzero() with memset(), mark function argument unused, and use %zu to
print size_t data type.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agobuild-sys: fix ./configure --disable-ipv6
Sami Kerola [Wed, 17 Aug 2016 21:39:52 +0000 (22:39 +0100)] 
build-sys: fix ./configure --disable-ipv6

8 years agobuild-sys: fix --without-ipinfo regressions
Sami Kerola [Wed, 17 Aug 2016 20:34:59 +0000 (21:34 +0100)] 
build-sys: fix --without-ipinfo regressions

The commit e2d898cc16398609821f7a786ae86dcbac4884af was far from perfect it
broke all --without features.  Oh dear me.

Looks like I am not the only one breaking configure.  The --disable-ipv6 has
been broken since commit d90dd1fd8f9289fa9e880c006ca6dff0ef7d4918 and
further damaged by 2cf22b240958b72fb8d84f3ee663f84cbad2c65b.  These issues
will be addressed later.

8 years agowarnigns: add void to functions that do not take any arguments
Sami Kerola [Wed, 17 Aug 2016 19:52:02 +0000 (20:52 +0100)] 
warnigns: add void to functions that do not take any arguments

The use of function declarators with empty parentheses (not prototype-format
parameter type declarators) is an obsolescent feature.

8 years agofixed no-gtk build bug introduced with e2d898cc
R.E. Wolff [Wed, 17 Aug 2016 11:59:36 +0000 (13:59 +0200)] 
fixed no-gtk build bug introduced with e2d898cc

8 years agoMerge branch 'master' of github.com:traviscross/mtr
R.E. Wolff [Wed, 17 Aug 2016 07:14:55 +0000 (09:14 +0200)] 
Merge branch 'master' of github.com:traviscross/mtr

8 years agoMerge pull request #136 from kerolasa/2016-08-16
rewolff [Wed, 17 Aug 2016 07:14:46 +0000 (09:14 +0200)] 
Merge pull request #136 from kerolasa/2016-08-16

2016 08 16 make build system better

8 years agocleanup: remove unnecessary function 136/head
Sami Kerola [Tue, 16 Aug 2016 12:40:19 +0000 (13:40 +0100)] 
cleanup: remove unnecessary function

8 years agoreadability: always use EXIT_* definitions from stdlib.h
Sami Kerola [Tue, 16 Aug 2016 12:14:11 +0000 (13:14 +0100)] 
readability: always use EXIT_* definitions from stdlib.h

8 years agowarnings: fix unused variable when ./configure --without-gtk is used
Sami Kerola [Tue, 16 Aug 2016 11:56:08 +0000 (12:56 +0100)] 
warnings: fix unused variable when ./configure --without-gtk is used

Use of preprocessor to enable/disable code blocks makes messy code.  Perhaps
something can be done in future to make this nicer.

8 years agobuild-sys: require automake 1.11.6 or newer
Sami Kerola [Tue, 16 Aug 2016 11:51:21 +0000 (12:51 +0100)] 
build-sys: require automake 1.11.6 or newer

Do not let anyone to create vulnerable dist package.

Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-3386

8 years agobuild-sys: improve configure.am
Sami Kerola [Tue, 16 Aug 2016 10:02:43 +0000 (11:02 +0100)] 
build-sys: improve configure.am

Unify indentation, use strict quoting, and use appropriate macros.  Add few
comments that can be found from ./configure script so that one has some idea
what macros are generating the lines one is looking.

8 years agobuild-sys: use build version script from gnulib
Sami Kerola [Tue, 16 Aug 2016 09:34:01 +0000 (10:34 +0100)] 
build-sys: use build version script from gnulib

This makes distribution tar-balls from snapshot to indicate they are
snapshot versions.  Additionally the version markup ends up in config.h
correct way, so earlier code that was specific to this project can be
removed.

Reference: http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/git-version-gen

8 years agobuild-sys: remove old dist Makefile kludge
Sami Kerola [Tue, 16 Aug 2016 08:13:34 +0000 (09:13 +0100)] 
build-sys: remove old dist Makefile kludge

Autotools dist works, there is no longer need for this.

8 years agobuild-sys: fix make distcheck
Sami Kerola [Tue, 16 Aug 2016 07:15:22 +0000 (08:15 +0100)] 
build-sys: fix make distcheck

New distribution package can, and should, now be built using 'make
distcheck' facility from autotools.  Personally I would run the following.

git clean -xdf && git reset --hard HEAD &&
./bootstrap.sh && ./configure && make distcheck

8 years agowarnings: remove dead code
Sami Kerola [Tue, 16 Aug 2016 06:36:31 +0000 (07:36 +0100)] 
warnings: remove dead code

These functions are not used, remove them.

8 years agocast: do not downgrade to float when double should be used
Sami Kerola [Tue, 16 Aug 2016 09:06:46 +0000 (10:06 +0100)] 
cast: do not downgrade to float when double should be used

Regression from commit 78f019aa9d49be5ada89296a462939738c20c181

Requested-by: rewolff <R.E.Wolff@BitWizard.nl>
Reference: https://github.com/traviscross/mtr/pull/135/files#r74889063

8 years agocomment: add value range note to initialization
Sami Kerola [Tue, 16 Aug 2016 09:01:23 +0000 (10:01 +0100)] 
comment: add value range note to initialization

Requested-by: rewolff <R.E.Wolff@BitWizard.nl>
Reference: https://github.com/traviscross/mtr/pull/135#discussion_r74889440

8 years agowarnings: fix some missed unsigned vs signed variable comparisions
Sami Kerola [Mon, 15 Aug 2016 20:38:39 +0000 (21:38 +0100)] 
warnings: fix some missed unsigned vs signed variable comparisions

Commit 507092a9099a286f86639d9cd38dcdc1f28117ff fixed almost all of them,
this should be the last one.

8 years agoMerge pull request #135 from kerolasa/warnings
rewolff [Tue, 16 Aug 2016 07:50:32 +0000 (09:50 +0200)] 
Merge pull request #135 from kerolasa/warnings

Warnings branch

8 years agowarnings: multiply timeval seconds only when the value is small 135/head
Sami Kerola [Mon, 15 Aug 2016 20:52:05 +0000 (21:52 +0100)] 
warnings: multiply timeval seconds only when the value is small

It should be safe to multiply timeval seconds by million after substracting
sequence timestamp from now.  The reason to postpone multiply operation is
to ensure there is smallest possible change for interger overflow to happen.

8 years agowarnings: fix couple unsigned vs signed variable comparisions
Sami Kerola [Mon, 15 Aug 2016 20:38:39 +0000 (21:38 +0100)] 
warnings: fix couple unsigned vs signed variable comparisions

8 years agowarnings: mark unused function input variables
Sami Kerola [Mon, 15 Aug 2016 20:28:02 +0000 (21:28 +0100)] 
warnings: mark unused function input variables

8 years agowarnings: do not take abs() when data type is unsigned
Sami Kerola [Mon, 15 Aug 2016 20:23:28 +0000 (21:23 +0100)] 
warnings: do not take abs() when data type is unsigned

Taking the absolute value of unsigned type 'unsigned int' has no effect.

8 years agobuild-sys: default to ,/configure --enable-silent-rules
Sami Kerola [Mon, 15 Aug 2016 20:14:51 +0000 (21:14 +0100)] 
build-sys: default to ,/configure --enable-silent-rules

This makes noticing compiler warnings easier.

8 years agoman: use url macro to urls and fix reference manual notations
Sami Kerola [Sun, 14 Aug 2016 21:48:09 +0000 (22:48 +0100)] 
man: use url macro to urls and fix reference manual notations

8 years agobuild-sys; do not use subdirectory object
Sami Kerola [Sun, 14 Aug 2016 21:05:03 +0000 (22:05 +0100)] 
build-sys; do not use subdirectory object

None-recursive builds are quicker, and less problematic from make(1) object
tracking point of view.  See reference for full explanation.

References: http://miller.emu.id.au/pmiller/books/rmch/

8 years agocleanup: remove unnecessary null check
Sami Kerola [Sun, 14 Aug 2016 20:40:33 +0000 (21:40 +0100)] 
cleanup: remove unnecessary null check

The fmt_ipinfo() returns variable from stack.  In order a stack variable to
point to NULL there has to go so much things wrong that the program cannot
run - effectively this can happen when system memory is so low that even
global variables cannot be allocated.

8 years agowarnings: fix printf data types
Sami Kerola [Sun, 14 Aug 2016 20:28:11 +0000 (21:28 +0100)] 
warnings: fix printf data types

8 years agowarnings: remove code that cannot be reached
Sami Kerola [Sun, 14 Aug 2016 20:21:45 +0000 (21:21 +0100)] 
warnings: remove code that cannot be reached

Variable block_split gets value from static constants.  It is impossible to
reach the true if-case, so remote the test can the code block.

8 years agowarnings: stop reassigning a value before the old one has been used
Sami Kerola [Sun, 14 Aug 2016 20:19:27 +0000 (21:19 +0100)] 
warnings: stop reassigning a value before the old one has been used

8 years agoMerge pull request #134 from kerolasa/kerolasa
rewolff [Sun, 14 Aug 2016 21:41:19 +0000 (23:41 +0200)] 
Merge pull request #134 from kerolasa/kerolasa

new usage() and few cleanups

8 years agoposix: replace bzero() and index() with modern equivelants 134/head
Sami Kerola [Sun, 14 Aug 2016 19:52:47 +0000 (20:52 +0100)] 
posix: replace bzero() and index() with modern equivelants

Replace bzero() with memset() and index() with strchr().  The earlier
functions are marked as legacy in posix.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/index.html
Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/bzero.html

8 years agodns: remove unnecessary dns_events() function
Sami Kerola [Sun, 14 Aug 2016 19:28:20 +0000 (20:28 +0100)] 
dns: remove unnecessary dns_events() function

No longer needed after 02a9e6193e5dec01198f7824b7ed92f320b4e7a9

8 years agowarnings: stop variable shadowing
Sami Kerola [Sun, 14 Aug 2016 19:11:36 +0000 (20:11 +0100)] 
warnings: stop variable shadowing

Rename local variables not to conflict at following locations:

asn.c:160:26: warning: declaration of 'txtrec' shadows a global declaration [-Wshadow]
dns.c:351:50: warning: declaration of 'af' shadows a global declaration [-Wshadow]
dns.c:89:40: warning: declaration of 'af' shadows a global declaration [-Wshadow]
gtk.c:213:31: warning: declaration of 'Entry' shadows a global declaration [-Wshadow]
net.c:1408:31: warning: declaration of 'host' shadows a global declaration [-Wshadow]
net.c:1726:38: warning: declaration of 'af' shadows a global declaration [-Wshadow]
net.c:1744:39: warning: declaration of 'af' shadows a global declaration [-Wshadow]
net.c:876:7: warning: declaration of 'sequence' shadows a global declaration [-Wshadow]

8 years agousage: add short and long options and descriptions to usage()
Sami Kerola [Sun, 14 Aug 2016 10:31:28 +0000 (11:31 +0100)] 
usage: add short and long options and descriptions to usage()

Earlier usage did not help users.

8 years agowarnings: remove unnecessary file
Sami Kerola [Sun, 14 Aug 2016 08:02:51 +0000 (09:02 +0100)] 
warnings: remove unnecessary file

The hello.c was added in commit de3d6bc16efea7e63910cce568498eed0e2cf45a

8 years agoFixed pull #133 another way....
Rogier Wolff [Sat, 13 Aug 2016 10:50:38 +0000 (12:50 +0200)] 
Fixed pull #133 another way....

8 years agoincreased default unknownhosts #92 #132 #130
R.E. Wolff [Tue, 9 Aug 2016 15:30:40 +0000 (17:30 +0200)] 
increased default unknownhosts #92 #132 #130
(I give in).

8 years agoformat sent and rcvd fields correctly for big numbers #66
R.E. Wolff [Tue, 9 Aug 2016 08:07:43 +0000 (10:07 +0200)] 
format sent and rcvd fields correctly for big numbers #66

8 years agoUpdated NEWS as in v0.87.1
R.E. Wolff [Sat, 6 Aug 2016 12:11:21 +0000 (14:11 +0200)] 
Updated NEWS as in v0.87.1

9 years agofixed double printout of start time, issue 131
R.E. Wolff [Thu, 4 Aug 2016 11:09:24 +0000 (13:09 +0200)] 
fixed double printout of start time, issue 131

9 years agoMerge branch 'newdns'
R.E. Wolff [Wed, 3 Aug 2016 05:39:46 +0000 (07:39 +0200)] 
Merge branch 'newdns'

9 years agoThe release script bumped the version number v0.87
R.E. Wolff [Wed, 3 Aug 2016 05:27:03 +0000 (07:27 +0200)] 
The release script bumped the version number

9 years agoissue 128: compile should be in .gitignore
R.E. Wolff [Tue, 2 Aug 2016 16:14:13 +0000 (18:14 +0200)] 
issue 128: compile should be in .gitignore

9 years agoMerge pull request #127 from nikolaik/json
rewolff [Mon, 1 Aug 2016 13:07:06 +0000 (15:07 +0200)] 
Merge pull request #127 from nikolaik/json

Add support for JSON as report output format

9 years agoAdd support for JSON as report output format 127/head
Nikolai R Kristiansen [Fri, 29 Jul 2016 15:31:14 +0000 (17:31 +0200)] 
Add support for JSON as report output format

This is based on the equivalent code for XML.

9 years agoMerge pull request #126 from russor/master
rewolff [Fri, 29 Jul 2016 07:13:11 +0000 (09:13 +0200)] 
Merge pull request #126 from russor/master

add option to set graceperiod

9 years agoadd option to set graceperiod 126/head
russor [Fri, 29 Jul 2016 05:46:48 +0000 (22:46 -0700)] 
add option to set graceperiod

useful when running a single probe on a network where many hops never
respond

9 years agoMerge pull request #124 from aquerubin/master
rewolff [Thu, 21 Jul 2016 11:12:21 +0000 (13:12 +0200)] 
Merge pull request #124 from aquerubin/master

Fix GTK display order.  Update an email address in the GTK credits display.

9 years agoMerge pull request #125 from aquerubin/newdns newdns
rewolff [Thu, 21 Jul 2016 11:12:16 +0000 (13:12 +0200)] 
Merge pull request #125 from aquerubin/newdns

Merge the GTK display order fix and credits update from master into newdns.

9 years agoMerge branch 'newdns' of https://github.com/aquerubin/mtr into newdns 125/head
aquerubin [Thu, 21 Jul 2016 10:49:27 +0000 (00:49 -1000)] 
Merge branch 'newdns' of https://github.com/aquerubin/mtr into newdns

9 years agoMerge branch 'master' into newdns
aquerubin [Thu, 21 Jul 2016 10:46:08 +0000 (00:46 -1000)] 
Merge branch 'master' into newdns

9 years agoUpdate Tony's email address in the GTK credits. 124/head
aquerubin [Thu, 21 Jul 2016 10:44:56 +0000 (00:44 -1000)] 
Update Tony's email address in the GTK credits.

9 years agoFix Avg and Best column order to match column headers in GTK display.
aquerubin [Thu, 21 Jul 2016 10:42:46 +0000 (00:42 -1000)] 
Fix Avg and Best column order to match column headers in GTK display.

9 years agoMerge pull request #123 from aquerubin/newdns
rewolff [Thu, 21 Jul 2016 06:01:26 +0000 (08:01 +0200)] 
Merge pull request #123 from aquerubin/newdns

Sync up recent master updates into newdns

9 years agoMerge updates from branch 'master' into newdns 123/head
aquerubin [Wed, 20 Jul 2016 19:07:20 +0000 (09:07 -1000)] 
Merge updates from branch 'master' into newdns

9 years agoMerge pull request #122 from h-ume/gtk-aslookup
rewolff [Thu, 14 Jul 2016 14:58:18 +0000 (16:58 +0200)] 
Merge pull request #122 from h-ume/gtk-aslookup

Add aslookup support to gtk interface

9 years agoAdd aslookup support to gtk interface 122/head
Hajimu UMEMOTO [Wed, 13 Jul 2016 16:52:02 +0000 (01:52 +0900)] 
Add aslookup support to gtk interface

9 years agoMerge pull request #120 from yupeng820921/master
rewolff [Mon, 4 Jul 2016 10:37:22 +0000 (12:37 +0200)] 
Merge pull request #120 from yupeng820921/master

add max-unknown option

9 years agoadd max-unknown option 120/head
penyu [Sun, 3 Jul 2016 20:12:01 +0000 (20:12 +0000)] 
add max-unknown option

remove the MAX_UNKNOWN_HOSTS macro, use maxUnknown variable
instead of it, and add --max-unknown option, let it can be
configured at run time.

9 years agoMerge pull request #118 from zorun/improve_ipinfo
rewolff [Thu, 9 Jun 2016 21:42:49 +0000 (23:42 +0200)] 
Merge pull request #118 from zorun/improve_ipinfo

Improve ipinfo

9 years agoMerge pull request #119 from zorun/cosmetic
rewolff [Thu, 9 Jun 2016 21:37:46 +0000 (23:37 +0200)] 
Merge pull request #119 from zorun/cosmetic

Cosmetic cleanup of the option-parsing code

9 years agoFix wrap-around bug when displaying IP info (-y option) 118/head
Baptiste Jonglez [Thu, 9 Jun 2016 18:18:22 +0000 (19:18 +0100)] 
Fix wrap-around bug when displaying IP info (-y option)

Some IP prefixes have an allocation date, but some don't.
For instance:

$ dig +short 49.60.231.80.origin.asn.cymru.com TXT
"6453 | 80.231.0.0/16 | EU | ripencc | 2002-03-20"

$ dig +short 186.83.219.195.origin.asn.cymru.com TXT
"6453 | 195.219.0.0/16 | EU | ripencc |"

In the latter case, the parsing code would miss the last (empty) field
and wrap around to the AS number, producing an inconsistent output
(see below).

While we're at it, also make the parsing logic easier to understand...

Before this patch:

$ mtr --report -y 4 nic.co.jp
Start: Thu Jun  9 19:13:50 2016
HOST: gilead                      Loss%   Snt   Last   Avg  Best  Wrst StDev
  1. 2004-04-05 gatwick.net.cl.ca  0.0%    10    2.0   4.7   2.0   7.1   1.9
  2. 786        cl-wgb.route-west  0.0%    10    0.6  11.3   0.6 104.7  32.8
  3. 786        d-we.c-ce.net.cam  0.0%    10    0.7   0.6   0.5   0.8   0.0
  4. 786        c-ce.b-ec.net.cam  0.0%    10    0.7   6.9   0.3  52.6  16.2
  5. 786        ae1.cambab-rbr1.e  0.0%    10    0.3   0.5   0.3   0.7   0.0
  6. 786        146.97.65.118      0.0%    10    0.7   0.6   0.5   0.8   0.0
  7. 786        146.97.38.17       0.0%    10    3.5   9.3   3.5  17.9   6.2
  8. 786        ae29.londtn-sbr1.  0.0%    10    3.7   4.0   3.5   6.6   0.9
  9. 2002-03-20 ix-ae-11-0.tcore1  0.0%    10    3.8   5.0   3.5  16.8   4.1
 10. 6453       195.219.83.186     0.0%    10    4.3   4.4   3.9   5.6   0.3
 11. 2914       ae-4.r22.londen03  0.0%    10    7.7   8.8   3.9  25.5   6.9
 12. 2914       ae-6.r21.sngpsi05  0.0%    10  185.4 185.8 174.4 226.5  14.9
 13. 2914       ae-20.r31.tokyjp0  0.0%    10  249.9 250.0 249.8 250.4   0.0
 14. 2914       ae-21.r00.tokyjp0  0.0%    10  265.9 265.9 265.6 266.1   0.0
 15. 2000-09-29 ae-0.gmo.tokyjp05  0.0%    10  253.7 252.5 244.7 257.5   4.4
 16. ???        ???               100.0    10    0.0   0.0   0.0   0.0   0.0
 17. 7506       g-o-p-4ee-a01-1-e  0.0%    10  250.3 250.3 250.2 250.5   0.0
 18. 7506       unused-157-7-041-  0.0%    10  257.0 256.9 256.7 257.2   0.0
 19. 7506       157-7-107-115.vir  0.0%    10  258.6 258.4 258.2 258.6   0.0

After this patch:

$ mtr --report -y 4 nic.co.jp
Start: Thu Jun  9 19:12:30 2016
HOST: gilead                      Loss%   Snt   Last   Avg  Best  Wrst StDev
  1. 2004-04-05 gatwick.net.cl.ca  0.0%    10    3.6   7.3   1.2  18.1   5.9
  2.            cl-wgb.route-west  0.0%    10    0.6   0.8   0.5   1.3   0.0
  3.            d-we.c-ce.net.cam  0.0%    10    0.5   0.7   0.5   1.0   0.0
  4.            c-ce.b-ec.net.cam  0.0%    10    0.4   1.6   0.3   9.1   2.6
  5.            ae1.cambab-rbr1.e  0.0%    10    0.4   0.5   0.3   0.7   0.0
  6.            146.97.65.118      0.0%    10    0.5   1.1   0.5   5.0   1.3
  7.            146.97.38.17       0.0%    10    3.7   8.4   3.4  51.9  15.3
  8.            ae29.londtn-sbr1.  0.0%    10    3.7   9.0   3.5  54.8  16.1
  9. 2002-03-20 ix-ae-11-0.tcore1  0.0%    10    5.5   4.1   3.5   6.0   0.8
 10.            195.219.83.186     0.0%    10    4.0   4.2   3.9   4.6   0.0
 11.            ae-4.r22.londen03  0.0%    10    3.8   9.5   3.8  33.6  11.6
 12.            ae-6.r21.sngpsi05 20.0%    10  185.8 181.0 179.5 185.8   2.1
 13.            ae-20.r31.tokyjp0  0.0%    10  249.9 249.7 249.5 249.9   0.0
 14.            ae-21.r00.tokyjp0  0.0%    10  266.1 266.0 265.7 266.4   0.0
 15. 2000-09-29 ae-0.gmo.tokyjp05  0.0%    10  243.8 243.8 243.4 244.4   0.0
 16. ???        ???               100.0    10    0.0   0.0   0.0   0.0   0.0
 17.            g-o-p-4ee-a01-1-e  0.0%    10  246.1 246.2 245.7 247.4   0.0
 18.            unused-157-7-041-  0.0%    10  257.3 258.0 256.9 260.9   1.2
 19.            157-7-107-115.vir  0.0%    10  258.3 258.4 258.2 258.8   0.0

9 years agoCosmetic cleanup of the option-parsing code 119/head
Baptiste Jonglez [Thu, 9 Jun 2016 17:43:27 +0000 (18:43 +0100)] 
Cosmetic cleanup of the option-parsing code

Align everything nicely, update helpful comments, and use NULL instead
of 0 for the third element of long_options: it's a pointer, see getopt(3).

9 years agoDocument the -y option in the manpage
Baptiste Jonglez [Thu, 9 Jun 2016 16:50:13 +0000 (17:50 +0100)] 
Document the -y option in the manpage

9 years agoAllow enabling IP info and ASN lookup from the curses interface
Baptiste Jonglez [Thu, 9 Jun 2016 16:19:29 +0000 (17:19 +0100)] 
Allow enabling IP info and ASN lookup from the curses interface

Toggling IP info and ASN lookup from the curses interface can be done
using 'z' or 'y'.  But it was only allowed if it was first enabled via
a command-line switch (either -z or -y).

9 years agoMerge pull request #115 from aquerubin/newdns
rewolff [Tue, 3 May 2016 09:01:11 +0000 (11:01 +0200)] 
Merge pull request #115 from aquerubin/newdns

Use setcap instead of setuid when installing the binary.

9 years agoMerge pull request #114 from aquerubin/master
rewolff [Tue, 3 May 2016 09:00:18 +0000 (11:00 +0200)] 
Merge pull request #114 from aquerubin/master

Use setcap instead of setuid when installing the binary.

9 years agoMerge remote-tracking branch 'origin/master' into newdns 115/head
Antonio Querubin [Tue, 3 May 2016 08:47:09 +0000 (22:47 -1000)] 
Merge remote-tracking branch 'origin/master' into newdns

9 years agoUse setcap instead of setuid when installing the binary. 114/head
Antonio Querubin [Tue, 3 May 2016 08:43:08 +0000 (22:43 -1000)] 
Use setcap instead of setuid when installing the binary.

9 years agoMerge pull request #113 from aquerubin/newdns
rewolff [Tue, 3 May 2016 05:15:23 +0000 (07:15 +0200)] 
Merge pull request #113 from aquerubin/newdns

Need to error check getnameinfo().

9 years agoMerge pull request #112 from aquerubin/master
rewolff [Tue, 3 May 2016 05:11:11 +0000 (07:11 +0200)] 
Merge pull request #112 from aquerubin/master

Correct psize for IPv6.

9 years agoNeed to error check getnameinfo(). 113/head
Antonio Querubin [Tue, 3 May 2016 02:17:14 +0000 (16:17 -1000)] 
Need to error check getnameinfo().

9 years agoCorrect psize for IPv6. 112/head
aquerubin [Sat, 10 Jan 2015 08:35:36 +0000 (22:35 -1000)] 
Correct psize for IPv6.

9 years agoMerge pull request #111 from aquerubin/newdns
rewolff [Sat, 30 Apr 2016 12:35:39 +0000 (14:35 +0200)] 
Merge pull request #111 from aquerubin/newdns

Merge master into newdns

9 years agoMerge remote-tracking branch 'origin/master' into newdns 111/head
Antonio Querubin [Sat, 30 Apr 2016 11:42:41 +0000 (01:42 -1000)] 
Merge remote-tracking branch 'origin/master' into newdns

Conflicts:
dns.c