uint16_t ofp_port);
static void iface_set_mac(struct iface *);
static void iface_set_ofport(const struct ovsrec_interface *, int64_t ofport);
+static void iface_clear_db_record(const struct ovsrec_interface *if_cfg);
static void iface_configure_qos(struct iface *, const struct ovsrec_qos *);
static void iface_configure_cfm(struct iface *);
static void iface_refresh_cfm_stats(struct iface *);
/* We already reported a related error, don't bother
* duplicating it. */
}
- iface_set_ofport(iface->cfg, -1);
+ iface_clear_db_record(iface->cfg);
iface_destroy(iface);
}
}
&& !shash_add_once(&new_ifaces, cfg->name, cfg)) {
VLOG_WARN("port %s: %s specified twice as port interface",
port->name, cfg->name);
- iface_set_ofport(cfg, -1);
+ iface_clear_db_record(cfg);
}
}
}
}
+/* Clears all of the fields in 'if_cfg' that indicate interface status, and
+ * sets the "ofport" field to -1.
+ *
+ * This is appropriate when 'if_cfg''s interface cannot be created or is
+ * otherwise invalid. */
+static void
+iface_clear_db_record(const struct ovsrec_interface *if_cfg)
+{
+ if (!ovsdb_idl_row_is_synthetic(&if_cfg->header_)) {
+ iface_set_ofport(if_cfg, -1);
+ ovsrec_interface_set_status(if_cfg, NULL, NULL, 0);
+ ovsrec_interface_set_admin_state(if_cfg, NULL);
+ ovsrec_interface_set_duplex(if_cfg, NULL);
+ ovsrec_interface_set_link_speed(if_cfg, NULL, 0);
+ ovsrec_interface_set_link_state(if_cfg, NULL);
+ ovsrec_interface_set_mtu(if_cfg, NULL, 0);
+ ovsrec_interface_set_cfm_fault(if_cfg, NULL, 0);
+ ovsrec_interface_set_cfm_remote_mpids(if_cfg, NULL, 0);
+ ovsrec_interface_set_lacp_current(if_cfg, NULL, 0);
+ ovsrec_interface_set_statistics(if_cfg, NULL, NULL, 0);
+ }
+}
+
/* Adds the 'n' key-value pairs in 'keys' in 'values' to 'shash'.
*
* The value strings in '*shash' are taken directly from values[], not copied,