]> git.ipfire.org Git - thirdparty/nftables.git/log
thirdparty/nftables.git
12 years agosets: fix sets using intervals
Patrick McHardy [Sun, 9 Dec 2012 12:35:23 +0000 (13:35 +0100)] 
sets: fix sets using intervals

When using intervals, the initializers set_flags are set to SET_F_INTERVAL,
however that is not propagated back to the set, so the segtree construction
is not performed.

Signed-off-by: Patrick McHardy <kaber@trash.net>
12 years agonetlink: fix endless loop on 64 bit when parsing binops
Patrick McHardy [Sun, 9 Dec 2012 13:55:03 +0000 (14:55 +0100)] 
netlink: fix endless loop on 64 bit when parsing binops

mpz_scan1() returns ULONG_MAX when no more bits are found. Due to assignment
to an unsigned int, this value was truncated on 64 bit and the loop never
terminated.

Signed-off-by: Patrick McHardy <kaber@trash.net>
12 years agorules: change rule handle to 64 bit
Patrick McHardy [Sun, 9 Dec 2012 13:25:27 +0000 (14:25 +0100)] 
rules: change rule handle to 64 bit

Recent kernel versions are using 64 bit for the rule handle.

Signed-off-by: Patrick McHardy <kaber@trash.net>
12 years agoexpression: fix constant expression splicing
Patrick McHardy [Sun, 9 Dec 2012 13:02:11 +0000 (14:02 +0100)] 
expression: fix constant expression splicing

Fix reversed order during constant splicing.

Signed-off-by: Patrick McHardy <kaber@trash.net>
12 years agopayload: kill redundant payload protocol expressions during netlink postprocessing
Patrick McHardy [Sun, 9 Dec 2012 12:34:29 +0000 (13:34 +0100)] 
payload: kill redundant payload protocol expressions during netlink postprocessing

Kill payload protocol expressions like "ip protocol tcp" if a higher layer
payload expression already implies this, like "tcp dport 22".

Signed-off-by: Patrick McHardy <kaber@trash.net>
12 years agoseqtree: update mapping data when keeping the base
Patrick McHardy [Sat, 8 Dec 2012 19:42:16 +0000 (20:42 +0100)] 
seqtree: update mapping data when keeping the base

When a prefix expression is followed by another prefix expression using the
same base but a wider prefix, we need to update the mapping data to that of
the second expression.

Signed-off-by: Patrick McHardy <kaber@trash.net>
12 years agotests: add verdict map test
Patrick McHardy [Sat, 8 Dec 2012 19:26:10 +0000 (20:26 +0100)] 
tests: add verdict map test

Signed-off-by: Patrick McHardy <kaber@ŧrash.net>
12 years agosegtree: fix segtree to properly support mappings
Patrick McHardy [Sat, 8 Dec 2012 19:17:17 +0000 (20:17 +0100)] 
segtree: fix segtree to properly support mappings

Requires to use proper types for keys and data and using the key values for reverse
transformation.

Signed-off-by: Patrick McHardy <kaber@trash.net>
12 years agodebug: include verbose message in all BUG statements
root [Sat, 8 Dec 2012 17:08:44 +0000 (18:08 +0100)] 
debug: include verbose message in all BUG statements

Signed-off-by: Patrick McHardy <kaber@trash.net>
12 years agoevaluate: reintroduce type chekcs for relational expressions
Patrick McHardy [Wed, 5 Dec 2012 18:45:22 +0000 (19:45 +0100)] 
evaluate: reintroduce type chekcs for relational expressions

Since the parser can now generate constant expressions of a specific type
not determinaed by the LHS, we need to check that relational expressions
are actually using the correct types to avoid accepting stupid things
like "tcp dport tcp".

12 years agoparser: fix parsing protocol names for protocols which are also keywords
Patrick McHardy [Wed, 5 Dec 2012 18:39:00 +0000 (19:39 +0100)] 
parser: fix parsing protocol names for protocols which are also keywords

