Commit graph

410 commits

Author SHA1 Message Date
Sami Kerola
8731c6a11f
fix typos
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-14 22:59:13 +00:00
Sami Kerola
d29b498cae
lib: update .gitignore
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-04 22:44:11 +00:00
Sami Kerola
48e46e8698
other: use strftime() to generate date-time string
It is better to use library function to create date-time string than sprintf
various struct tm members.  In same go retire time() call that is obsoleted
by clock_gettime().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-04 22:44:07 +00:00
Sami Kerola
4befdeeb47
getdata: remote dead code
These few lines has been part of code without any point in releases 2.17 to
3.0 and six and half years.  Oops.

Reference: ae7747db87
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-10-26 22:01:26 +01:00
Sami Kerola
9727bb28b9
drop images, java scripts, and such from web sitemap file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-08-26 09:32:15 +01:00
Sami Kerola
5027b50ade
sort: ensure NaN will not trip over comp_double()
In unlikely event of NaN being compared avoid exception.  If NaN appears in
input data it will be evaluated as equal with any value.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-07-23 21:41:59 +01:00
Sami Kerola
27c70a0efe
fix switch missing default case warnings
src/other.c:387:3: warning: switch missing default case [-Wswitch-default]

The one in do_counting() should be unreachable, so add abort() call to it.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-07-23 21:33:45 +01:00
Sami Kerola
7fe686b417
webpages: use html sample output
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-05-20 15:54:58 +01:00
Sami Kerola
3f85360c64
main: move output_format to state, and rename color_format
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-05-20 12:03:07 +01:00
Sami Kerola
e8e9d49ebb
main: move print_mac_addreses to state structure
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-05-20 11:47:30 +01:00
Sami Kerola
4e7ab66fd4
fix typo
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-05-15 21:31:52 +01:00
Sami Kerola
b568725e7d
main: simplify option parsing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-05-15 21:16:38 +01:00
Sami Kerola
a192f51545
output: fix implicit conversion
src/output.c:731:38: warning: implicit conversion from ‘float’ to ‘double’
when passing argument to function [-Wdouble-promotion]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-05-04 22:22:02 +01:00
Sami Kerola
679d63dd9f
add .mailmap
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-02-24 11:48:02 +00:00
Sami Kerola
0fe89808ee
docs: fix peoples name in THANKS file to have correct characters
Unicode fixes.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-01-14 18:35:15 +00:00
Sami Kerola
447241e6c3
tests: improve coverage
Add error condition checks.  Add lease file binding states.  Check all
output formats.  Check leases file that is in mad order, cse all sorting
methods when checking this.  Use json output to check status classfications.
Add cidr range checks.  Add conf include and comment parsing input checks.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-26 15:14:49 +00:00
Sami Kerola
2849dde21b
build-sys: add coverage files to .gitignore
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-26 13:59:17 +00:00
Sami Kerola
813e320b68
webpage: add instructions how to get output you need
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-15 20:09:52 +00:00
Sami Kerola
e6e90b4d62
release: 3.0
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-15 13:29:46 +00:00
Sami Kerola
a1d2bd2cf7
usage: --skip=ignored is actually 'suppressed'
When making --skip to take arguments ignored was for moment a work name for
'suppressed' state, and that was accidentally left to usage() output.

Reference: 3369278fc0
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-14 22:30:07 +00:00
Sami Kerola
46ec42182b
output: add some trivia data to json output
These are software version, dhcpd conf and leases paths and mtime epoch
timestamps.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-14 20:24:15 +00:00
Sami Kerola
444815f964
orther: fix xstrstr_init() memcmp() return value usage
This is a bug.  The xstrstr_init initialized wrong IP version functions when
this function was the first to run and set function pointers.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-14 18:58:11 +00:00
Sami Kerola
6d737a7607
output: unify time stamp creations
Use iso time stamp in both mustach and html outputs.  Effectively this is a
removal of libc langinfo D_T_FMT format, that pulled a lot of gnulib stuff
to project almost unnecessarily.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-14 11:08:46 +00:00
Sami Kerola
ff3d9523e6
output: add more items to mustach tags
Base level printing; localstime, number of ranges and shared networks,
project version, and file paths and time stamps.

