On Thu, Mar 08, 2012 at 05:43:31PM +0100, [email protected] wrote:
> Attached potential fix for OVS userspace switch. Following error messages 
> were seen
> 
> Mar  7 16:36:17 rkerur-ThinkPad-T400 ovs-vswitchd:
> 00019|netdev_linux|WARN|error receiving Ethernet packet on Socket
> operation on non-socket: br0
> Mar  7 16:36:17 rkerur-ThinkPad-T400 ovs-vswitchd:
> 00020|dpif_netdev|ERR|error receiving data from br0: Socket operation
> on non-socket
> 
> Diffs take care of fixing the error message and userspace, however,
> it doesn't cover the case when retval > requested size. Let me know
> your inputs

Thank you!  I applied this variant on your fix.

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <[email protected]>
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=UTF-8
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 <[email protected]>
Reported-by: 胡靖飞 <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
---
 AUTHORS            |    2 ++
 lib/netdev-linux.c |    6 +++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index c6a865b..b980673 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -39,6 +39,7 @@ Neil McKee              [email protected]
 Paul Fazzone            [email protected]
 Philippe Jung           [email protected]
 Pravin B Shelar         [email protected]
+Ravi Kerur              [email protected]
 Reid Price              [email protected]
 Rob Hoes                [email protected]
 Romain Lenglet          [email protected]
@@ -140,6 +141,7 @@ Yongqiang Liu           [email protected]
 kk yap                  [email protected]
 likunyun                [email protected]
 冯全树(Crab)          [email protected]
+胡靖飞              [email protected]
 
 Thanks to all Open vSwitch contributors.  If you are not listed above
 but believe that you should be, please write to [email protected].
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 3c474e3..7c2b901 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) {
-- 
1.7.2.5

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to