openvswitch: support asymmetric conntrack
[linux-2.6-microblaze.git] / net / openvswitch / conntrack.c
index df9c80b..e726159 100644 (file)
@@ -903,6 +903,17 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key,
        }
        err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype);
 
+       if (err == NF_ACCEPT &&
+           ct->status & IPS_SRC_NAT && ct->status & IPS_DST_NAT) {
+               if (maniptype == NF_NAT_MANIP_SRC)
+                       maniptype = NF_NAT_MANIP_DST;
+               else
+                       maniptype = NF_NAT_MANIP_SRC;
+
+               err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range,
+                                        maniptype);
+       }
+
        /* Mark NAT done if successful and update the flow key. */
        if (err == NF_ACCEPT)
                ovs_nat_update_key(key, skb, maniptype);