Commit Graph

822 Commits

Author SHA1 Message Date
Jeremy Sowden
b3a3f2e91b xt_pknock: use IS_ENABLED
It is more succinct than checking whether CONFIG_BLAH or
CONFIG_BLAH_MODULE are defined.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 15:06:11 +01:00
Jeremy Sowden
63fb5d3490 pknlusr: fix hard-coded netlink multicast group ID
The group ID used by xt_pknock is configurable, but pknlusr hard-codes
it. Modify pknlusr to accept an optional ID from the command line.
Group IDs range from 1 to 32 and each ID appears in the group bitmask
at position `group_id - 1`.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 15:06:10 +01:00
Jeremy Sowden
05cacbe84c pknlusr: always close socket
On some error paths, the socket was not being closed before exit.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 15:02:39 +01:00
Jeremy Sowden
3c120ef5f1 pknlusr: do not treat recv return value of zero as an error
A return-value of zero is not an error, so there is no point calling
perror, but since we have not requested and do not expect a zero-length
datagram, we treat it as EOF and exit.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 15:01:50 +01:00
Jeremy Sowden
b0a1aacd4b pknlusr: use macro to define inet_ntop buffer size
POSIX provides a macro to define the minimum length required, so let's
use it.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 15:01:18 +01:00
Jeremy Sowden
c3bd1c61d1 pknlusr: use NLMSG macros and proper types, rather than arithmetic on char pointers
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 15:00:45 +01:00
Jeremy Sowden
9cd0b44c81 pknlusr: tidy up initialization of local address
Use struct initialization and drop memset. We do not need to set the port
ID, since the kernel will do it for us.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 14:54:40 +01:00
Jeremy Sowden
b4faa4de65 pknock: pknlusr: tighten up variable scopes
Make global variables local, and move variables local to while-loop into
the loop.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 14:54:10 +01:00
Jeremy Sowden
b05ea5644c pknock: pknlusr: remove dest_addr and rename src_addr
We only need to specify the address at our end, and given that we are
receiving messages, not sending them, calling it `src_addr` is
misleading.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 14:53:34 +01:00
Jeremy Sowden
b052ec0f7d pknock: pknlusr: ensure man-page is included by make dist
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-10-25 14:50:17 +01:00
Jeremy Sowden
249df831b0 pknlusr: add man page
Since pknlusr is now being installed, let's give it a man page.
2020-10-23 11:22:41 +02:00
Jeremy Sowden
86112194da pknlusr: fix formatting of a line 2020-10-22 19:59:06 +02:00
Jeremy Sowden
48e30a0990 xt_ACCOUNT: update prototype of nf_sockopt_ops::set callback
In 5.9, the `void __user` parameter has been replaced by a `sockptr`.
Update `ipt_acc_set_ctl` appropriately.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2020-08-31 15:04:43 +02:00
Jan Engelhardt
2cb4b2bec6 build: do build & install userspace programs for xt_ACCOUNT and xt_pknock 2020-08-30 13:36:10 +02:00
Jeremy Sowden
73b96e25e4 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>
2020-07-28 10:02:26 +02:00
Jan Engelhardt
d31067b32e Support for Linux 5.6 procfs API 2020-02-25 07:28:23 +01:00
Jeremy Sowden
bf1ca298ae xt_geoip: fix in6_addr little-endian byte swapping
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: b91dbd03c7 ("geoip: store database in network byte order")
Reported-by: "Thomas B. Clark" <kernel@clark.bz>
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-12-01 11:29:40 +01:00
Paolo Pisati
0cc51e6b35 build: add support for Linux 5.4 2019-11-20 22:45:18 +01:00
Jan Engelhardt
d86101e470 Merge MR-14 2019-09-10 11:12:30 +02:00
Jeremy Sowden
d4c2aac5f8 xt_pknock, xt_SYSRQ: do not set shash_desc::flags.
shash_desc::flags was removed from the kernel in 5.1.

