linux-mainline/tools/testing/selftests/net
Florian Westphal 3bf195ae60 netfilter: nat: merge nf_nat_ipv4,6 into nat core
before:
   text    data     bss     dec     hex filename
  16566    1576    4136   22278    5706 nf_nat.ko
   3598	    844	      0	   4442	   115a	nf_nat_ipv6.ko
   3187	    844	      0	   4031	    fbf	nf_nat_ipv4.ko

after:
   text    data     bss     dec     hex filename
  22948    1612    4136   28696    7018 nf_nat.ko

... with ipv4/v6 nat now provided directly via nf_nat.ko.

Also changes:
       ret = nf_nat_ipv4_fn(priv, skb, state);
       if (ret != NF_DROP && ret != NF_STOLEN &&
into
	if (ret != NF_ACCEPT)
		return ret;

everywhere.

The nat hooks never should return anything other than
ACCEPT or DROP (and the latter only in rare error cases).

The original code uses multi-line ANDing including assignment-in-if:
        if (ret != NF_DROP && ret != NF_STOLEN &&
           !(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
            (ct = nf_ct_get(skb, &ctinfo)) != NULL) {

I removed this while moving, breaking those in separate conditionals
and moving the assignments into extra lines.

checkpatch still generates some warnings:
 1. Overly long lines (of moved code).
    Breaking them is even more ugly. so I kept this as-is.
 2. use of extern function declarations in a .c file.
    This is necessary evil, we must call
    nf_nat_l3proto_register() from the nat core now.
    All l3proto related functions are removed later in this series,
    those prototypes are then removed as well.

v2: keep empty nf_nat_ipv6_csum_update stub for CONFIG_IPV6=n case.
v3: remove IS_ENABLED(NF_NAT_IPV4/6) tests, NF_NAT_IPVx toggles
    are removed here.
v4: also get rid of the assignments in conditionals.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2019-02-27 10:49:55 +01:00
..
forwarding selftests: forwarding: Add some missing configuration symbols 2019-02-15 20:32:22 -08:00
.gitignore selftests: net: test that listening sockets match on address properly 2018-12-14 15:55:20 -08:00
config netfilter: nat: merge nf_nat_ipv4,6 into nat core 2019-02-27 10:49:55 +01:00
fib_rule_tests.sh
fib_tests.sh selftests: fib_tests: sleep after changing carrier. again. 2019-02-23 18:34:20 -08:00
fib-onlink-tests.sh
in_netns.sh
ip6_gre_headroom.sh
ip_defrag.c selftests: net: ip_defrag: cover new IPv6 defrag behavior 2019-01-25 21:37:11 -08:00
ip_defrag.sh selftests: net: ip_defrag: cover new IPv6 defrag behavior 2019-01-25 21:37:11 -08:00
Makefile selftests: net: use LDLIBS instead of LDFLAGS 2019-01-28 08:02:12 -07:00
msg_zerocopy.c
msg_zerocopy.sh
netdevice.sh
pmtu.sh
psock_fanout.c
psock_lib.h
psock_snd.c
psock_snd.sh
psock_tpacket.c
reuseaddr_conflict.c
reuseport_addr_any.c selftests: net: reuseport_addr_any: silence clang warning 2018-12-20 19:26:52 -08:00
reuseport_addr_any.sh selftests: net: test that listening sockets match on address properly 2018-12-14 15:55:20 -08:00
reuseport_bpf_cpu.c
reuseport_bpf_numa.c
reuseport_bpf.c
reuseport_dualstack.c
rtnetlink.sh tools: selftests: rtnetlink: add testcases for vxlan flag sets 2019-02-26 08:54:37 -08:00
run_afpackettests
run_netsocktests
socket.c
tcp_inq.c
tcp_mmap.c
test_bpf.sh
test_vxlan_fdb_changelink.sh selftests: net: Add test_vxlan_fdb_changelink.sh 2018-12-18 21:18:26 -08:00
test_vxlan_under_vrf.sh
tls.c selftest/tls: Add test to verify received 'type' of non-data record 2019-02-20 11:05:55 -08:00
txring_overwrite.c
udpgro_bench.sh
udpgro.sh
udpgso_bench_rx.c
udpgso_bench_tx.c
udpgso_bench.sh
udpgso.c
udpgso.sh
xfrm_policy.sh xfrm: policy: fix infinite loop when merging src-nodes 2019-01-09 13:58:23 +01:00