@@ -198,18 +198,21 @@ static int tcf_ct_flow_table_add_action_nat(struct net *net,
struct flow_action *action)
{
const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
+ bool nat = ct->status & IPS_NAT_MASK;
struct nf_conntrack_tuple target;
nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple);
switch (tuple->src.l3num) {
case NFPROTO_IPV4:
- tcf_ct_flow_table_add_action_nat_ipv4(tuple, target,
- action);
+ if (nat)
+ tcf_ct_flow_table_add_action_nat_ipv4(tuple, target,
+ action);
break;
case NFPROTO_IPV6:
- tcf_ct_flow_table_add_action_nat_ipv6(tuple, target,
- action);
+ if (nat)
+ tcf_ct_flow_table_add_action_nat_ipv6(tuple, target,
+ action);
break;
default:
return -EOPNOTSUPP;
@@ -217,10 +220,14 @@ static int tcf_ct_flow_table_add_action_nat(struct net *net,
switch (nf_ct_protonum(ct)) {
case IPPROTO_TCP:
- tcf_ct_flow_table_add_action_nat_tcp(tuple, target, action);
+ if (nat)
+ tcf_ct_flow_table_add_action_nat_tcp(tuple, target,
+ action);
break;
case IPPROTO_UDP:
- tcf_ct_flow_table_add_action_nat_udp(tuple, target, action);
+ if (nat)
+ tcf_ct_flow_table_add_action_nat_udp(tuple, target,
+ action);
break;
default:
return -EOPNOTSUPP;