Commit Graph

69 Commits

Author SHA1 Message Date
Jan Engelhardt
44d6f47ad6 ipp2p: import 20080304 code base 2008-04-08 20:34:03 +02:00
Jan Engelhardt
20f6e47525 Merge reworked "condition" match 2008-04-08 20:33:32 +02:00
Jan Engelhardt
e304252f4b condition: greatly improve processing speed
Replace the loop over all possible condvars by a simple deref. This
changes the runtime from O(n) to O(1) at the expense of only 8 bytes
for rule.
2008-04-08 11:58:35 +02:00
Jan Engelhardt
32f06cbedf condition: squash variables 2008-04-08 11:58:35 +02:00
Jan Engelhardt
75f6f14aaf condition: remove support for nonstandard inversion 2008-04-08 11:58:34 +02:00
Jan Engelhardt
7dd8b1a678 condition: reenable IPv6 support in userspace extension 2008-04-08 11:58:34 +02:00
Jan Engelhardt
f5f17a27c5 condition: style cleanup 2008-04-08 11:58:34 +02:00
Jan Engelhardt
c9579115c3 condition: rework condvar name check
Use memchr() instead of a for loop to detect '/' in the condvar name.
Also unconditionally disallow names starting with a dot.
2008-04-08 11:58:34 +02:00
Jan Engelhardt
586353342f condition: use appropriate types and return values 2008-04-08 11:58:34 +02:00
Jan Engelhardt
317a944fec condition: use unique symbol names and rewrite init function
Use an array of xt_match for the match vtable.
2008-04-08 11:58:34 +02:00
Jan Engelhardt
24dad368dd condition: use new structure type
Use __u8 for the invert flag instead of int. Reduce CONDITION_NAME_LEN
from 32 to 31 so that the entire structure can fit into a cacheline.
2008-04-08 11:58:34 +02:00
Jan Engelhardt
7d0efafdb3 condition: remove casts, add const qualifiers 2008-04-08 11:58:33 +02:00
Jan Engelhardt
330c1fe783 condition: remove version #ifs and compat selectors 2008-04-08 11:58:33 +02:00
Jan Engelhardt
72dc73e6a5 condition: import 20080125 code base 2008-04-08 11:58:33 +02:00
Jan Engelhardt
d7c5473cf6 LOGMARK: fix comma output in ctstatus= list 2008-04-08 11:51:24 +02:00
Jan Engelhardt
0ee80e4147 LOGMARK: add hook= and ctdir= fields 2008-04-08 11:49:45 +02:00
Jan Engelhardt
9778022c37 compat: add ipv6_hdr 2008-04-08 11:33:26 +02:00
Jan Engelhardt
2f6bc4c8cb TEE: reenable header_ops check 2008-04-07 08:44:25 +02:00
Jan Engelhardt
5fbc01b991 compat: add check for pskb relocation
The Xtables-addons compat layer does not support pskb relocation
(result of possible memory allocation in kernels before 2.6.24) and
we just assume it does not happen. Add a check to warn if relocation
did happen and packet loss is to be expected.
2008-04-01 09:12:38 +02:00
Jan Engelhardt
b749916313 ECHO: Catch skb_linearize out-of-memory condition 2008-03-31 06:40:29 +02:00
Jan Engelhardt
818cd3b47e Makefile: support building multiple files with one config option 2008-03-26 08:11:04 +01:00
Jan Engelhardt
8302faad44 TEE: fix address copying bug 2008-03-24 16:56:18 +01:00
Jan Engelhardt
8fa47480f8 Add Kconfig descriptions for Chaostables, ECHO, geoip 2008-03-24 16:28:14 +01:00
Jan Engelhardt
463dceb709 Xtables-addons 1.5.3 v1.5.3 2008-03-22 05:17:04 +01:00
Jan Engelhardt
cd323565d7 Merge reworked geoip extension 2008-03-22 05:16:53 +01:00
Jan Engelhardt
a39bfdf98e Add xt_ECHO sample target 2008-03-22 05:16:47 +01:00
Jan Engelhardt
cd7c8fc4fa geoip: minor cleanups in help, opts and logic 2008-03-22 03:59:58 +01:00
Jan Engelhardt
5d431b45f1 geoip: use simpler, preprocessed integer vector lists and fix endian issue
The old database format was in unknown byteorder -- if you run the
converter program yourself, you got a host order file, but if you
downloaded the preprocessed DB file (geoipdb.bin), you got a
little-endian file.

Use a new database format. Instead of having an index and a DB file,
do away with the index and let the filesystem do the indexing, using
one file per country. Also access the database files with a known
endianess type. The converter script now produces two distinct
variants (especially needed for IA-64).

All of this reduces the touched code by half.
2008-03-22 03:59:57 +01:00
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