1 From 5782649ad95382dd558df97b33b64e854d8789fb Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Thu, 18 Sep 2014 22:08:58 +0100
4 Subject: [PATCH] Fix bug which caused dnsmasq to become unresponsive when an
9 diff --git a/src/util.c b/src/util.c
10 index df751c7..a729f33 100644
13 @@ -570,18 +570,28 @@ void bump_maxfd(int fd, int *max)
17 - struct timespec waiter;
18 + /* Linux kernels can return EAGAIN in perpetuity when calling
19 + sendmsg() and the relevant interface has gone. Here we loop
20 + retrying in EAGAIN for 1 second max, to avoid this hanging
23 + static int retries = 0;
24 + struct timespec waiter;
26 if (errno == EAGAIN || errno == EWOULDBLOCK)
29 waiter.tv_nsec = 10000;
30 nanosleep(&waiter, NULL);
32 + if (retries++ < 1000)