"ip protocol tcp" will currently produce a syntax error since tcp is also a keyword
which is expected ot be followed by a tcp header field. Allow to use protocol names
that are also keywords and allocate a constant expression for them.

12 years agotests: fix test, commands now comes before the family and table name
Pablo Neira Ayuso [Fri, 3 Aug 2012 17:56:37 +0000 (19:56 +0200)] 
tests: fix test, commands now comes before the family and table name

Most tests still don't work though. They still need another fix.

Reported-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoexpression: Differentiate expr among anonymous structures in struct expr
Tomasz Bursztyka [Thu, 2 Aug 2012 00:31:35 +0000 (00:31 +0000)] 
expression: Differentiate expr among anonymous structures in struct expr

This fixes compilation with gcc-4.7

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoerec: Handle returned value properly in erec_print
Tomasz Bursztyka [Thu, 2 Aug 2012 00:31:34 +0000 (00:31 +0000)] 
erec: Handle returned value properly in erec_print

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoevaluate: Remove useless variable in expr_evaluate_bitwise()
Tomasz Bursztyka [Thu, 2 Aug 2012 00:31:33 +0000 (00:31 +0000)] 
evaluate: Remove useless variable in expr_evaluate_bitwise()

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agonetlink: Use the right datatype for verdict
Tomasz Bursztyka [Thu, 2 Aug 2012 00:31:32 +0000 (00:31 +0000)] 
netlink: Use the right datatype for verdict

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
15 years agoadd bridge filter table definitions
Patrick McHardy [Tue, 6 Jul 2010 04:17:01 +0000 (06:17 +0200)] 
add bridge filter table definitions

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agohelp: fix of the -I option in help display
Romain Bignon [Tue, 6 Jul 2010 04:16:37 +0000 (06:16 +0200)] 
help: fix of the -I option in help display

Trivial patch which fixes typo.

Signed-off-by: Romain Bignon <romain@peerfuse.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agodatatype: reject incompletely parsed integers in integer_type_parse()
Patrick McHardy [Tue, 6 Jul 2010 04:11:48 +0000 (06:11 +0200)] 
datatype: reject incompletely parsed integers in integer_type_parse()

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agodon't use internal_location for files specified on command line
Patrick McHardy [Tue, 6 Jul 2010 04:11:18 +0000 (06:11 +0200)] 
don't use internal_location for files specified on command line

Fixes strange error messages like:

In file included from internal:0:0-0:
files/examples/sets_and_maps:55:2-2: Error: syntax error, unexpected newline, expecting string

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agonetlink: add debugging for missing objects
Patrick McHardy [Tue, 6 Jul 2010 04:08:56 +0000 (06:08 +0200)] 
netlink: add debugging for missing objects

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agonat: validate protocol context when performing transport protocol mappings
Patrick McHardy [Tue, 6 Jul 2010 03:57:23 +0000 (05:57 +0200)] 
nat: validate protocol context when performing transport protocol mappings

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agonetlink: fix nat stmt linearization/parsing
Patrick McHardy [Tue, 6 Jul 2010 03:57:23 +0000 (05:57 +0200)] 
netlink: fix nat stmt linearization/parsing

Fix invalid register use when parsing NAT statements and handle range expressions
during postprocessing. When linearizing, allocate all registers for both proto and
address expressions at once to avoid double use.

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agopayload: fix crash with uncombinable protocols
Patrick McHardy [Tue, 6 Jul 2010 03:57:22 +0000 (05:57 +0200)] 
payload: fix crash with uncombinable protocols

The dependency of non-combinable protocols (f.i. arp + tcp) results in
a relational dependency expression without a datatype, causing a segfault
later on.

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agonetlink: fix creation of base chains with hooknum and priority 0
Patrick McHardy [Tue, 6 Jul 2010 03:57:22 +0000 (05:57 +0200)] 
netlink: fix creation of base chains with hooknum and priority 0

