Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTP server doesn't properly handle IPv6 interface being disabled #2378

Closed
coder0107git opened this issue Mar 18, 2025 · 5 comments
Closed

NTP server doesn't properly handle IPv6 interface being disabled #2378

coder0107git opened this issue Mar 18, 2025 · 5 comments

Comments

@coder0107git
Copy link

Versions

  • Pi-hole: v6.0.5
  • AdminLTE: v6.0.2
  • FTL: v6.0.4

Platform

  • OS and version: Raspbian 11 (bullseye)
  • Platform: Raspberry Pi 3b+

Expected behavior

The NTP server to not attempt to access an IPv6 time server when IPv6 has been disabled.

Actual behavior / bug

My Pi has IPv6 disabled. Since I've updated to PiHole v6 with it's new integrated NTP client, I've started getting the following error.

Error in NTP server: Cannot create NTP socket (Address family not supported by protocol), IPv6 NTP server not available

Steps to reproduce

Steps to reproduce the behavior:

  1. Disable IPv6 (I appended ipv6.disable=1 to the only line in the /boot/cmdline.txt file).
  2. Reboot to apply.
  3. Wait for it to attempt to synchronize the time.
  4. See error.

Debug Token

Screenshots

Error in NTP server: Cannot create NTP socket (Address family not supported by protocol), IPv6 NTP server not available

Additional context

None

@mwoolweaver
Copy link

go to https://pi.hole/admin/settings/all

and disable the NTP ipv6 option as seen in the screenshot below
Image

@DL6ER
Copy link
Member

DL6ER commented Mar 18, 2025

I agree that @mwoolweaver's suggestion is the right thing to do here. Pi-hole handles IPv6 being disabled gracefully in still working, just warning you that the (by default on) IPv6 component could not be started. The error will go away once you disable it. I do think this is how we should behave, otherwise, users may not get what they expect if there is no warning (could be that IPv6 is disabled on a particular machine and they are not aware of it). I will, hence, close this. Feel free to re-open in case you think this needs further discussion.

@DL6ER DL6ER closed this as completed Mar 18, 2025
@coder0107git
Copy link
Author

Thanks! I don't know how I missed that.

I think the current message is fine as is but it would be nicer if it failed early with something like "the IPv6 interface is unavailable". When it fails late like this, it feels like something unexpectedly broke instead of an expected/accounted-for failure that can easily be remedied.

@DL6ER
Copy link
Member

DL6ER commented Mar 18, 2025

We are not explicitly checking for IPv6 availability as this would be quite some work due to the various ways IPv6 can be disabled (during boot, during runtime, manually stripping all IPv6 addresses from all interfaces ...). Hence, we simply try to create the docket and the error message in the parenthesis is what the system tells us. This message has not been invented by us and cannot be changed (unless we add an extra case to exactly catch and replace this text - unfeasible as the error message may be in a different language if the system is).

@coder0107git
Copy link
Author

Hm, okay. That makes sense. At first I thought that it might be possible to match on errno, but then I couldn't tell if that's platform specific.

FTL/src/ntp/server.c

Lines 295 to 297 in b7eb53b

snprintf(errbuf, sizeof(errbuf),
"Cannot create NTP socket (%s), IPv%i NTP server not available",
strerror(errno), protocol == AF_INET ? 4 : 6);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants