[ovs-dev] [PATCH v2 05/11] lport: Be a little more careful building lport index.
Ben Pfaff
blp at ovn.org
Fri Dec 16 22:25:31 UTC 2016
It seems like a good idea to check for and warn about all kinds of
duplicates, and to avoid segfaulting if a datapath column is empty.
(However, the database schema should prevent both issues.)
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
ovn/controller/lport.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ovn/controller/lport.c b/ovn/controller/lport.c
index e1ecf21..3484c2c 100644
--- a/ovn/controller/lport.c
+++ b/ovn/controller/lport.c
@@ -37,12 +37,24 @@ lport_index_init(struct lport_index *lports, struct ovsdb_idl *ovnsb_idl)
const struct sbrec_port_binding *pb;
SBREC_PORT_BINDING_FOR_EACH (pb, ovnsb_idl) {
+ if (!pb->datapath) {
+ continue;
+ }
+
if (lport_lookup_by_name(lports, pb->logical_port)) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
VLOG_WARN_RL(&rl, "duplicate logical port name '%s'",
pb->logical_port);
continue;
}
+ if (lport_lookup_by_key(lports, pb->datapath->tunnel_key,
+ pb->tunnel_key)) {
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
+ VLOG_WARN_RL(&rl, "duplicate logical port %"PRId64" in logical "
+ "datapath %"PRId64,
+ pb->tunnel_key, pb->datapath->tunnel_key);
+ continue;
+ }
struct lport *p = xmalloc(sizeof *p);
hmap_insert(&lports->by_name, &p->name_node,
--
2.10.2
More information about the dev
mailing list