[ovs-dev] [PATCH 3/4] netdev-linux: Fix tap device using wrong FD.
Jesse Gross
jesse at nicira.com
Wed Sep 30 19:54:03 UTC 2009
Tap devices were doing ioctls on the AF_INET socket, instead of the
FD opened on the tap device.
---
lib/netdev-linux.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 5abf6e1..50a0d2d 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -239,9 +239,11 @@ netdev_linux_open(const char *name, char *suffix, int ethertype,
/* Create tap device. */
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
- error = netdev_linux_do_ioctl(&netdev->netdev, &ifr,
- TUNSETIFF, "TUNSETIFF");
- if (error) {
+ strncpy(ifr.ifr_name, suffix, sizeof ifr.ifr_name);
+ if (ioctl(netdev->tap_fd, TUNSETIFF, &ifr) == -1) {
+ VLOG_WARN("%s: creating tap device failed: %s", suffix,
+ strerror(errno));
+ error = errno;
goto error;
}
--
1.6.0.4
More information about the dev
mailing list