From: yaolingfei <[email protected]>

Check for duplicate controller parameters. Duplicate parameters
will be skipped, not added to the "ocs" structure, and a warm
message will be output to the log.

If there are duplicate controller parameters, although
"ofservice_create" will not be called for duplicate creation
in "connmgr_set_controllers", and there will be no memory leakage,
there will be xmalloc duplicate "ofproto_controller" structure in
"bridge_configure_remotes", which incurs unnecessary memory
overhead. And users will not perceive it.

  7d674866d2c9 (ofproto: Add support for remote "service controllers")

Signed-off-by: yaolingfei <[email protected]>
---
 vswitchd/bridge.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 475eefefa..7903450e2 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -4063,6 +4063,13 @@ bridge_configure_remotes(struct bridge *br,
             free(allowed);
         }
 
+        if (shash_find(&ocs, c->target)) {
+            static struct vlog_rate_limit rl2 = VLOG_RATE_LIMIT_INIT(1, 5);
+            VLOG_WARN_RL(&rl2, "bridge %s: Duplicate controllers \"%s\".",
+                br->name, c->target);
+            continue;
+        }
+
         bridge_configure_local_iface_netdev(br, c);
 
         int dscp = smap_get_int(&c->other_config, "dscp", DSCP_DEFAULT);
-- 
2.40.1.windows.1

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

Reply via email to