Signed-off-by: Daniele Di Proietto <[email protected]>
---
lib/conntrack.c | 21 +++++++++++++++++++++
lib/conntrack.h | 3 ++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/lib/conntrack.c b/lib/conntrack.c
index 1ac8636..51332aa 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -852,3 +852,24 @@ delete_conn(struct conn *conn)
{
free(conn);
}
+
+int
+conntrack_flush(struct conntrack *ct, const uint16_t *zone)
+{
+ unsigned i;
+
+ for (i = 0; i < CONNTRACK_BUCKETS; i++) {
+ struct conn *conn, *next;
+
+ ct_lock_lock(&ct->locks[i]);
+ HMAP_FOR_EACH_SAFE(conn, next, node, &ct->connections[i]) {
+ if (!zone || *zone == conn->key.zone) {
+ hmap_remove(&ct->connections[i], &conn->node);
+ delete_conn(conn);
+ }
+ }
+ ct_lock_unlock(&ct->locks[i]);
+ }
+
+ return 0;
+}
diff --git a/lib/conntrack.h b/lib/conntrack.h
index f97a7ea..f82857f 100644
--- a/lib/conntrack.h
+++ b/lib/conntrack.h
@@ -69,6 +69,8 @@ int conntrack_execute(struct conntrack *, struct dp_packet
**, size_t,
const struct ovs_key_ct_labels *setlabel,
const char *helper);
+int conntrack_flush(struct conntrack *, const uint16_t *zone);
+
/* struct ct_lock is a standard mutex or a spinlock when using DPDK */
#ifdef DPDK_NETDEV
@@ -140,5 +142,4 @@ struct conntrack {
uint32_t purge_inner_bucket;
uint32_t purge_inner_offset;
};
-
#endif /* conntrack.h */
--
2.1.4
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev