• Xin Long's avatar
    net: move the nat function to nf_nat_ovs for ovs and tc · ebddb140
    Xin Long authored
    There are two nat functions are nearly the same in both OVS and
    TC code, (ovs_)ct_nat_execute() and ovs_ct_nat/tcf_ct_act_nat().
    
    This patch creates nf_nat_ovs.c under netfilter and moves them
    there then exports nf_ct_nat() so that it can be shared by both
    OVS and TC, and keeps the nat (type) check and nat flag update
    in OVS and TC's own place, as these parts are different between
    OVS and TC.
    
    Note that in OVS nat function it was using skb->protocol to get
    the proto as it already skips vlans in key_extract(), while it
    doesn't in TC, and TC has to call skb_protocol() to get proto.
    So in nf_ct_nat_execute(), we keep using skb_protocol() which
    works for both OVS and TC contrack.
    Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
    Acked-by: default avatarAaron Conole <aconole@redhat.com>
    Acked-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ebddb140
act_ct.c 39.5 KB