-netdev_linux_open(struct netdev_dev *netdev_dev_, struct netdev **netdevp)
-{
- struct netdev_linux *netdev;
- enum netdev_flags flags;
- int error;
-
- /* Allocate network device. */
- netdev = xzalloc(sizeof *netdev);
- netdev->fd = -1;
- netdev_init(&netdev->netdev, netdev_dev_);
-
- /* Verify that the device really exists, by attempting to read its flags.
- * (The flags might be cached, in which case this won't actually do an
- * ioctl.)
- *
- * Don't do this for "internal" netdevs, though, because those have to be
- * created as netdev objects before they exist in the kernel, because
- * creating them in the kernel happens by passing a netdev object to
- * dpif_port_add(). */
- if (netdev_dev_get_class(netdev_dev_) != &netdev_internal_class) {
- error = netdev_get_flags(&netdev->netdev, &flags);
- if (error == ENODEV) {
- goto error;
- }
- }
-
- *netdevp = &netdev->netdev;
- return 0;
-
-error:
- netdev_uninit(&netdev->netdev, true);
- return error;
-}
-
-/* Closes and destroys 'netdev'. */
-static void
-netdev_linux_close(struct netdev *netdev_)
-{
- struct netdev_linux *netdev = netdev_linux_cast(netdev_);
-
- if (netdev->fd > 0 && strcmp(netdev_get_type(netdev_), "tap")) {
- close(netdev->fd);
- }
- free(netdev);
-}
-
-static int
-netdev_linux_listen(struct netdev *netdev_)