Base chains with both a hook number and priority of zero are created
as regular chains. Fix by adding a BASECHAIN flag indicating that the
chain should be created as a base chain.

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoutils: fix invalid assertion in xrealloc()
Patrick McHardy [Tue, 6 Jul 2010 03:57:21 +0000 (05:57 +0200)] 
utils: fix invalid assertion in xrealloc()

The pointer is allowed to have the value NULL.

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agonetlink: fix byteorder of RHS of relational meta expression
Patrick McHardy [Tue, 6 Jul 2010 03:57:20 +0000 (05:57 +0200)] 
netlink: fix byteorder of RHS of relational meta expression

The RHS needs to be postprocessed before updating the payload context
for byteorder conversion. Fixes iiftype match reconstruction.

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agodebug: properly parse debug levels
Patrick McHardy [Tue, 6 Jul 2010 03:57:20 +0000 (05:57 +0200)] 
debug: properly parse debug levels

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agobuild: fix endless recursion with SUBDIRS=...
Patrick McHardy [Tue, 6 Jul 2010 03:57:19 +0000 (05:57 +0200)] 
build: fix endless recursion with SUBDIRS=...

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agobuild: add 'archive' target
Patrick McHardy [Tue, 6 Jul 2010 03:57:18 +0000 (05:57 +0200)] 
build: add 'archive' target

make archive creates a tar.bz2 from the HEAD version.

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoparser: support bison >= 2.4
Patrick McHardy [Tue, 6 Jul 2010 03:57:00 +0000 (05:57 +0200)] 
parser: support bison >= 2.4

Work around stange behaviour in bison >= 2.4 (see large comment in parser.y for
details) and remove the skeleton file since it does not work with 2.4 anymore.
Its only purpose was to increase the amount of possible tokens reported in error
messages anyways.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agopayload: fix two datatypes
Patrick McHardy [Tue, 28 Jul 2009 12:17:42 +0000 (14:17 +0200)] 
payload: fix two datatypes

Fix typo in URG-flag and missing end-of-list marker for the arpop constants.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agopayload: add DCCP packet type definitions
Patrick McHardy [Tue, 28 Jul 2009 12:17:42 +0000 (14:17 +0200)] 
payload: add DCCP packet type definitions

# nft describe dccp type
payload expression, datatype dccp_pkttype (DCCP packet type) (basetype integer), 4 bits

pre-defined symbolic constants:
request                        0x0
response                       0x1
data                           0x2
ack                            0x3
dataack                        0x4
closereq                       0x5
close                          0x6
reset                          0x7
sync                           0x8
syncack                        0x9

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agonetlink: fix binop RHS byteorder
Patrick McHardy [Tue, 28 Jul 2009 12:17:42 +0000 (14:17 +0200)] 
netlink: fix binop RHS byteorder

The byteorder of the RHS of a binop must be set before post-processing it to
make sure it will get byteorder-switched if necessary.

Fixes invalid conntrack expression states when used with bitmasks:

 ct state 33554432,67108864 counter packets 1924 bytes 142960

 =>

 ct state established,related counter packets 2029 bytes 151508

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agonetlink: dump all chains when listing rules
Patrick McHardy [Tue, 28 Jul 2009 12:17:41 +0000 (14:17 +0200)] 
netlink: dump all chains when listing rules

Currently only the rules are dumped and chains are constructed based
on the rules identities. Dump all chains manually to make sure we also
display empty chains.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agonetlink: fix bitmask element reconstruction
Patrick McHardy [Tue, 28 Jul 2009 12:17:41 +0000 (14:17 +0200)] 
netlink: fix bitmask element reconstruction

