mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
netfilter: replace NF_NAT_NEEDED with IS_ENABLED(CONFIG_NF_NAT)
NF_NAT_NEEDED is true whenever nat support for either ipv4 or ipv6 is enabled. Now that the af-specific nat configuration switches have been removed, IS_ENABLED(CONFIG_NF_NAT) has the same effect. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
committed by
Pablo Neira Ayuso
parent
c1deb065cf
commit
4806e97572
@@ -29,7 +29,7 @@
|
||||
#include <net/netfilter/ipv6/nf_defrag_ipv6.h>
|
||||
#include <net/ipv6_frag.h>
|
||||
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
#if IS_ENABLED(CONFIG_NF_NAT)
|
||||
#include <net/netfilter/nf_nat.h>
|
||||
#endif
|
||||
|
||||
@@ -75,7 +75,7 @@ struct ovs_conntrack_info {
|
||||
struct md_mark mark;
|
||||
struct md_labels labels;
|
||||
char timeout[CTNL_TIMEOUT_NAME_MAX];
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
#if IS_ENABLED(CONFIG_NF_NAT)
|
||||
struct nf_nat_range2 range; /* Only present for SRC NAT and DST NAT. */
|
||||
#endif
|
||||
};
|
||||
@@ -721,7 +721,7 @@ static bool skb_nfct_cached(struct net *net,
|
||||
return ct_executed;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
#if IS_ENABLED(CONFIG_NF_NAT)
|
||||
/* Modelled after nf_nat_ipv[46]_fn().
|
||||
* range is only used for new, uninitialized NAT state.
|
||||
* Returns either NF_ACCEPT or NF_DROP.
|
||||
@@ -903,7 +903,7 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key,
|
||||
|
||||
return err;
|
||||
}
|
||||
#else /* !CONFIG_NF_NAT_NEEDED */
|
||||
#else /* !CONFIG_NF_NAT */
|
||||
static int ovs_ct_nat(struct net *net, struct sw_flow_key *key,
|
||||
const struct ovs_conntrack_info *info,
|
||||
struct sk_buff *skb, struct nf_conn *ct,
|
||||
@@ -1330,7 +1330,7 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
#if IS_ENABLED(CONFIG_NF_NAT)
|
||||
static int parse_nat(const struct nlattr *attr,
|
||||
struct ovs_conntrack_info *info, bool log)
|
||||
{
|
||||
@@ -1467,7 +1467,7 @@ static const struct ovs_ct_len_tbl ovs_ct_attr_lens[OVS_CT_ATTR_MAX + 1] = {
|
||||
.maxlen = sizeof(struct md_labels) },
|
||||
[OVS_CT_ATTR_HELPER] = { .minlen = 1,
|
||||
.maxlen = NF_CT_HELPER_NAME_LEN },
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
#if IS_ENABLED(CONFIG_NF_NAT)
|
||||
/* NAT length is checked when parsing the nested attributes. */
|
||||
[OVS_CT_ATTR_NAT] = { .minlen = 0, .maxlen = INT_MAX },
|
||||
#endif
|
||||
@@ -1547,7 +1547,7 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
#if IS_ENABLED(CONFIG_NF_NAT)
|
||||
case OVS_CT_ATTR_NAT: {
|
||||
int err = parse_nat(a, info, log);
|
||||
|
||||
@@ -1677,7 +1677,7 @@ err_free_ct:
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
#if IS_ENABLED(CONFIG_NF_NAT)
|
||||
static bool ovs_ct_nat_to_attr(const struct ovs_conntrack_info *info,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
@@ -1783,7 +1783,7 @@ int ovs_ct_action_to_attr(const struct ovs_conntrack_info *ct_info,
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NF_NAT_NEEDED
|
||||
#if IS_ENABLED(CONFIG_NF_NAT)
|
||||
if (ct_info->nat && !ovs_ct_nat_to_attr(ct_info, skb))
|
||||
return -EMSGSIZE;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user