[ovs-dev] [PATCH] conntrack: Fix conn_type need be checked when remove rev_conn.

wangyunjian wangyunjian at huawei.com
Sat Sep 23 09:35:49 UTC 2017


We use hping3 to send random tcp, udp from VM1 to VM2. We met a issue that conn_lookup( ) will find
rev_conn->conn_type = CT_CONN_TYPE_DEFAULT in nat_clean().

Is this rev_conn->conn_type = CT_CONN_TYPE_DEFAULT ok?

I think the rev_conn->conn_type need to be CT_CONN_TYPE_UN_NAT.

From: Darrell Ball [mailto:dlu998 at gmail.com]
Sent: Tuesday, September 12, 2017 12:38 PM
To: wangyunjian <wangyunjian at huawei.com>
Cc: ovs dev <dev at openvswitch.org>; Huanglili (lee) <huanglili.huang at huawei.com>; blp at ovs.org
Subject: Re: [ovs-dev] [PATCH] conntrack: Fix conn_type need be checked when remove rev_conn.

We cannot merge this patch.

Can you provide answers to the questions I asked here

https://mail.openvswitch.org/pipermail/ovs-discuss/2017-September/045308.html

Thanks Darrell


On Mon, Sep 11, 2017 at 2:49 AM, w00273186 <wangyunjian at huawei.com<mailto:wangyunjian at huawei.com>> wrote:
From: Yunjian Wang <wangyunjian at huawei.com<mailto:wangyunjian at huawei.com>>

The rev_conn need will be removed, only when conn_type is CT_CONN_TYPE_UN_NAT.
This crash will be triggered when remove conn in ct-clean thread.

Reported-by: Lili Huang <huanglili.huang at huawei.com<mailto:huanglili.huang at huawei.com>>
Signed-off-by: Yunjian Wang <wangyunjian at huawei.com<mailto:wangyunjian at huawei.com>>
---
 lib/conntrack.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 419cb1d..c1adb56 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -684,9 +684,10 @@ nat_clean(struct conntrack *ct, struct conn *conn,

     /* In the unlikely event, rev conn was recreated, then skip
      * rev_conn cleanup. */
-    if (rev_conn && (!nat_conn_key_node ||
-                     conn_key_cmp(&nat_conn_key_node->value,
-                                  &rev_conn->rev_key))) {
+    if (rev_conn &&
+        (rev_conn->conn_type == CT_CONN_TYPE_UN_NAT) &&
+        (!nat_conn_key_node || conn_key_cmp(&nat_conn_key_node->value,
+                                            &rev_conn->rev_key))) {
         hmap_remove(&ct->buckets[bucket_rev_conn].connections,
                     &rev_conn->node);
         free(rev_conn);
--
1.8.3.1


_______________________________________________
dev mailing list
dev at openvswitch.org<mailto:dev at openvswitch.org>
https://mail.openvswitch.org/mailman/listinfo/ovs-dev



More information about the dev mailing list