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);
}
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");
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);
if (!strcmp(binding->type, "gateway")) {
const char *chassis = smap_get(&binding->options,
"gateway-chassis");
- if (!strcmp(local_chassis_id, chassis)) {
+ if (chassis && !strcmp(local_chassis_id, chassis)) {
local_port = true;
}
}