From d19b396f114ddca2481683a88c3a72f36a465b8a Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 24 Jul 2024 14:33:01 +0200 Subject: tap: Don't quit if pasta gets EIO on writev() to tap, interface might be down If we start pasta with some ports forwarded, but no --config-net, say: $ ./pasta -u 10001 and then use a local, non-loopback address to send traffic to that port, say: $ socat -u FILE:test UDP4:192.0.2.1:10001 pasta writes to the tap file descriptor, but if the interface is down, we get EIO and terminate. By itself, what I'm doing in this case is not very useful (I simply forgot to pass --config-net), but if we happen to have a DHCP client in the network namespace, the interface might still be down while somebody tries to send traffic to it, and exiting in that case is not really helpful. Signed-off-by: Stefano Brivio Reviewed-by: David Gibson --- tap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tap.c b/tap.c index 32a7b09..6930ad8 100644 --- a/tap.c +++ b/tap.c @@ -324,6 +324,7 @@ static size_t tap_send_frames_pasta(const struct ctx *c, case EINTR: case ENOBUFS: case ENOSPC: + case EIO: /* interface down? */ break; default: die("Write error on tap device, exiting"); -- cgit v1.2.3