Commit Graph

991 Commits

Author SHA1 Message Date
Jan Engelhardt
f4c4208e75 geoip: use appropriate and normal types
For the header file, we need __u32 and so on because they are exported
to userspace and rather constitute a kernel header.

Use normal types instead of uintXX_t in the main code.
2008-03-22 03:59:57 +01:00
Jan Engelhardt
52a0ed7f15 geoip: use rcu to reduce time spinlocks are held
spin_lock_bh does not look safe (only disables preempt on current
CPU?). Change to spin_lock, that also avoids the management overhead
of spin_lock_bh. to spin_lock to avoid management overhead.

Use rcu in match and destroy function.
2008-03-22 03:59:57 +01:00
Jan Engelhardt
000d813171 geoip: use real atomic_t and remove casts from uint32_t 2008-03-22 03:59:57 +01:00
Jan Engelhardt
e45cb21ad6 geoip: use struct list_head instead of self-cooked list 2008-03-22 03:59:57 +01:00
Jan Engelhardt
7aae90da5a geoip: use local-portable aligned_u64 pointer values
A 64-bit kernel will interpret the pointer with 64 bits width, while
a 32-bit userspace filled in only 32 of it, leaving the other 32
undefined. This must be avoided.
2008-03-22 03:59:56 +01:00
Jan Engelhardt
fd5321c7d8 geoip: split user/kernel-visible parts of struct geoip_info 2008-03-22 03:59:56 +01:00
Jan Engelhardt
65eeb7f1f6 geoip: use vmalloc due to potential list size
The subnet list may become really large (United States: ~15000
entries), which means a use of roughly 120 KB, and kmalloc may fail
to find a contiguous block in physical memory. Virtual contiguity is
enough, so use vmalloc/vfree.

vfree may not be called within a spin_lock_bh area, so release the
lock first, it is safe to do so.
2008-03-22 03:59:55 +01:00
Jan Engelhardt
848484c08c geoip: use a binary search to replace the current linear one
Certain countries have lots (around 10000) of IP address ranges
(US,GB,DE,...). The current linear search is really bad:

No firewall:
3000 packets transmitted, 3000 received, 0% packet loss, time 1992ms

Testing against the countries with top 50 IP ranges:
3000 packets transmitted, 3000 received, 0% packet loss, time 8998ms

With binary search:
3000 packets transmitted, 3000 received, 0% packet loss, time 2358ms
2008-03-22 03:59:45 +01:00
Jan Engelhardt
8c58a61f52 geoip: address comparison is inclusive
subnet is somewhat a wrong term, geoip actually uses ipranges. Either
way, the comparison needs to be >= and <= instead of > <.
2008-03-22 03:59:45 +01:00
Jan Engelhardt
93c7d0ac47 geoip: lock timing correctness
find_node: The reference count needs to be increased while the lock
is held. Otherwise, the node may disappear right after the lock was
released and increase was attempted, leading to an oops.

