linux-bl808/net/openvswitch
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
..
actions.c OVS: remove use of VLAN_TAG_PRESENT 2018-11-08 19:49:31 -08:00
conntrack.c netfilter: nat: merge nf_nat_ipv4,6 into nat core 2019-02-27 10:49:55 +01:00
conntrack.h openvswitch: Support conntrack zone limit 2018-05-25 16:45:19 -04:00
datapath.c openvswitch: Use correct reply values in datapath and vport ops 2018-09-29 11:44:11 -07:00
datapath.h openvswitch: Support conntrack zone limit 2018-05-25 16:45:19 -04:00
dp_notify.c
flow.c openvswitch: Fix IPv6 later frags parsing 2019-01-04 13:00:02 -08:00
flow.h OVS: remove use of VLAN_TAG_PRESENT 2018-11-08 19:49:31 -08:00
flow_netlink.c openvswitch: Avoid OOB read when parsing flow nlattrs 2019-01-16 13:35:21 -08:00
flow_netlink.h
flow_table.c
flow_table.h
Kconfig netfilter: nat: merge nf_nat_ipv4,6 into nat core 2019-02-27 10:49:55 +01:00
Makefile
meter.c openvswitch: meter: Use struct_size() in kzalloc() 2019-01-16 21:10:47 -08:00
meter.h
vport-geneve.c net: core: dev: Add extack argument to dev_change_flags() 2018-12-06 13:26:07 -08:00
vport-gre.c net: core: dev: Add extack argument to dev_change_flags() 2018-12-06 13:26:07 -08:00
vport-internal_dev.c net: ovs: fix return type of ndo_start_xmit function 2018-09-28 10:25:11 -07:00
vport-internal_dev.h
vport-netdev.c openvswitch: remove BUG_ON from get_dpdev 2018-11-08 17:14:59 -08:00
vport-netdev.h
vport-vxlan.c net: core: dev: Add extack argument to dev_change_flags() 2018-12-06 13:26:07 -08:00
vport.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
vport.h