-/* Adds new interfaces to 'port' and updates 'type' and 'cfg' members of
- * existing ones. */
-static void
-port_add_ifaces(struct port *port)
-{
- struct shash new_ifaces;
- struct shash_node *node;
- size_t i;
-
- /* Collect new ifaces. */
- shash_init(&new_ifaces);
- for (i = 0; i < port->cfg->n_interfaces; i++) {
- const struct ovsrec_interface *cfg = port->cfg->interfaces[i];
- if (strcmp(cfg->type, "null")
- && !shash_add_once(&new_ifaces, cfg->name, cfg)) {
- VLOG_WARN("port %s: %s specified twice as port interface",
- port->name, cfg->name);
- iface_clear_db_record(cfg);
- }
- }
-
- /* Create new interfaces.
- * Update interface types and 'cfg' members. */
- SHASH_FOR_EACH (node, &new_ifaces) {
- const struct ovsrec_interface *cfg = node->data;
- const char *iface_name = node->name;
- struct iface *iface;
-
- iface = iface_lookup(port->bridge, iface_name);
- if (!iface) {
- iface = iface_create(port, cfg);
- } else {
- iface->cfg = cfg;
- }
-
- /* Determine interface type. The local port always has type
- * "internal". Other ports take their type from the database and
- * default to "system" if none is specified. */
- iface->type = (!strcmp(iface_name, port->bridge->name) ? "internal"
- : cfg->type[0] ? cfg->type
- : "system");
- }
- shash_destroy(&new_ifaces);
-}
-