This function deals situation when mustach put happens before enter, that is
a sign of an invalid input template. Good side of adding this function is
that dhcpd-pools does not need to modify code provided by Jose.
Reference: 66183bc7c7
Proposed-by: José Bollo <jobol@nonadev.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Off by one that is caused by must_next_range() advancing pointer, and moving
over the first range. Fix by setting indexes one step backwards, that is
not excellent but better than copying skip_ok stuff to must_enter().
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Fix issues found with afl-fuzz. It is a pity I had to change mustach.c it
is no longer exactly the same as upstream. Lets see if Jose will accept
these changes.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Based on José Bollo's mustache C implementation. This adaptation uses
project specific data structures to avoid overhead with json parsing.
Reference: https://gitlab.com/jobol/mustach.git
Commit: d84608a69033d38c81b8fcff0cb272e225dd5428
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Earlier commit started to use range_output_helper() in output_xml() so
remove the unnecessary calls to get_range_size().
Reference: c55c823753
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
When --warning or --critical thresholds are defined with text output lines
that exceed threshold will be either yellow (warning) or red (critical).
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
There is too much repetative confusing maths near printouts. Move that
stuff to a function.
This change also fixes --snet-alarms option counting issue in range that
were not part of any shared network were ignored.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This makes 'range6 123::/45' style cidr notation to be understood as address
range. Earlier ranges that used cidr failed to parse completely.
Reported-by: Jeff Bailey <jeffrey.bailey@bt.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Current output makes some false-positives for situations when multiple
ranges are specified inside single network, for example:
subnet 10.0.0.0 netmask 255.255.254.0 {
...
range 10.0.0.1 10.0.0.254;
range 10.0.1.1 10.0.1.253;
...
}
An alert for range 10.0.0.1 - 10.0.0.254 will be raised even in situations
when range 10.0.1.1 - 10.0.1.253 is completely empty. To cope with this
issue, an -A option is added to treat all single networks as shared-network.
This option changes output for both range and shared networks output if
specified. Frankly saying, using network CIDR as network name is much more
sane for me than 'All Networks'.
Signed-off-by: Boris Lytochkin <lytboris@yandex-team.ru>
It is too difficult to know what users might want to do. Maybe some run
this software all the time from a monitoring system, and in cases like that
it is best to have caches helping.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
It seems that one can reach the abort() with severely broken configuration
file, that is extremely unlikely to run without parser error when given to
ISC dhcpd. So such files ought to be impossible, and it is good enough for
this software to report position where parsing cannot be continued.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Incomplete html page, that was just a html table, was removed some time ago
but deprecated option arguments were unfortunately left to manual that are
now removed.
Reference: 1299737d76
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Most of these functions take pointers as input argument, so they cannot be
considered neiter const or pure. In same go fix few issues noticed when
compiling with smatch.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>