Jeremy Sowden [Tue, 21 Jul 2020 13:03:45 +0000 (14:03 +0100)]
doc: fix quoted string in libxt_DNETMAP manpage
In roff, lines beginning with a single quote are control lines. In the
libxt_DNETMAP man-page there is a single-quoted string at the beginning
of a line, which troff tries and fails to interpret as a macro:
troff: <standard input>:49: warning: macro 'S'' not defined
This means that the line is not output.
Replace the single quotes with the appropriate escape-sequences.
Fixes: v2.3~9 ("doc: spelling and grammar corrections to DNETMAP") Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Conceivably someone might want to run a refresh of the geoip database
from within a script, particularly an unattended script such as a cron
job. Do not generate output in that case.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
The Perl script that builds the GeoIP DBs uses inet_pton(3) to convert
the addresses to network byte order. This converts
"1234:5678::90ab:cdef"
to:
0x12 0x34 0x56 0x78 .. 0xcd 0xef, interpreted by an LE machine
accessing this in uint32_t-sized chunks as
8765:4321::fedc:ba09
The kernel module compares the addresses in packets with the ranges from
the DB in host byte order using binary search. It uses 32-bit swaps
when converting the addresses.
libxt_geoip, however, which the module uses to load the ranges from the
DB and convert them from NBO to HBO, uses 16-bit swaps to do so, and
this means that:
1234:5678::90ab:cdef
becomes:
4321:8765::ba09:fedc
Obviously, this is inconsistent with the kernel module and DB build
script and breaks the binary search.
Fixes: b91dbd03c717 ("geoip: store database in network byte order") Reported-by: "Thomas B. Clark" <kernel@clark.bz> Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Jeremy Sowden [Sun, 11 Aug 2019 13:09:26 +0000 (14:09 +0100)]
xt_DHCPMAC: replace skb_make_writable with skb_ensure_writable
skb_make_writable was removed from the kernel in
v5.3-rc1~140^2~370^2~1 , and its callers were converted to use
skb_ensure_writable. Updated dhcpmac_tg() accordingly.
Use of uninitialized value $dir in concatenation (.) or string at
/usr/lib/xtables-addons/xt_geoip_build line 59.
Couldn't open list country names
Do not rely on any directory names (they change). Use the current
directory as the default source directory, similar to the older
xt_geoip_build (well, *.csv was passed as arguments).
geoip: add database query tool for use with ipsets
Add a tool for retrieiving the IPv4 or IPv6 (or both!) CIDR ranges
for a given country, which can then be injected into an ipset if
one doesn't want to use (or have available) the xt_geoip extension.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Requires Net::CIDR::Lite for manipulating CIDR blocks, aggregation, etc.
since database is stored as subnet/mask pairs and may require compaction
into ranges (which can combine adjacent subnets).
We don't use Net::CIDR because it's a clunkier interface.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Make both instances of the same message (about invalid country codes)
be consistent with each other. If you have scripts which capture and
collate error messages, then having consistent strings to match against
is a win.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Jan Engelhardt [Sun, 23 Jul 2017 17:56:30 +0000 (19:56 +0200)]
ipp2p: fix PVSStudio reports
V666 Consider inspecting fourth argument of the function 'HX_memmem'.
It is possible that the value does not correspond with the length of
a string which was passed with the third argument.
Jan Engelhardt [Thu, 15 Jun 2017 10:15:48 +0000 (12:15 +0200)]
xt_DNETMAP: fix a buffer overflow
prefix_str was only 16 bytes, but the largest emitted string could be
"255.255.255.255/32" (19 bytes).
xt_DNETMAP.c: In function "dnetmap_tg_check":
compat_xtables.h:46:22: warning: "%u" directive writing between 1 and 10
bytes into a region of size between 0 and 8 [-Wformat-overflow=]
# define NIPQUAD_FMT "%u.%u.%u.%u"
xt_DNETMAP.c:296:2: note: "sprintf" output between 10 and 27 bytes into
a destination of size 16
sprintf(p->prefix_str, NIPQUAD_FMT "/%u", NIPQUAD(mr->min_addr.ip),
33 - ffs(~(ip_min ^ ip_max)));