]> git.ipfire.org Git - thirdparty/mtr.git/log
thirdparty/mtr.git
8 years agodocs: add Sami Kerola to authors 147/head
Sami Kerola [Mon, 29 Aug 2016 12:45:40 +0000 (13:45 +0100)] 
docs: add Sami Kerola to authors

8 years agoperformance: set few variables read-only
Sami Kerola [Sun, 4 Sep 2016 20:04:02 +0000 (21:04 +0100)] 
performance: set few variables read-only

8 years agocleanup: remove message duplicate
Sami Kerola [Sun, 4 Sep 2016 20:02:23 +0000 (21:02 +0100)] 
cleanup: remove message duplicate

Commit 9a9003a436b19044abf35a73c9fc5bb5a271b7aa missed removing this line.

8 years agocleanup: correct display_offset variable usage
Sami Kerola [Sun, 4 Sep 2016 19:18:00 +0000 (20:18 +0100)] 
cleanup: correct display_offset variable usage

Variable display_offset was missed to move from local scope to control
structure in file it had it as local.

8 years agocleanup: set variable only if it is used
Sami Kerola [Sun, 4 Sep 2016 16:20:55 +0000 (17:20 +0100)] 
cleanup: set variable only if it is used

Variable introduction needs to be same way preprocessor conditional as the
related code.  This is a minor clean up, because modern compilers should
remove these types of variables automatically.

8 years agocleanup: remove more/bottom labels header separation from mpls
Sami Kerola [Sun, 4 Sep 2016 16:08:17 +0000 (17:08 +0100)] 
cleanup: remove more/bottom labels header separation from mpls

Commit a932cb2abc85651ca6f33a06d7b64448c1d27f65 added this separation, but
after five years and a bit the printouts has not become different.  It is
time to remove this todo item.

8 years agoperformance: make get_iiwidth() to be const function
Sami Kerola [Sun, 4 Sep 2016 08:46:52 +0000 (09:46 +0100)] 
performance: make get_iiwidth() to be const function

Change input argument to be a variable, so that optimizer can kick in and
take short cuts when possible.

Reference; https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

8 years agocleanup: make unused and const attributes to look the same
Sami Kerola [Sun, 4 Sep 2016 08:30:25 +0000 (09:30 +0100)] 
cleanup: make unused and const attributes to look the same

Definition CONST was already reserved in net.h to mean 'const' as a variable
attribute, so function attribute got a ATTRIBUTE_ prefix to separate them.
This change unifies unused to look the same.

8 years agocrash fix: ctl->iiwidth_len was not initialized correctly
Sami Kerola [Sun, 4 Sep 2016 00:12:08 +0000 (01:12 +0100)] 
crash fix: ctl->iiwidth_len was not initialized correctly

It was a mistake to add iiwidth_len to struct mtr_ctl.  First of all the
value needed in that field was never set, and that resulted to crash when
running command with --csv option.

Secondly adding the field was bad idea to begin with.  Number of array
elements is known only within context of asn.c file, so it is better to add
interface to query it rather than try to set value to a structure.  Later
design is prone to cause futher bugs, if/when execution flow is not as one
might assume.

8 years agocrash fix: never return const string as address
Sami Kerola [Sat, 3 Sep 2016 23:49:06 +0000 (00:49 +0100)] 
crash fix: never return const string as address

String that comes from #define can cause SIGSEGV.

8 years agocrash fix: add ctl structure to gtk Pause_clicked() handler
Sami Kerola [Sat, 3 Sep 2016 22:25:17 +0000 (23:25 +0100)] 
crash fix: add ctl structure to gtk Pause_clicked() handler

Without this handler net_max() will crash with SIGSEGV at line 1209.  gdb
backtrace gave clear hint what was the problem, and where it needs to be
fixed.

  #0 0x4109db in net_max /home/src/mtr/net.c:1209
  #1 0x42478e in gtk_redraw /home/src/mtr/gtk.c:508
  #2 0x422fc7 in Pause_clicked /home/src/mtr/gtk.c:121