mpz_scan1() needs to begin scanning at bit 0 and the loop must accept
bit 0 as valid. No more bits were found when ULONG_MAX is returned.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agodebug: allow runtime control of debugging output
Patrick McHardy [Tue, 28 Jul 2009 12:17:41 +0000 (14:17 +0200)] 
debug: allow runtime control of debugging output

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoadd support for new set API and standalone sets
Patrick McHardy [Tue, 28 Jul 2009 12:17:35 +0000 (14:17 +0200)] 
add support for new set API and standalone sets

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoexpressions: kill seperate sym_type datatype for symbols
Patrick McHardy [Wed, 1 Apr 2009 10:56:44 +0000 (12:56 +0200)] 
expressions: kill seperate sym_type datatype for symbols

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agodatatype: add/move size and byte order information into data types
Patrick McHardy [Tue, 31 Mar 2009 02:57:48 +0000 (04:57 +0200)] 
datatype: add/move size and byte order information into data types

Add size and type information to non-basetype types and remove the now
redundant information from the symbol tables.

This will be used to determine size and byteorder of set members without
analyzing the ruleset for incremental update operations.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agodatatype: maintain table of all datatypes and add registration/lookup function
Patrick McHardy [Tue, 31 Mar 2009 02:14:26 +0000 (04:14 +0200)] 
datatype: maintain table of all datatypes and add registration/lookup function

Add a table containing all available datatypes and registration/lookup functions.
This will be used to associate a stand-alone set in the kernel with the correct
type without parsing the entire ruleset.

Additionally it would now be possible to remove the global declarations for the
core types. Not done yet though.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agonetlink: move data related functions to netlink.c
Patrick McHardy [Tue, 31 Mar 2009 02:14:26 +0000 (04:14 +0200)] 
netlink: move data related functions to netlink.c

Move the data related function to netlink.c as they're going to be needed
outside of rule context for set maintenance.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agonetlink: use libnl OBJ_CAST macro
Patrick McHardy [Tue, 31 Mar 2009 02:14:21 +0000 (04:14 +0200)] 
netlink: use libnl OBJ_CAST macro

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agonetlink: consistent naming fixes
Patrick McHardy [Tue, 31 Mar 2009 02:07:25 +0000 (04:07 +0200)] 
netlink: consistent naming fixes

Rename libnl netlink data to "nld" for consistency.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agonetlink: add helper function for socket callback modification
Patrick McHardy [Tue, 31 Mar 2009 02:07:25 +0000 (04:07 +0200)] 
netlink: add helper function for socket callback modification

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoct: resync netlink header and properly add ct l3protocol support
Patrick McHardy [Tue, 31 Mar 2009 02:07:24 +0000 (04:07 +0200)] 
ct: resync netlink header and properly add ct l3protocol support

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agonetlink_linearize: remove two debugging printfs
Patrick McHardy [Tue, 31 Mar 2009 02:07:20 +0000 (04:07 +0200)] 
netlink_linearize: remove two debugging printfs

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoFix some memory leaks
Patrick McHardy [Fri, 20 Mar 2009 16:42:55 +0000 (17:42 +0100)] 
Fix some memory leaks

Free nested chain handles and command structures when done.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoRelease scopes during cleanup
Patrick McHardy [Fri, 20 Mar 2009 15:23:50 +0000 (16:23 +0100)] 
Release scopes during cleanup

Properly release the user-defined symbols.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoFix multiple references to the same user defined symbolic expression
Patrick McHardy [Fri, 20 Mar 2009 15:17:51 +0000 (16:17 +0100)] 
Fix multiple references to the same user defined symbolic expression

The expression needs to be cloned so transformations don't corrupt the original
expression. This could be slightly optimized by only taking a reference and
COW'ing when necessary (which is actually quite rare).

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoexpr: add support for cloning expressions
Patrick McHardy [Fri, 20 Mar 2009 15:12:18 +0000 (16:12 +0100)] 
expr: add support for cloning expressions

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoAdd more notes to INSTALL
Patrick McHardy [Fri, 20 Mar 2009 08:09:42 +0000 (09:09 +0100)] 
Add more notes to INSTALL

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoAdd support for user-defined symbolic constants
Patrick McHardy [Fri, 20 Mar 2009 07:34:59 +0000 (08:34 +0100)] 
Add support for user-defined symbolic constants

