netdev-linux: Use "read", not "recv", for tap devices.
authorBen Pfaff <blp@nicira.com>
Thu, 8 Mar 2012 22:27:35 +0000 (14:27 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 8 Mar 2012 22:28:24 +0000 (14:28 -0800)
"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>
AUTHORS
lib/netdev-linux.c

diff --git a/AUTHORS b/AUTHORS
index c6a865b7fbd73c7cacc39b0b47842f012eed0817..b9806733bb05ff782253c364ccc29d6370dbd496 100644 (file)
--- 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.
index 3c474e371410020dbe72bfbebed6ee0e3c7529c1..7c2b901b3631050f101235397ac2929bec5b74a7 100644 (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) {