aboutgitcodebugslistschat
path: root/tap.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-07-24 14:33:01 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-07-25 12:25:05 +0200
commitd19b396f114ddca2481683a88c3a72f36a465b8a (patch)
tree677c00da3d37b8e7ec5ca5b4c2b8d20d9201babd /tap.c
parenta09aeb4bd600fcb92d0341fd51858e6cee0bbea4 (diff)
downloadpasst-d19b396f114ddca2481683a88c3a72f36a465b8a.tar
passt-d19b396f114ddca2481683a88c3a72f36a465b8a.tar.gz
passt-d19b396f114ddca2481683a88c3a72f36a465b8a.tar.bz2
passt-d19b396f114ddca2481683a88c3a72f36a465b8a.tar.lz
passt-d19b396f114ddca2481683a88c3a72f36a465b8a.tar.xz
passt-d19b396f114ddca2481683a88c3a72f36a465b8a.tar.zst
passt-d19b396f114ddca2481683a88c3a72f36a465b8a.zip
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>
Diffstat (limited to 'tap.c')
-rw-r--r--tap.c1
1 files changed, 1 insertions, 0 deletions
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");