8 years agocleanup: merge two trim functions to one
Sami Kerola [Sat, 3 Sep 2016 07:02:09 +0000 (08:02 +0100)] 
cleanup: merge two trim functions to one

As a minor improvement make the trimmed string to stay at same start
address, so that trims can be safely done to pointers that are allocated and
need to be free'd later on.  There is no such case in this code, but it is
good idea to write functions the way they will not cause memory issues
if/when such use case happens.

8 years agoperformance: use fewer printw() calls to center text
Sami Kerola [Fri, 2 Sep 2016 21:05:53 +0000 (22:05 +0100)] 
performance: use fewer printw() calls to center text

Avoid printing white space one by one when variable length print out of
nothing can do the same thing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agobug fix: long option --gracetime is correct, --graceperiod is not
Sami Kerola [Sun, 4 Sep 2016 15:33:25 +0000 (16:33 +0100)] 
bug fix: long option --gracetime is correct, --graceperiod is not

Commit 5dbeb8f1b4084c38103e92dbd028da2762c1f0a9 introduced new long option
--gracetime, that was documented as --graceperiod.  Only one or the other
can be correct, so pick the --gracetime and update documentation to tell
this is, the expected long option.

8 years agousability: add bash-completion file
Sami Kerola [Wed, 31 Aug 2016 22:27:56 +0000 (23:27 +0100)] 
usability: add bash-completion file

8 years agoposix: do not use time(2) input argument
Sami Kerola [Mon, 29 Aug 2016 21:38:05 +0000 (22:38 +0100)] 
posix: do not use time(2) input argument

Function time(2) argument is obsolescent and should always be NULL in new
code.  When the argument is NULL, the call cannot fail.

Reference: http://man7.org/linux/man-pages/man2/time.2.html

8 years agousability: use ISO-8601 timestamp
Sami Kerola [Mon, 29 Aug 2016 18:45:36 +0000 (19:45 +0100)] 
usability: use ISO-8601 timestamp

The ISO timestamp has timezone information, and is easily parsable.

8 years agoreliability: check writing to stdout and stderr was successful
Sami Kerola [Mon, 29 Aug 2016 18:17:32 +0000 (19:17 +0100)] 
reliability: check writing to stdout and stderr was successful

This is expected behaviour.

$ mtr --help > /dev/full; echo $?
./mtr: write error: No space left on device
1

Earlier write errors returned successful zero.

Reference: https://www.irill.org/events/ghm-gnu-hackers-meeting/videos/jim-meyering-goodbye-world-the-perils-of-relying-on-output-streams-in-c

8 years agoreliability: always check strdup() return value
Sami Kerola [Mon, 29 Aug 2016 17:55:54 +0000 (18:55 +0100)] 
reliability: always check strdup() return value

Exit if allocation fails.

8 years agoreliability: always check malloc() return value
Sami Kerola [Mon, 29 Aug 2016 17:53:32 +0000 (18:53 +0100)] 
reliability: always check malloc() return value

Exit if allocation fails.

8 years agoreliability: further removal of unsave string operation
Sami Kerola [Mon, 29 Aug 2016 17:36:47 +0000 (18:36 +0100)] 
reliability: further removal of unsave string operation

Replace strcpy() + strcat() with a snprintf().  In same go name a magic
constant to a definition.

8 years agoreliability: ensure string copy results to a null determined string
Sami Kerola [Mon, 29 Aug 2016 17:25:27 +0000 (18:25 +0100)] 
reliability: ensure string copy results to a null determined string

Copying strings is much harder than it superficially looks, see reference
for further information,

Reference: http://meyering.net/crusade-to-eliminate-strncpy/

8 years agocleanup: move generic utility functions to a separate file
Sami Kerola [Mon, 29 Aug 2016 17:02:15 +0000 (18:02 +0100)] 
cleanup: move generic utility functions to a separate file

The utils.c is basically an internal general purpose function library.

