diff mbox series

[ovs-dev,v4,4/4] conntrack: Enforce conn_type for conn_clean().

Message ID 1545086594-125228-4-git-send-email-dlu998@gmail.com
State Accepted
Headers show
Series [ovs-dev,v4,1/4] conntrack: Skip ephemeral ports fallback for DNAT. | expand

Commit Message

Darrell Ball Dec. 17, 2018, 10:43 p.m. UTC
Add check to validate that 'conn_clean()' is only called for
conntrack entries of default 'conn_type'.

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

Comments

Ben Pfaff Dec. 18, 2018, 10:20 p.m. UTC | #1
On Mon, Dec 17, 2018 at 02:43:14PM -0800, Darrell Ball wrote:
> Add check to validate that 'conn_clean()' is only called for
> conntrack entries of default 'conn_type'.
> 
> Signed-off-by: Darrell Ball <dlu998@gmail.com>

Applied to master, thanks!
diff mbox series

Patch

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 41232f4..7b5a3f0 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -803,11 +803,14 @@  nat_clean(struct conntrack *ct, struct conn *conn,
     ct_lock_lock(&ctb->lock);
 }
 
+/* Must be called with 'CT_CONN_TYPE_DEFAULT' 'conn_type'. */
 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);
     }