2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-linux: Use "read", not "recv", for tap devices.

"recv" only works for sockets, but tap devices aren't sockets.

Makes the userspace switch work again.

Reported-by: Ravi Kerur <Ravi.Kerur@telekom.com>
Reported-by: 胡靖飞 <hujingfei914@msn.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2012-03-08 14:27:35 -08:00
parent 1158389afa
commit 8e8cddf794
2 changed files with 7 additions and 1 deletions

View File

@@ -797,7 +797,11 @@ netdev_linux_recv(struct netdev *netdev_, void *data, size_t size)
}
for (;;) {
ssize_t retval = recv(netdev->fd, data, size, MSG_TRUNC);
ssize_t retval;
retval = (netdev_->netdev_dev->netdev_class == &netdev_tap_class
? read(netdev->fd, data, size)
: recv(netdev->fd, data, size, MSG_TRUNC));
if (retval >= 0) {
return retval <= size ? retval : -EMSGSIZE;
} else if (errno != EINTR) {