X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev-tunnel.c;h=6bbf2cba8bd0c038beca8c56474fe915ec62cab0;hb=03e7973c8bac680c113cbdc64266e7b19b9cf464;hp=d9c54c3a71fe3970191d9682de6c8ccc33553164;hpb=e74d404a6c871118d37b5e5e4443d1365de520d2;p=sliver-openvswitch.git diff --git a/lib/netdev-tunnel.c b/lib/netdev-tunnel.c index d9c54c3a7..6bbf2cba8 100644 --- a/lib/netdev-tunnel.c +++ b/lib/netdev-tunnel.c @@ -299,7 +299,22 @@ netdev_tunnel_send_wait(struct netdev *netdev_) static int netdev_tunnel_drain(struct netdev *netdev_) { - struct netdev_tunnel *netdev = netdev_tunnel_cast(netdev_); + struct netdev_dev_tunnel *dev = + netdev_dev_tunnel_cast(netdev_get_dev(netdev_)); + char buffer[128]; + int error; + + if (!dev->connected) + return 0; + for (;;) { + error = recv(dev->sockfd, buffer, 128, MSG_TRUNC); + if (error) { + if (error == -EAGAIN) + break; + else if (error != -EMSGSIZE) + return error; + } + } return 0; }