Also print error and stop template processing when unknown tag is
encountered.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-14 10:48:52 +00:00
Sami Kerola
d24313d25a
output: remove unused variable attribute
The closure is used.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-14 00:17:56 +00:00
Sami Kerola
c687f38ed6
docs: improve doxygen documentation
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-14 00:11:46 +00:00
Sami Kerola
887845df2a
misc: move couple enums from global scope to file scope
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-13 21:55:14 +00:00
Sami Kerola
74b697321f
misc: move command line option parsing to separate function
Earlier main() had lots of temporary variables related to command line
parsing.  By moving these to separate function runtime can forget these
variables when moving on.  If nothing else this makes running gdb nicer when
debugging crashes, but as said stack memory should also be spared for better
purpose.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-13 21:52:03 +00:00
Sami Kerola
3369278fc0
output: make --skip to take arguments what will be skipped
Accidental typo in usage() caused realisation making skipping to fully
controllable is good idea.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-13 20:23:12 +00:00
Sami Kerola
e4f7259cf6
samples: add prometheus text file collector mustach template
Because prometheus needs timestamp information add that to mustach, and
update manual page what tags are available.

Reference: https://prometheus.io/docs/instrumenting/exposition_formats/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-13 14:18:05 +00:00
Sami Kerola
eabaa8adc2
thanks: add Troy D. Hanson to credits about uthash
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-13 11:53:21 +00:00
Sami Kerola
8fba5c5e6b
clean up: fix couple compiler warnings
src/sort.c:255:5: warning: no previous prototype for 'merge'
src/sort.c:290:2: warning: ISO C90 forbids mixed declarations and code
src/mustach-dhcpd-pools.c:67:5: warning: no previous prototype for 'must_put_err'
src/output.c:109:26: warning: comparing floating point with == or != is unsafe (x5)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-13 11:37:18 +00:00
Sami Kerola
88a3f1eb53
hash: include stdlib.h to avoid implicit declarations
Reported-by: Frank Bulk <fbulk@mypremieronline.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-13 11:37:15 +00:00
Sami Kerola
8ae5fbf489
output: improve html table
Update DataTables and Bootstrap versions.  Add free IP counts to table.
Replace yellow as warning with magenta that is easier to read from white
background.  Use italic and bold to emphasis warning and critical.  Remove
strips.  Use ascent percent sort by default.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-13 10:16:34 +00:00
Sami Kerola
b2c764924b
output: shared net can be in suppressed state
Avoid calling abort() when this very unlikely situation happens.

Reference: 48962004b8
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-13 09:57:22 +00:00
Sami Kerola
242c58f45e
output: display more entries in html table by default
And add 'All' to 'Show number of entries' menu.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 23:14:23 +00:00
Sami Kerola
c029c7581a
output: make warning and critical colors work in html output
Users should combine this with --color=always to web pages to work
correctly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 22:19:09 +00:00
Sami Kerola
a64630aa49
output: move shared net andn range status check to output_helper
Having same logic in many places is error prone if and when the logic needs
maintenance.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 17:43:42 +00:00
Sami Kerola
15f08bbf02
output: make --skip-ok to effect --perfdata
Reported-by: Frank Bulk <fbulk@mypremieronline.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 17:31:01 +00:00
Sami Kerola
ef5421ed05
analysis: shared networks to be linked list
This way memory is allocated only for items that are in use, and walking
through shared network items is also more straightforward.

As an unfortunate side effect in --perfdata output shared networks are no
longer printed in reverse order.  This should be a cosmetic issue.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 16:54:00 +00:00
Sami Kerola
a237c11d5a
output: improve mustach template parsing error
Following error did not inform clearly what is wrong.

$ ./dhcpd-pools -l samples/dhcpd.leases -c samples/dhcpd.conf -fm
./dhcpd-pools: must_read_template: open: (null): Bad address

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 15:22:46 +00:00
Sami Kerola
5a8c178924
other: add Jose Bollo to version output credits
Be also a little bit more verbose about licenses in version output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 15:12:16 +00:00
Sami Kerola
d25e7afa1c
analyze: bug fix shared networks counts
This also fixes backup state counts that were added to shared networks
twice, making the numbers to be much greater than they really where.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 15:12:16 +00:00
Sami Kerola
7cd381ed83
all files: re-indent
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 15:12:16 +00:00
Sami Kerola
1875a13733
all files: replace global variables with runtime config state structure
Earlier variables magically appeared to scope of functions that took void as
argument.  One could figure out perhaps they were globals, but programs that
do that are unnessarily hard to follow.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-12 15:12:15 +00:00
Sami Kerola
adda925c1e
clean up: remove unused variable
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-11 23:59:13 +00:00
Sami Kerola
3dda0a77a5
output: deduplicate file closing code
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-11 23:09:33 +00:00
Sami Kerola
7575294c36
usage: add error message informing mustach support is not available
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-11 21:15:36 +00:00
Sami Kerola
39b2811aa7
build-sys: omit mustach compilation when it cannot work
For example mac does not have open_memstream(3), and strndupa(3) can also be
missing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-11 16:13:14 +00:00
Sami Kerola
b96f8cd8ad
gnulib: use nstrftime instead of strftime
The strftime module is obsolete.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-11 15:37:07 +00:00