- error = dpif_linux_vport_get(name, &reply, &buf);
- if (!error) {
- /* XXX verify correct type */
- error = vport_class->unparse_config(name, netdev_class->type,
- reply.options,
- reply.options_len,
- &fetched_args);
- if (error) {
- VLOG_ERR_RL(&rl, "%s: failed to parse kernel config (%s)",
- name, strerror(error));
- } else {
- options = ofpbuf_clone_data(reply.options, reply.options_len);
- dp_ifindex = reply.dp_ifindex;
- port_no = reply.port_no;
- }
- ofpbuf_delete(buf);
- } else {
- VLOG_ERR_RL(&rl, "%s: vport query failed (%s)",
- name, strerror(error));
- }
- }
-
- if (!error) {
- struct netdev_dev_vport *dev;
-
- dev = xmalloc(sizeof *dev);
- netdev_dev_init(&dev->netdev_dev, name,
- shash_is_empty(&fetched_args) ? args : &fetched_args,
- netdev_class);
- dev->options = options;
- dev->dp_ifindex = dp_ifindex;
- dev->port_no = port_no;
-
- *netdev_devp = &dev->netdev_dev;
- route_table_register();
- } else {
- ofpbuf_delete(options);
- }
-
- shash_destroy(&fetched_args);
-
- return error;