Makefile.am: Clean flake8-check too.
[cascardo/ovs.git] / datapath / conntrack.c
index d1bd45f..795ed91 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/kconfig.h>
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(3,9,0) && \
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && \
     IS_ENABLED(CONFIG_NF_CONNTRACK)
 
 #include <linux/module.h>
@@ -30,6 +30,7 @@
 #include "conntrack.h"
 #include "flow.h"
 #include "flow_netlink.h"
+#include "gso.h"
 
 struct ovs_ct_len_tbl {
        size_t maxlen;
@@ -149,6 +150,7 @@ static void __ovs_ct_update_key(struct sw_flow_key *key, u8 state,
  * previously sent the packet to conntrack via the ct action.
  */
 static void ovs_ct_update_key(const struct sk_buff *skb,
+                             const struct ovs_conntrack_info *info,
                              struct sw_flow_key *key, bool post_ct)
 {
        const struct nf_conntrack_zone *zone = &nf_ct_zone_dflt;
@@ -166,13 +168,15 @@ static void ovs_ct_update_key(const struct sk_buff *skb,
                zone = nf_ct_zone(ct);
        } else if (post_ct) {
                state = OVS_CS_F_TRACKED | OVS_CS_F_INVALID;
+               if (info)
+                       zone = &info->zone;
        }
        __ovs_ct_update_key(key, state, zone, ct);
 }
 
 void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key)
 {
-       ovs_ct_update_key(skb, key, false);
+       ovs_ct_update_key(skb, NULL, key, false);
 }
 
 int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb)
@@ -307,7 +311,7 @@ static int ovs_ct_helper(struct sk_buff *skb, u16 proto)
 static int handle_fragments(struct net *net, struct sw_flow_key *key,
                            u16 zone, struct sk_buff *skb)
 {
-       struct ovs_skb_cb ovs_cb = *OVS_CB(skb);
+       struct ovs_gso_cb ovs_cb = *OVS_GSO_CB(skb);
 
        if (!skb->dev) {
                OVS_NLERR(true, "%s: skb has no dev; dropping", __func__);
@@ -323,7 +327,7 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key,
                if (err)
                        return err;
 
-               ovs_cb.mru = IPCB(skb)->frag_max_size;
+               ovs_cb.dp_cb.mru = IPCB(skb)->frag_max_size;
 #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
        } else if (key->eth.type == htons(ETH_P_IPV6)) {
                enum ip6_defrag_users user = IP6_DEFRAG_CONNTRACK_IN + zone;
@@ -349,7 +353,7 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key,
                skb_morph(skb, reasm);
                skb->next = reasm->next;
                consume_skb(reasm);
-               ovs_cb.mru = IP6CB(skb)->frag_max_size;
+               ovs_cb.dp_cb.mru = IP6CB(skb)->frag_max_size;
 #endif /* IP frag support */
        } else {
                kfree_skb(skb);
@@ -359,7 +363,7 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key,
        key->ip.frag = OVS_FRAG_TYPE_NONE;
        skb_clear_hash(skb);
        skb->ignore_df = 1;
-       *OVS_CB(skb) = ovs_cb;
+       *OVS_GSO_CB(skb) = ovs_cb;
 
        return 0;
 }
@@ -431,7 +435,7 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
                }
        }
 
-       ovs_ct_update_key(skb, key, true);
+       ovs_ct_update_key(skb, info, key, true);
 
        return 0;
 }
@@ -795,4 +799,4 @@ void ovs_ct_exit(struct net *net)
                nf_connlabels_put(net);
 }
 
-#endif /* CONFIG_NF_CONNTRACK && LINUX > 3.9 */
+#endif /* CONFIG_NF_CONNTRACK && LINUX > 3.10 */