Un-nat conns have no nat_info as do default conns.
However, un-nat conns are originally templated from the
corresponding default conns and therefore need to
have their nat_info explicitly nulled.  This
otherwise exposes a double free if conntrack_destroy()
were to be used to destroy the connection tracker.  This
would apply to cleaning the datapath after testing.

Fixes: 286de2729955 ("dpdk: Userspace Datapath: Introduce NAT Support.")
Signed-off-by: Darrell Ball <[email protected]>
---
 lib/conntrack.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 146edd7..90b154a 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -573,6 +573,7 @@ conn_not_found(struct conntrack *ct, struct dp_packet *pkt,
                 nc->conn_type == CT_CONN_TYPE_DEFAULT) {
                 *nc = *conn_for_un_nat_copy;
                 conn_for_un_nat_copy->conn_type = CT_CONN_TYPE_UN_NAT;
+                conn_for_un_nat_copy->nat_info = NULL;
             }
             ct_rwlock_unlock(&ct->nat_resources_lock);
 
-- 
1.9.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to