[ovs-dev,v2,3/6] conntrack: Enforce conn_type for conn_clean().

Message ID 1536124490-86810-3-git-send-email-dlu998@gmail.com
State New
Delegated to: Justin Pettit
Headers show
Series
  • [ovs-dev,v2,1/6] conntrack: Handle self nat case.
Related show

Commit Message

Darrell Ball Sept. 5, 2018, 5:14 a.m.
Add check to validate that 'conn_clean()' is only called for
conntrack entries of default 'conn_type'.
Needs backporting to 2.8.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
---
 lib/conntrack.c | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 4b53e82..15e0a62 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -806,11 +806,14 @@  nat_clean(struct conntrack *ct, struct conn *conn,
     ct_lock_lock(&ctb->lock);
 }
 
+/* Must be called with 'conn' of 'conn_type' CT_CONN_TYPE_DEFAULT. */
 static void
 conn_clean(struct conntrack *ct, struct conn *conn,
            struct conntrack_bucket *ctb)
     OVS_REQUIRES(ctb->lock)
 {
+    ovs_assert(conn->conn_type == CT_CONN_TYPE_DEFAULT);
+
     if (conn->alg) {
         expectation_clean(ct, &conn->key, ct->hash_basis);
     }