]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Properly handle reconnection failure for backend UDP sockets
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 5 Apr 2023 20:17:23 +0000 (22:17 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 14 Aug 2023 14:35:43 +0000 (16:35 +0200)
commitc9b9647d874a8b63e5936a94c404d7d875760aa7
treecf80f230857dd2f4a351234c6666254241206240
parent24735efc3554ec5dd37b61afebff93fef2b3762b
dnsdist: Properly handle reconnection failure for backend UDP sockets

We try to reconnect our UDP sockets toward backends on some kind of
network errors that indicate a topology change, but we need to be
careful to handle the case where we actually fail to reconnect, as
we end up with no remaining sockets to use.
This commit properly deals with this case by pausing the thread handling
UDP responses from the backend, instead of having it enter a busy loop,
and by attempting to reconnect if we get a `bad file number` error when
trying to send a UDP datagram to the backend.

(cherry picked from commit 541b8df1fc0773549a76c8de13fb1123baba8bda)
pdns/dnsdist.cc
pdns/dnsdist.hh
pdns/dnsdistdist/dnsdist-backend.cc