That assignment was actually superfluous anyway, because crypto.desc
is zero-initialized when crypto is initialized (xt_pknock.c, ll.
110ff.).

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-09-06 10:34:36 +02:00
Jan Engelhardt
5622c5f024 treewide: replace skb_make_writable
skb_make_writable was removed in v5.3-rc1~140^2~370^2~1 .
Replace it with skb_ensure_writable that was introduced in
v3.19-rc1~118^2~153^2~2 .
2019-09-06 10:34:36 +02:00
Jan Engelhardt
358991306c xt_PROTO: style fixes 2019-09-06 10:34:35 +02:00
Jan Engelhardt
2bbdcb1d58 Merge MR-11 2019-09-06 10:34:29 +02:00
Jeremy Sowden
b14728691d 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.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2019-09-06 10:28:37 +02:00
rantal
708f883635 add support for Linux 5.0 for DELUDE and TARPIT 2019-08-14 18:40:07 +00:00
Aron Xu
f822b8bc1b Add man page items for xt_PROTO
Signed-off-by: Aron Xu <happyaron.xu@gmail.com>
2019-05-07 03:31:24 +08:00
Aron Xu
4205900d9b Enable xt_PROTO in build system
Signed-off-by: Aron Xu <happyaron.xu@gmail.com>
2019-05-07 03:24:43 +08:00
Miao Wang
266638e41e Add xt_PROTO extension
Signed-off-by: Aron Xu <happyaron.xu@gmail.com>
2019-05-07 03:24:43 +08:00
PGNet Dev
68d895f75c xt_SYSRQ: replace do_gettimeofday
Linux kernel commit v4.20-rc1-18-ge4b92b108c6c removed
do_gettimeofday in favor of ktime_get_real_ts64 introduced in
v3.16-rc5-59-gd6d29896c665 .
2019-03-07 10:07:28 +01:00
Jan Engelhardt
53b6b862cc Merge MR-10 2018-11-17 12:32:56 +01:00
Nataniel Santos
ed10cb9c17 xt_ACCOUNT: make table limit configurable
Add parameter option in module xt_ACCOUNT.ko to accept. Change in the
ACCOUN_MAX_TABLES table without the need to recompile the module.

References: MR-8
2018-11-17 12:13:00 +01:00
Jan Engelhardt
3ea761a1ed build: add support for Linux 4.18 2018-08-14 14:29:30 +02:00
Philip Prindeville
b91dbd03c7 geoip: store database in network byte order
This allows a single database to be built and distributed as a
package that is accepted by both big- and little-endian hosts.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2018-02-19 01:42:29 +01:00
Jan Engelhardt
bf63a25a64 build: remove support for Linux 4.14 2018-02-12 15:09:52 +01:00
Jan Engelhardt
94656621ed build: remove support for Linux 4.13 2018-02-12 15:09:41 +01:00
Jan Engelhardt
95d4f9e113 build: remove support for Linux 4.12 2018-02-12 15:09:32 +01:00
Jan Engelhardt
123e1a14e9 build: remove support for Linux 4.11 2018-02-12 15:09:25 +01:00
Jan Engelhardt
f4f3f98609 build: remove support for Linux 4.10 2018-02-12 15:09:15 +01:00
Jan Engelhardt
9b1c7c1c04 build: remove support for Linux 4.9 2018-02-12 14:59:44 +01:00
Jan Engelhardt
ed8e496750 build: remove support for Linux 4.8 2018-02-12 14:57:21 +01:00
Jan Engelhardt
5339fcc65b build: remove support for Linux 4.7 2018-02-12 14:56:57 +01:00
Jan Engelhardt
2265c1b854 build: remove support for Linux 4.6 2018-02-12 14:56:40 +01:00
Jan Engelhardt
2c574f992d build: remove support for Linux 4.5 2018-02-12 14:56:24 +01:00
Jan Engelhardt
3a24468a68 build: remove support for Linux 4.4 2018-02-12 14:56:05 +01:00
Jan Engelhardt
7682cc8c34 build: remove support for Linux 4.3 2018-02-12 14:55:45 +01:00
Jan Engelhardt
215b3c5b12 build: remove support for Linux 4.2 2018-02-12 14:54:26 +01:00
Jan Engelhardt
4dbb36b723 build: remove support for Linux 4.1 2018-02-12 14:53:25 +01:00
Jan Engelhardt
10f951e61d build: remove support for Linux 4.0 2018-02-12 14:53:01 +01:00
Jan Engelhardt
a4c50ae405 build: remove support for Linux 3.19 2018-02-12 14:50:33 +01:00
Jan Engelhardt
38d89983ca build: remove support for Linux 3.18 2018-02-12 14:49:20 +01:00