Found by inspection. Signed-off-by: Ben Pfaff <b...@ovn.org> --- ovn/controller/encaps.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/ovn/controller/encaps.c b/ovn/controller/encaps.c index 03ec732..977cc3a 100644 --- a/ovn/controller/encaps.c +++ b/ovn/controller/encaps.c @@ -103,6 +103,10 @@ port_hash_rec(const struct ovsrec_port *port) iface = port->interfaces[0]; ip = smap_get(&iface->options, "remote_ip"); + if (!ip) { + /* This should not happen for an OVN-created port. */ + return 0; + } return port_hash(chassis_id, iface->type, ip); } @@ -314,7 +318,8 @@ check_and_update_tunnel(const struct sbrec_chassis *chassis_rec) if (strcmp(encap->type, iface->type)) { ovsrec_interface_set_type(iface, encap->type); } - if (strcmp(encap->ip, smap_get(&iface->options, "remote_ip"))) { + const char *ip = smap_get(&iface->options, "remote_ip"); + if (!ip || strcmp(encap->ip, ip)) { struct smap options = SMAP_INITIALIZER(&options); smap_add(&options, "remote_ip", encap->ip); smap_add(&options, "key", "flow"); @@ -322,8 +327,8 @@ check_and_update_tunnel(const struct sbrec_chassis *chassis_rec) smap_destroy(&options); } - if (strcmp(chassis_rec->name, smap_get(&port->external_ids, - "ovn-chassis-id"))) { + const char *chassis = smap_get(&port->external_ids, "ovn-chassis-id"); + if (!chassis || strcmp(chassis_rec->name, chassis)) { const struct smap id = SMAP_CONST1(&id, "ovn-chassis-id", chassis_rec->name); ovsrec_port_set_external_ids(port, &id); -- 2.1.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev