From 8e8cddf7946aa19a8567d8f2edc369009520e931 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 8 Mar 2012 14:27:35 -0800 Subject: [PATCH] netdev-linux: Use "read", not "recv", for tap devices. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit "recv" only works for sockets, but tap devices aren't sockets. Makes the userspace switch work again. Reported-by: Ravi Kerur Reported-by: 胡靖飞 Signed-off-by: Ben Pfaff --- AUTHORS | 2 ++ lib/netdev-linux.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index c6a865b7..b9806733 100644 --- a/AUTHORS +++ b/AUTHORS @@ -39,6 +39,7 @@ Neil McKee neil.mckee@inmon.com Paul Fazzone pfazzone@nicira.com Philippe Jung phil.jung@free.fr Pravin B Shelar pshelar@nicira.com +Ravi Kerur Ravi.Kerur@telekom.com Reid Price reid@nicira.com Rob Hoes rob.hoes@citrix.com Romain Lenglet romain.lenglet@berabera.info @@ -140,6 +141,7 @@ Yongqiang Liu liuyq7809@gmail.com kk yap yapkke@stanford.edu likunyun kunyunli@hotmail.com 冯全树(Crab) fqs888@126.com +胡靖飞 hujingfei914@msn.com Thanks to all Open vSwitch contributors. If you are not listed above but believe that you should be, please write to dev@openvswitch.org. diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 3c474e37..7c2b901b 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -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) { -- 2.30.2