netdev-vport: Don't use ipsec options for either arg in config_equal_ipsec().
authorJustin Pettit <jpettit@nicira.com>
Fri, 17 Jun 2011 01:04:41 +0000 (18:04 -0700)
committerJustin Pettit <jpettit@nicira.com>
Fri, 17 Jun 2011 01:04:41 +0000 (18:04 -0700)
Commit aebf423 (netdev: Add methods to do netdev-specific argument
comparisons.) added a new config_equal_ipsec() function to ignore
IPsec key options when comparing an existing netdev's options with a new
netdev.  We only ignored the options for the new netdev configuration,
which works when pulling the existing configuration from the kernel.
Unfortunately, if this is just a re-init of a netdev for which we just
created, this ignoring of the IPsec key options on the new netdev will
cause the check to fail, since the full options actually available in
both netdevs.  This commit just ignore all IPsec key options from both
netdevs.

lib/netdev-vport.c

index bc7d050..b9c1bfe 100644 (file)
@@ -898,19 +898,26 @@ unparse_patch_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED,
 static bool
 config_equal_ipsec(const struct shash *nd_args, const struct shash *args)
 {
-        struct shash tmp;
+        struct shash tmp1, tmp2;
         bool result;
 
-        smap_clone(&tmp, args);
-
-        shash_find_and_delete(&tmp, "psk");
-        shash_find_and_delete(&tmp, "peer_cert");
-        shash_find_and_delete(&tmp, "certificate");
-        shash_find_and_delete(&tmp, "private_key");
-        shash_find_and_delete(&tmp, "use_ssl_cert");
-
-        result = smap_equal(&tmp, nd_args);
-        smap_destroy(&tmp);
+        smap_clone(&tmp1, nd_args);
+        smap_clone(&tmp2, args);
+
+        shash_find_and_delete(&tmp1, "psk");
+        shash_find_and_delete(&tmp2, "psk");
+        shash_find_and_delete(&tmp1, "peer_cert");
+        shash_find_and_delete(&tmp2, "peer_cert");
+        shash_find_and_delete(&tmp1, "certificate");
+        shash_find_and_delete(&tmp2, "certificate");
+        shash_find_and_delete(&tmp1, "private_key");
+        shash_find_and_delete(&tmp2, "private_key");
+        shash_find_and_delete(&tmp1, "use_ssl_cert");
+        shash_find_and_delete(&tmp2, "use_ssl_cert");
+
+        result = smap_equal(&tmp1, &tmp2);
+        smap_destroy(&tmp1);
+        smap_destroy(&tmp2);
  
         return result;
 }