8 years agocleanup: use ICMP definitions from linux/icmp.h when possible
Sami Kerola [Mon, 29 Aug 2016 16:46:36 +0000 (17:46 +0100)] 
cleanup: use ICMP definitions from linux/icmp.h when possible

8 years agocleanup: avoid duplicating stdint.h
Sami Kerola [Mon, 29 Aug 2016 12:05:01 +0000 (13:05 +0100)] 
cleanup: avoid duplicating stdint.h

Use exactly defined data types from stdint.h rather than defining own
similar types.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html

8 years agocleanup: remove commented out includes in dns.c
Sami Kerola [Mon, 29 Aug 2016 11:42:59 +0000 (12:42 +0100)] 
cleanup: remove commented out includes in dns.c

Thees have been two years commented out, and if someone really has to fiddle
around with comments that is a failure of autotools usage and needs to be
addressed by getting the autoconf to do the right things.

8 years agocleanup: use definition for a magic value appearing twice in code
Sami Kerola [Mon, 29 Aug 2016 10:54:36 +0000 (11:54 +0100)] 
cleanup: use definition for a magic value appearing twice in code

This improves readability, and makes it almost impossible to get these out
of sync.

8 years agousability: print usage() if unknown options are used
Sami Kerola [Mon, 29 Aug 2016 10:09:08 +0000 (11:09 +0100)] 
usability: print usage() if unknown options are used

It is better to burn and fail than allow recovery from unexpected user
interface usage.

8 years agowarnings: avoid vla when malloc() is more appropriate
Sami Kerola [Mon, 29 Aug 2016 09:54:55 +0000 (10:54 +0100)] 
warnings: avoid vla when malloc() is more appropriate

Assuming allocatin failure will happen use of vla will cause very strange
looking error.  In this occasion it is better to use malloc, and check it
was successful.  Found with smatch scan.

8 years agowarnings: do not use zero as NULL
Sami Kerola [Mon, 29 Aug 2016 09:52:44 +0000 (10:52 +0100)] 
warnings: do not use zero as NULL

Found with smatch scan.

8 years agowarnings: correct function pointer prototype argument
Sami Kerola [Mon, 29 Aug 2016 09:41:28 +0000 (10:41 +0100)] 
warnings: correct function pointer prototype argument

In struct fields the function pointer is getting assignments of functions
that take one int as input argument.

8 years agocrash fix: make --xml not to dump core 146/head
Sami Kerola [Sun, 28 Aug 2016 23:55:24 +0000 (00:55 +0100)] 
crash fix: make --xml not to dump core

This also makes --report option to print values rather than %5N.  And in
same go remove a floating point exception.

Crash these issues were introduced in caad4c42fb8ef0d830fd37608a96702d6774f93f

8 years agodata types: move rest of the global variables to control structures
Sami Kerola [Sun, 28 Aug 2016 19:12:58 +0000 (20:12 +0100)] 
data types: move rest of the global variables to control structures

Many of these variables seem to related to printing.  One can reasonably
assume the control structure will need to be split to a library and
none-library parts.

8 years agodata types: make control structure smaller
Sami Kerola [Sun, 28 Aug 2016 18:13:22 +0000 (19:13 +0100)] 
data types: make control structure smaller

Move boolean variables, and other variables that has well known small size,
to a named bit field.

8 years agodata types: move global data to control structures
Sami Kerola [Sun, 28 Aug 2016 09:51:33 +0000 (10:51 +0100)] 
data types: move global data to control structures

This is a big and pretty messy change, but unfortunately there is no nice
way to move variables from global scope to input argument scope.  But that
does not explain why this is needed, so let me try to do that.

Variables in global scope make lousy api.  In order to separate tracing
functionality from various display interfaces making api cleaner is a must.
Further goal of clean api with aim publishing it as libmtr library.  Such
library needs to be fully documented, and it can even provide python
bindings for people and organizations who happen to need such.  Please keep
this plan as a git commit log hush-hush secret.  It might take more than a
moment to get all the necessary changes done to reach fully working, decent,
understandable, documented library similar to libabc.

