1
0
mirror of https://passt.top/passt synced 2024-12-22 13:45:32 +00:00

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 <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Stefano Brivio 2024-07-24 14:33:01 +02:00
parent a09aeb4bd6
commit d19b396f11

1
tap.c
View File

@ -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");