User-defined constants can be used like this:

 define allowed_hosts = { 192.168.0.0/24, 10.0.0.20-10.0.0.30 }
 define udp_services = domain
 define tcp_services = { ssh, domain }

 ip saddr $allowed_hosts udp dport $udp_services counter accept
 ip saddr $allowed_hosts tcp dport $tcp_services counter accept

Recursive definitions are possible, but currently not fully handled.
Anything requiring transformations (sets using ranges) can not be
used more than once currently since the expressions need to be COW'ed
previously.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoAdd support for scoping and symbol binding
Patrick McHardy [Fri, 20 Mar 2009 07:12:18 +0000 (08:12 +0100)] 
Add support for scoping and symbol binding

As a first step towards stand-alone sets, add support for scoping and
binding symbols. This will be used for user-defined constants, as well
as declarations of modifiable (stand-alone) sets once the kernel side
is ready.

Scopes are currently limited to three nesting levels: the global scope,
table block scopes and chain block scopes.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoparser: consistently use $@ for location of entire grouping
Patrick McHardy [Fri, 20 Mar 2009 05:25:10 +0000 (06:25 +0100)] 
parser: consistently use $@ for location of entire grouping

Replace use of specific location references for single-element rules.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoparser: fix common_block usage in chain and table blocks
Patrick McHardy [Fri, 20 Mar 2009 05:18:44 +0000 (06:18 +0100)] 
parser: fix common_block usage in chain and table blocks

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoAdd installation instructions
Patrick McHardy [Fri, 20 Mar 2009 00:58:41 +0000 (01:58 +0100)] 
Add installation instructions

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agobuild: fix installation when docs are not built
Patrick McHardy [Wed, 18 Mar 2009 19:49:09 +0000 (20:49 +0100)] 
build: fix installation when docs are not built

Don't try to install non-existant files.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agobuild: remove double subdir in build output
Patrick McHardy [Wed, 18 Mar 2009 19:32:38 +0000 (20:32 +0100)] 
build: remove double subdir in build output

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoAllow newlines in regular maps
Patrick McHardy [Wed, 18 Mar 2009 09:45:31 +0000 (10:45 +0100)] 
Allow newlines in regular maps

The previous patch only handled sets and verdict maps.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoAllow newlines in sets and maps
Patrick McHardy [Wed, 18 Mar 2009 09:32:56 +0000 (10:32 +0100)] 
Allow newlines in sets and maps

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agokill obsolete TODO item
Patrick McHardy [Wed, 18 Mar 2009 07:20:02 +0000 (08:20 +0100)] 
kill obsolete TODO item

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoFix use of reserved names in header sandwich
Patrick McHardy [Wed, 18 Mar 2009 06:17:10 +0000 (07:17 +0100)] 
Fix use of reserved names in header sandwich

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolexer: fix some whitespace errors
Patrick McHardy [Wed, 18 Mar 2009 06:08:48 +0000 (07:08 +0100)] 
lexer: fix some whitespace errors

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agonetlink: wrap libnl object dumping in #ifdef DEBUG
Patrick McHardy [Wed, 18 Mar 2009 05:28:28 +0000 (06:28 +0100)] 
netlink: wrap libnl object dumping in #ifdef DEBUG

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agotemplates: add IPv6 raw table template
Patrick McHardy [Wed, 18 Mar 2009 05:23:57 +0000 (06:23 +0100)] 
templates: add IPv6 raw table template

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agobuild: work around docbook2x-man inability to specify output file
Patrick McHardy [Wed, 18 Mar 2009 05:15:46 +0000 (06:15 +0100)] 
build: work around docbook2x-man inability to specify output file

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoInitial commit v0.01-alpha1
Patrick McHardy [Wed, 18 Mar 2009 03:55:00 +0000 (04:55 +0100)] 
Initial commit