Reference: https://git.kernel.org/cgit/linux/kernel/git/kay/libabc.git

8 years agodocs: make manual page versioning automatic
Sami Kerola [Sat, 27 Aug 2016 11:11:57 +0000 (12:11 +0100)] 
docs: make manual page versioning automatic

In same go mark the manual page in System Administration selection.

8 years agousability: fix --mark documentation
Sami Kerola [Sat, 27 Aug 2016 10:50:23 +0000 (11:50 +0100)] 
usability: fix --mark documentation

And make the option argument to match with what is expected in kernel space,
that is u32int_t data type.

Reference: https://github.com/torvalds/linux/blob/master/include/net/sock.h#L419

8 years agodata types: get rid of all globals that are easy to remove
Sami Kerola [Sat, 27 Aug 2016 09:51:20 +0000 (10:51 +0100)] 
data types: get rid of all globals that are easy to remove

Some variables are unnecessary, others can be moved to a function or a file
scope.

8 years agowarnings: fix use of uninitialized warning
Sami Kerola [Mon, 22 Aug 2016 21:40:50 +0000 (22:40 +0100)] 
warnings: fix use of uninitialized warning

clang claims: variable 'port' is used uninitialized whenever switch default
is taken.  And that is a lie, but error() is not marked as function that
never returns, because it can also be used when printing warning.  So the
compiler is guessing wrong, but the easiest fix is to initialize the
variable rather than educate compiler.

8 years agodata types: check with smatch everything is in resonable scope
Sami Kerola [Mon, 22 Aug 2016 21:34:05 +0000 (22:34 +0100)] 
data types: check with smatch everything is in resonable scope

Now when extern variables, and functions are known one can start thinking
about how get rid of global variables.

8 years agodata types: move variable declaration from header to .c file
Sami Kerola [Mon, 22 Aug 2016 21:20:47 +0000 (22:20 +0100)] 
data types: move variable declaration from header to .c file

And make the variable shared.

8 years agocleanup: remove redundant redeclaration
Sami Kerola [Mon, 22 Aug 2016 21:06:25 +0000 (22:06 +0100)] 
cleanup: remove redundant redeclaration

8 years agodata types: set static strings to be read-only
Sami Kerola [Mon, 22 Aug 2016 21:04:13 +0000 (22:04 +0100)] 
data types: set static strings to be read-only

8 years agoMerge pull request #144 from kerolasa/mac
rewolff [Tue, 23 Aug 2016 21:45:42 +0000 (23:45 +0200)] 
Merge pull request #144 from kerolasa/mac

Mac/portability fixes

8 years agoportability: fix MacOS libresolv usage 144/head
Sami Kerola [Tue, 23 Aug 2016 19:21:58 +0000 (20:21 +0100)] 
portability: fix MacOS libresolv usage

MacOS has res_query in libc, but needs libresolv for dn_expand().

8 years agoportability: MacOS does not have error() function
Sami Kerola [Tue, 23 Aug 2016 11:49:05 +0000 (12:49 +0100)] 
portability: MacOS does not have error() function

Add portability fix by using err() function family.  This is a bit cheeky,
but should work relatively well.

8 years agoportability: fix float max check from values.h
Sami Kerola [Tue, 23 Aug 2016 18:25:40 +0000 (19:25 +0100)] 
portability: fix float max check from values.h

MacOS does not have values.h file.

8 years agofixed typo.
Rogier Wolff [Mon, 22 Aug 2016 06:37:51 +0000 (08:37 +0200)] 
fixed typo.

8 years agoMerge pull request #143 from kerolasa/2016-08-21
rewolff [Mon, 22 Aug 2016 06:36:42 +0000 (08:36 +0200)] 
Merge pull request #143 from kerolasa/2016-08-21

Cleanups: mark some functions as static. use GNU function "error" instead of perror/exit.

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.