remove_node: The reference count needs to be checked while the lock
is held. Otherwise, the node may be used in the match function or
returned from find_node while it has a zero refcount.
2008-03-22 03:59:45 +01:00
Jan Engelhardt
df063ab61c geoip: add missing kfree in error path 2008-03-22 03:59:44 +01:00
Jan Engelhardt
d480ea2b1f geoip: sort #include list 2008-03-22 03:59:44 +01:00
Jan Engelhardt
205a006ac9 geoip: use tabs not spaces and indent 2008-03-22 03:59:44 +01:00
Jan Engelhardt
9f45aa737a geoip: remove redundant casts 2008-03-22 03:59:44 +01:00
Jan Engelhardt
f1615a03f3 geoip: remove unused code and unneeded per-info refcount
- freeing userspace memory is not the kernel's job, really.
- checkentry is called exactly once, as is destroy.
2008-03-22 03:59:44 +01:00
Jan Engelhardt
3554e348bc geoip: import 20080214 code base 2008-03-22 03:59:42 +01:00
Jan Engelhardt
5fd97e9973 compat update: allow building from 2.6.18 onwards 2008-03-12 04:28:40 +01:00
Jan Engelhardt
10e3d8fe0d Update .gitignore 2008-03-12 04:28:38 +01:00
Jan Engelhardt
6c06796e3b Makefile: add missing xtables_CFLAGS variable
If xtables.h is to be found in a directory other than included in the
default preprocessor search path, compilation failed because the path
specified with --with-xtables= was not passed to gcc.
2008-03-05 00:19:15 +01:00
Jan Engelhardt
98f943cb6c Xtables-addons 1.5.2
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
v1.5.2
2008-03-04 05:17:00 +01:00
Jan Engelhardt
cedbb110e1 Makefile: add "tarball" target
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-03-04 05:16:35 +01:00
Jan Engelhardt
c703be229a Remove XTABLES_VERSION define, it is now provided by xtables.h
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-03-04 05:13:34 +01:00
Jan Engelhardt
c338e8f827 Move defines in compat_xtables.h down to avoid redeclaration errors
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-03-04 05:12:06 +01:00
Jan Engelhardt
7c09f5db2f Use system's readlink program to make things work with GNU make < 3.81
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-29 13:49:04 +01:00
Jan Engelhardt
6177839a04 Xtables-addons 1.5.1
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
v1.5.1
2008-02-21 18:56:47 +01:00
Jan Engelhardt
4d22fbd97a Use AF_UNSPEC registration in libxt_LOGMARK
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-21 18:56:47 +01:00
Jan Engelhardt
dd42c61581 Change IPTABLES_VERSION to XTABLES_VERSION
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-21 18:56:47 +01:00
Jan Engelhardt
2fbfbe6cd4 Import Chaostables extensions
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-21 18:56:21 +01:00
Jan Engelhardt
ec9663f680 Remove compat code for kernels below 2.6.22
Some code already uses ip_hdr() functions which did not exist in
2.6.21 and I do not feel like adding more compat code.

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-21 13:35:19 +01:00
Jan Engelhardt
75e88a7321 Update compat code for new 2.6.25 code
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-21 13:29:31 +01:00
Jan Engelhardt
1e34f02034 xt_LOGMARK: dump CLASSIFY mark, ctstate and ctstatus
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-20 23:17:55 +01:00
Jan Engelhardt
b69d3de40e Add support for external tarballs
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-16 16:10:40 +01:00
Jan Engelhardt
c1592673fb Allow external projects to be downloaded into the tree and used
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-15 02:21:35 +01:00
Jan Engelhardt
da011c8871 Allow user to select what extensions to compile and install
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-14 17:49:47 +01:00
Jan Engelhardt
f360ec3c85 Only include ksource header directory when explicitly specified
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-14 15:28:44 +01:00
Jan Engelhardt
c43ce6d830 Fixup compilation for kernels before 2.6.25
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
v1.5.0
2008-02-11 15:49:51 +01:00
Jan Engelhardt
fd845be2d4 Update package name and documentation
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-02-11 14:08:23 +01:00
Jan Engelhardt
6d2998588d Add xt_LOGMARK (nfmark, ctmark, secmark logger)
xt_LOGMARK dumps the nfmark (packet mark), ctmark (connection mark)
and/or secmark to syslog.

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-01-30 13:54:57 +01:00
Jan Engelhardt
f53dc9fbaf Add plural target (un)registration to compat glue
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-01-30 03:50:16 +01:00
Jan Engelhardt
47b700b0f5 Add a compat wrapper to make modules work with older Linux.
The extension modules use the API of a fairly recent kernel, if not
even the networking git tree. To make it work with older Linux
kernels, an API wrapper is added. Should compile against
running-kernels Linux 2.6.19..current (tested: 2.6.22..current).

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-01-29 15:40:57 +01:00
Jan Engelhardt
7a981b17b5 Initial commit.
Populate the iptables-addons repository with two modules, xt_TARPIT
and xt_TEE, as a starting point.

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
2008-01-29 03:57:08 +01:00