On Fri, Dec 01, 2023 at 09:18:32PM +0000, guilherme.janc...@yandex.com wrote:
> >Synopsis: Repeated NTP peers in OpenNTPD > >Category: user > >Environment: > System : OpenBSD 7.4 > Details : OpenBSD 7.4 (GENERIC.MP) #0: Sun Oct 22 12:13:42 MDT 2023 > > r...@syspatch-74-amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP > > Architecture: OpenBSD.amd64 > Machine : amd64 > >Description: > If the same address/domain is specified multiple times in > OpenNTPD's configuration file, or if multiple domains resolve > to the same IP address, OpenNTPD will treat the same IP address > as if it was multiple peers. > >How-To-Repeat: > This can be tested by appending `server 127.0.0.1` multiple > times to the configuration file. > > Alternatively, assuming a default OpenNTPD configuration file > from OpenBSD 7.4, the following entries can be added to > /etc/hosts: > 127.0.0.1 time.cloudflare.com > 127.0.0.1 pool.ntp.org > > I noticed this bug using the default 7.4 configuration file. It > can happen because time.cloudflare.com is part of pool.ntp.org: > https://www.ntppool.org/scores/162.159.200.1 > https://www.ntppool.org/scores/162.159.200.123 > >Fix: > Removing the `server time.cloudflare.com` line from the > configuration file is a simple fix the user can make, but > OpenNTPD should check if an IP address it tries to add to the > list of peers is already a peer, and ignore it if so. If a > server is added with the `server` (not `servers`) keyword in the > configuration file, OpenNTPD should try the next IP the domain > resolves to if applicable. > Thanks for the report, I'll take a look. -Otto