pi-hole / FTL

The Pi-hole FTL engine
https://pi-hole.net
Other
1.34k stars 187 forks source link

Add extra logging around network issues (EDE: network error) #1930

Closed DL6ER closed 2 months ago

DL6ER commented 3 months ago

What does this implement/fix?

This PR adds further error logging concerning (intermittent) network issues. Currently, dnsmasq doesn't provide any further details, making debugging quite hard. This PR was triggered by https://github.com/pi-hole/pi-hole/issues/5608 which, eventually, turned out to be an external issue with other services on the same machine.

Example: Simulating network outage by unplugging the Ethernet cable

UDP

dig google.com

Before:

Apr  2 12:14:43 dnsmasq[3791404]: query[A] 154.google.com from 127.0.0.1
Apr  2 12:14:43 dnsmasq[3791404]: config error is REFUSED (EDE: network error)

Now:

Apr  2 12:14:43 dnsmasq[3791404]: query[A] 154.google.com from 127.0.0.1
Apr  2 12:14:43 dnsmasq[3791404]: failed to send UDP request: Network is unreachable
Apr  2 12:14:43 dnsmasq[3791404]: config error is REFUSED (EDE: network error)

TCP

dig google.com +tcp

Before:

Apr  2 11:53:02 dnsmasq[3801913]: query[A] google.com from 127.0.0.1
(editor's note: nothing else gets printed, the TCP connection silently dies)

Now:

Apr  2 11:53:02 dnsmasq[3801913]: query[A] google.com from 127.0.0.1
Apr  2 11:53:02 dnsmasq[3801913]: failed to send TCP(fast-open) packet: Network is unreachable
Apr  2 11:53:02 dnsmasq[3801913]: failed to send TCP(connect) packet: Network is unreachable

Other possible errors could be Connection reset by peer or No memory available.

These errors are also logged to the diagnosis system (rate-limited to not hammer the database):

grafik

These messages are de-duplicated based on the peer address (192.168.2.1#53 in the screenshot).


Related issue or feature (if applicable): N/A

Pull request in docs with documentation (if applicable): N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

Checklist: