src: generate set members using integer_type in the appropriate byteorder

Rules with header fields that rely on the generic integer datatype
from sets are not matching, eg.

 nft add rule filter input udp length { 9 } counter

This set member is an integer represented in host byte order, which
obviously doesn't match the header field (in network byte order).

Since the integer datatype has no specific byteorder, we have to rely
on the expression byteorder instead when configuring the context,
before we evaluate the list of set members.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
netlink_delinearize: fix listing of set members in host byteorder using integer_type

 nft list table filter
 ...
        cpu { 50331648, 33554432, 0, 16777216} counter packets 8 bytes 344

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
netlink: fix listing of range set elements in host byteorder

We have to switch the byteorder of the element in
netlink_delinearize_setelem() for non-range values only.

This fixes the listing of:

  nft add rule filter input ct mark { 0x10-0x20 } counter

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
rule: fix segmentation faults on kernels without nftables support

 # nft list sets
 Segmentation fault

 # nft list sets
 <cmdline>:1:1-9: Error: Could not receive sets from kernel: Protocol error
 list sets
 ^^^^^^^^^

Fix same bug in `nft list tables'.

Don't cleanup the table object for these commands since it is NULL.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
dtype: remove unnecessary icmp* parse/print functions

Just setting the .sym_tbl correctly is all we need.

Signed-off-by: Patrick McHardy <kaber@trash.net>
stmt: rename nat "random-fully" option to "fully-random"

Use proper english for full randomization option.

Signed-off-by: Patrick McHardy
meta: properly align types in meta_template table

Don't use arbitrary amounts of spaces. The remaining table is
properly aligned, fix the new types.

Signed-off-by: Patrick McHardy <kaber@trash.net>
dtype: fix memory leak in concat_type_destroy()

Free allocated memory for ->desc.

Signed-off-by: Patrick McHardy <kaber@trash.net>
datatype: print datatype name in datatype_print() BUG message

Signed-off-by: Patrick McHardy <kaber@trash.net>
tests: regression: adapt nat tests to use random-fully

This adapts test to the change that happened in d9a9a79 ('stmt: rename
nat "random-fully" option to "fully-random"').

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests: regression: redirect.t: fix bogus errors

Separate values in set, otherwise bash interprets the brackets
and the test reports an error.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
parser: use 'redirect to PORT' instead of 'redirect :PORT'

Small syntax update suggested by Patrick.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests: regression: fix wrong number of test files

Always increment the test file counter for each test file in the list.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests: regression: simplify run_test_file() in case `-e' is used

Avoid copy&paste coding style pattern by simplifying the code that
handles the `-e' option that allows us to run known broken tests.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests: regression: log.t: this works for bridge and arp since 3.17

So tests log statement for those two families too and remove the
tests/selectors that are ip and ip6 specific, they don't belong here.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
build: restore --disable-debug

Fix fallout from the automake conversion. Display after configuration
if it is enabled or not.

Reported-by: Steven Barth <cyrus@openwrt.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
datatype: missing byteorder in string_type

nft add rule filter input iifname { "lo", "eth0" } counter

Now the listing shows:

	iifname { "lo", "eth0"}

instead of:

	iifname { "", ""}

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Bump version to v0.4

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
datatype: generate name for concat types

The name of a concat type is the names of the individual types concatenated
using a '.'.

Signed-off-by: Patrick McHardy <kaber@trash.net>
datatype: add new subtypes field to account number of concat data types

Using the size is confusing since it usually holds the size of
the data. Add a new "subtypes" member, which holds the number
of datatypes the concat type is made of.

Signed-off-by: Patrick McHardy <kaber@trash.net>