]> git.proxmox.com Git - mirror_ovs.git/blobdiff - lib/simap.c
ipf: Avoid accessing to a freed rp.
[mirror_ovs.git] / lib / simap.c
index d634f8ed9eead0aeac1caccca1a9a57437ceef0d..f404ece67703bb794ee8d1d26a7349b4b13f91da 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012, 2017 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2017, 2019 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -242,6 +242,19 @@ simap_equal(const struct simap *a, const struct simap *b)
     return true;
 }
 
+uint32_t
+simap_hash(const struct simap *simap)
+{
+    uint32_t hash = 0;
+
+    const struct simap_node *node;
+    SIMAP_FOR_EACH (node, simap) {
+        hash ^= hash_int(node->data,
+                         hash_name(node->name, strlen(node->name)));
+    }
+    return hash;
+}
+
 static size_t
 hash_name(const char *name, size_t length)
 {