From d73cdee5df3e6c7395270c69e944b3c853f013ae Mon Sep 17 00:00:00 2001 From: volth Date: Thu, 27 Jul 2017 06:32:28 +0000 Subject: [PATCH] Avoid infinite loop on EBADFD On Linux network restart, Tinc can get into a loop writing millions of error messages "Error while reading from Linux tun/tap device (tun mode) /dev/net/tun: File descriptor in bad state" to the log. https://github.com/NixOS/nixpkgs/pull/27675 It should be somehow aborted. Here is my quick hack. --- src/linux/device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/linux/device.c b/src/linux/device.c index a06e6daf..e273bfae 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -139,6 +139,9 @@ static bool read_packet(vpn_packet_t *packet) { if(inlen <= 0) { logger(DEBUG_ALWAYS, LOG_ERR, "Error while reading from %s %s: %s", device_info, device, strerror(errno)); + if (errno == EBADFD) { /* File descriptor in bad state */ + event_exit(); + } return false; } -- 2.20.1