-/* Returns the type of network device that 'iface' should have. (This is
- * ordinarily the same type as the interface, but the network devices for
- * "internal" ports have type "system".) */
-static const char *
-iface_get_netdev_type(const struct iface *iface)
-{
- return !strcmp(iface->type, "internal") ? "system" : iface->type;
-}
-
-/* Attempt to create the network device for 'iface' through the netdev
- * library. */
-static int
-create_iface_netdev(struct iface *iface)
-{
- struct netdev_options netdev_options;
- struct shash options;
- int error;
-
- memset(&netdev_options, 0, sizeof netdev_options);
- netdev_options.name = iface->cfg->name;
- netdev_options.type = iface_get_netdev_type(iface);
- netdev_options.args = &options;
- netdev_options.ethertype = NETDEV_ETH_TYPE_NONE;
-
- iface_get_options(iface->cfg, &options);
-
- error = netdev_open(&netdev_options, &iface->netdev);
-
- if (iface->netdev) {
- iface->enabled = netdev_get_carrier(iface->netdev);
- }
-
- shash_destroy(&options);
-
- return error;
-}
-
-static int
-reconfigure_iface_netdev(struct iface *iface)
-{
- const char *netdev_type, *iface_type;
- struct shash options;
- int error;
-
- /* Skip reconfiguration if the device has the wrong type. This shouldn't
- * happen, but... */
- iface_type = iface_get_netdev_type(iface);
- netdev_type = netdev_get_type(iface->netdev);
- if (iface_type && strcmp(netdev_type, iface_type)) {
- VLOG_WARN("%s: attempting change device type from %s to %s",
- iface->cfg->name, netdev_type, iface_type);
- return EINVAL;
- }
-
- /* Reconfigure device. */
- iface_get_options(iface->cfg, &options);
- error = netdev_reconfigure(iface->netdev, &options);
- shash_destroy(&options);
-
- return error;
-}
-