]> git.proxmox.com Git - mirror_ovs.git/commitdiff
flow: New function flow_clear_conntrack().
authorBen Pfaff <blp@ovn.org>
Tue, 18 Apr 2017 18:22:05 +0000 (11:22 -0700)
committerBen Pfaff <blp@ovn.org>
Fri, 21 Apr 2017 15:20:06 +0000 (08:20 -0700)
This will have a new user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
lib/flow.c
lib/flow.h
ofproto/ofproto-dpif-xlate.c

index 7552cd72a1733006041ec018d3f36731fd9d90fc..2ba51214ef80a57654fd81f6c835f7f0a8db1cb7 100644 (file)
@@ -1024,6 +1024,27 @@ ct_state_from_string(const char *s)
     return 0;
 }
 
+/* Clears the fields in 'flow' associated with connection tracking. */
+void
+flow_clear_conntrack(struct flow *flow)
+{
+    flow->ct_state = 0;
+    flow->ct_zone = 0;
+    flow->ct_mark = 0;
+    flow->ct_label = OVS_U128_ZERO;
+
+    flow->ct_nw_proto = 0;
+    flow->ct_tp_src = 0;
+    flow->ct_tp_dst = 0;
+    if (flow->dl_type == htons(ETH_TYPE_IP)) {
+        flow->ct_nw_src = 0;
+        flow->ct_nw_dst = 0;
+    } else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
+        memset(&flow->ct_ipv6_src, 0, sizeof flow->ct_ipv6_src);
+        memset(&flow->ct_ipv6_dst, 0, sizeof flow->ct_ipv6_dst);
+    }
+}
+
 char *
 flow_to_string(const struct flow *flow)
 {
index 9d4ae49ccfbd35781edc4b2a96f1809f3022d1eb..2957108a68db3b79adff6080c85f0cc764a46d96 100644 (file)
@@ -74,6 +74,7 @@ void flow_get_metadata(const struct flow *, struct match *flow_metadata);
 
 const char *ct_state_to_string(uint32_t state);
 uint32_t ct_state_from_string(const char *);
+void flow_clear_conntrack(struct flow *);
 
 char *flow_to_string(const struct flow *);
 void format_flags(struct ds *ds, const char *(*bit_to_string)(uint32_t),
index 238aae41bb839f487fa2541aa9b09c50bc5220c9..64452ed208a91b87f992bb933249d001671bb1ed 100644 (file)
@@ -3216,23 +3216,7 @@ static void
 clear_conntrack(struct xlate_ctx *ctx)
 {
     ctx->conntracked = false;
-
-    struct flow *flow = &ctx->xin->flow;
-    flow->ct_state = 0;
-    flow->ct_zone = 0;
-    flow->ct_mark = 0;
-    flow->ct_label = OVS_U128_ZERO;
-
-    flow->ct_nw_proto = 0;
-    flow->ct_tp_src = 0;
-    flow->ct_tp_dst = 0;
-    if (flow->dl_type == htons(ETH_TYPE_IP)) {
-        flow->ct_nw_src = 0;
-        flow->ct_nw_dst = 0;
-    } if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
-        memset(&flow->ct_ipv6_src, 0, sizeof flow->ct_ipv6_src);
-        memset(&flow->ct_ipv6_dst, 0, sizeof flow->ct_ipv6_dst);
-    }
+    flow_clear_conntrack(&ctx->xin->flow);
 }
 
 static bool