Bug 279413 - NTPD: Leap-Seconds.list IPv6 alone cannot be obtained and error occurs.
Summary: NTPD: Leap-Seconds.list IPv6 alone cannot be obtained and error occurs.
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Only Me
Assignee: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-30 21:48 UTC by takefu
Modified: 2024-07-22 02:38 UTC (History)
3 users (show)

See Also:


Attachments
a Part of /etc/rc.conf.local (7.29 KB, application/x-shellscript)
2024-06-21 18:06 UTC, CrazyMihey
no flags Details
Add IANA back. (714 bytes, patch)
2024-07-19 18:03 UTC, Cy Schubert
no flags Details | Diff
Proposed commit. (1.28 KB, patch)
2024-07-19 18:09 UTC, Cy Schubert
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description takefu 2024-05-30 21:48:24 UTC
bug #275419 Errors occur only in IPv6 after updating.

"HPiers.obspm.fr" Error that occurs because this host does not communicate with IPv6.
No errors occur under dual stack with IPv4.

adhoc
# sysrc ntp_leapfile_sources=https://data.iana.org/time-zones/tzdb/leap-seconds.list
Comment 1 CrazyMihey 2024-06-21 18:06:56 UTC
Created attachment 251607 [details]
a Part of /etc/rc.conf.local
Comment 2 CrazyMihey 2024-06-21 18:08:03 UTC
Thats Right, «HTTPS://HPIERS.OBSPM.Fr», suggested in «/etc/defaults/rc.conf» of FreeBSD 14.0 #7 does not SupPort IPv6.
I publish My Decision, made in January and [not Hardly Tested] on IPv6-Only Servers.
This is a Fragment of My «/etc/rc.conf.local», Comments and Suggestions are WellCome:

#!/bin/sh
# Здесь ШеБанг ИсПользуетСя ИсКлючитЕльНо для КорРектнОго ЦветоВыДеления Синтаксиса в Текстовых РедакТорАх, вроде «mcedit» (GNU MidNight Commander), «FarColorer» (Far Manager), и, возможно, Других… Сурсящая ПодПроГрамма «source_rc_confs» из «/etc/defaults/rc.conf» ПроИгнорирует SheBang, Справедливо СоЧтя Его за НеУдачный Комментарий.
…
#──────────────────────────────────────────────────────────────────────────────────────────────────#
# Creates a Simple Match-Pattern (Mask) from a given String.
# This Patterns can be used for Parameter Expansions (#/##/%/%%) and Case/esaC Command in SH Scripts.
# UsAge:
# AnyCasePattern <InirialString>
# For Example, «AnyCasePattern "Some <Used> Parameter."»
# Will ReTurn String: «[Ss][Oo][Mm][Ee][[:space:]][<][Uu][Ss][Ee][Dd][>][[:space:]][Pp][Aa][Rr][Aa][Mm][Ee][Tt][Ee][Rr][.]», which can be Applied in Case/#/% Constructions of SH.
# AnyCasePattern Works on Pure SH: avoids using External Utilities such as IConv, TR and SEd.
# AnyCasePattern Can Be easily Expanded for any National Symbols Support.
AnyCasePattern()
 {
  local H T="${*}" R=""	# Header, Tail, Result.
  if [ -n "${T}" ]
   then
    while [ -n "${T}" ]
     do
      H="${T%"${T#?}"}"
      T="${T#?}"	# Using Third VariAble (Accumulator A="${T#?}"; H="${T%"${A}"}"; T="${A}") does not Increase Performance, while Avoiding Double "${T#?}" — Operation…
      case "${H}" in	# Static Case Operator Operates about 4–6 Times Faster, than For-Loop; ≈2–3 Times Faster, than For+Case (For This Particular Case). Tested on Intel® Atom™/Xeon® i386/AMD64.
       [Aa]) H="Aa";;
       [Bb]) H="Bb";;
       [Cc]) H="Cc";;
       [Dd]) H="Dd";;
       [Ee]) H="Ee";;
       [Ff]) H="Ff";;
       [Gg]) H="Gg";;
       [Hh]) H="Hh";;
       [Ii]) H="Ii";;
       [Jj]) H="Jj";;
       [Kk]) H="Kk";;
       [Ll]) H="Ll";;
       [Mm]) H="Mm";;
       [Nn]) H="Nn";;
       [Oo]) H="Oo";;
       [Pp]) H="Pp";;
       [Qq]) H="Qq";;
       [Rr]) H="Rr";;
       [Ss]) H="Ss";;
       [Tt]) H="Tt";;
       [Uu]) H="Uu";;
       [Vv]) H="Vv";;
       [Ww]) H="Ww";;
       [Xx]) H="Xx";;
       [Yy]) H="Yy";;
       [Zz]) H="Zz";;
       [[:space:]]) H="[:space:]";;
      esac
      R="${R}[${H}]"
     done
    printf "%s" "${R}"
    return "0"
   else
    return "1"
  fi
 }
#══════════════════════════════════════════════════════════════════════════════════════════════════#

# URLHost ExtrActs Full HostName form the URL.
# UsAge:
# URLHost "<Long URL>"
# For Example, «URLHost "HTTP://StupidUser:Remember@Data.IANA.Org/time-zones/data/leap-seconds.list?Date=ToDay#3692217600"»
# Will ReTurn String: «Data.IANA.Org»
# Multiple URLs will be SingleSpace-Separated. No External Utilities (in ${PATH}) Required.
URLHost()
 {
  local H R
  for H in "${@}"
   {
    H="${H#*"//"}"	# ReMove Scheme/Protocol Part;
    H="${H%%"/"*}"	# ReMove Host Path and Parameters;
    R="${R}${R:+" "}${H#*"@"}"	# ReMove LogIn:PassWord Part.
   }
  printf "%s" "${R}"
 }
#══════════════════════════════════════════════════════════════════════════════════════════════════#

…
  # Файл, СоДержащий Текущий Сдвиг Времени — ДоПолни́тельную (ВисоКо́сную, Ска́чущую) Секу́нду, Перемещён с «IETF.Org» на «HTTPS://Data.IANA.Org/time-zones/data/leap-seconds.list».	# HTTPS://Ru.WikiPedia.Org/wiki/Дополнительная_секунда
  if [ -n "${name}" -a "${name%[Nn][Tt][Pp][Dd]*}" != "${name}" ]	# Execute Next ↓ «HardWork» on NTPD or NTPDate Start/Stop Only. 
   then	# Configuration Files «/etc/rc.conf» and «/etc/rc.conf.local» are Included by Every Deamon Script on Start/Stop/ReStart/ReLoad/… These Actions ↓ may take Some Time During Boot Process, so They should be performed only when running Time Daemons.
    Alt_NTP_LeapFile_Sources="${Alt_NTP_LeapFile_Sources}${Alt_NTP_LeapFile_Sources:+" "}HTTPS://HPIERS.OBSPM.Fr/iers/bul/bulc/ntp/leap-seconds.list"	# Paris Observatory IERS Centers …from Quasars to our changing Earth. Works Faster in Most Cases (Moscow, Amsterdam, …), SupPorts IPv4 Only (Not AvailAble on IPv6-Only Hosts).
    Alt_NTP_LeapFile_Sources="${Alt_NTP_LeapFile_Sources}${Alt_NTP_LeapFile_Sources:+" "}HTTPS://Data.IANA.Org/time-zones/data/leap-seconds.list"	# The Global Coordination of the DNS Root, IP Addressing, and Other InterNet Protocol Resources is Performed as the InterNet Assigned Numbers Authority (IANA) Functions. SupPorts IPv4 and IPv6.
    for Alt_NTP_LeapFile_Source in ${Alt_NTP_LeapFile_Sources}
     {
      Alt_NTP_LeapFile_Source_Pattern="$(AnyCasePattern "$(URLHost "${Alt_NTP_LeapFile_Source}")")"
      [ "${ntp_leapfile_sources%${Alt_NTP_LeapFile_Source_Pattern}*}" == "${ntp_leapfile_sources}" ] && ntp_leapfile_sources="${ntp_leapfile_sources}${ntp_leapfile_sources:+" "}${Alt_NTP_LeapFile_Source}"
     }
    unset Alt_NTP_LeapFile_Source Alt_NTP_LeapFile_Sources Alt_NTP_LeapFile_Source_Pattern
  fi
…
  ntpd_enable="Yes"	# Дэмон СинХронизации СисТемнОго Времени.
…
	# Такой «Фортэль» Работает на FreeBSD: ПодПрограмма «run_rc_command» из Скрипта «/etc/rc.subr» Формирует Строку ЗаПуска Дэмона в своей Переменной «${_doit}», добавляя Туда Параметры, в том числе «${${name}_nice}», без ДоПолнительной ПроВерки на «Целое Число −20…20», так что можно «Вставить в Цепочку ЗаПуска» ещё и Утилиту idprio/rtprio…
  ntpd_nice="-20 rtprio 0"	# ЗаПуск NTPD с Максимальным «Приоритетом Реального Времени» и Минимальной «Вежливостью» («Уступчивостью», «Nice») к Другим Процессам в Системе. Ибо Время — это Самый Ценный и НеВосПолнимый Ресурс, а Учитывать Его следует особенно Тщательно.	# Running NTPD with Maximum «Real-Time Priority» and Minimum «Politeness» («Compliance», «Nice») to Other Processes in the System. Because Time is the Most ValuAble and IrRePlaceAble Resource, and It should be taken into Account especially Carefully.
  ntpd_flags="--authreq --bcastsync"
  ntpd_sync_on_start="Yes"		# ПриХодитСя ИсПользовать Сей ПараМетр, ВзаМесто «--panicgate» по Причине Кривости ОбРаБотки ПараМетров СкрипТом ЗаПуска «/etc/rc.d/ntpd».
…
Comment 3 Warner Losh freebsd_committer freebsd_triage 2024-07-19 17:34:12 UTC
I think that this stems entirely from my shifting to iers source for this file. It has no ipv6 address. We should likely fall back to the iana's copy if the IERS hosts are unreachable. The IERS copy is more quickly updated, but the iana's copy is more available. Most likely, the best solution is to just have a list that we cycle through rather than the one unique host.
Comment 4 Cy Schubert freebsd_committer freebsd_triage 2024-07-19 18:03:20 UTC
Created attachment 252175 [details]
Add IANA back.

(In reply to Warner Losh from comment #3)
Probably.

How does this look.
Comment 5 Cy Schubert freebsd_committer freebsd_triage 2024-07-19 18:09:40 UTC
Created attachment 252176 [details]
Proposed commit.

And the proposed commit.
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-07-19 18:25:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=66f360515d2829d261c0ad7bd516e9dd18c2dd83

commit 66f360515d2829d261c0ad7bd516e9dd18c2dd83
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-07-19 18:04:43 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-07-19 18:24:31 +0000

    rc.conf: Leap-seconds sources: Add IANA back

    11da791920ba switched Leap-seconds source from IANA to IERS, as IERS
    is the canonoical source. The problem ist that IERS is not accessible
    from IPv6 only networks. To work around this we must add IANA back in
    order to provide IPv6-only users a source for leap-seconds fetch.

    PR:             279413
    Fixes:          11da791920ba
    MFC after:      3 days

 libexec/rc/rc.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 7 Warner Losh freebsd_committer freebsd_triage 2024-07-19 18:52:41 UTC
I think you should have waited for comment... Was that an accidental push?

The iana one has been expired for the last 6 weeks. Did they finally update? My laptop has been whining about it. that's why we switch from the first place... And that's why I didn't just make the change, but posted here in the bug.

As much as I was resistant to mirroring this, maybe we need to mirror it to get ipv6 connectivity.
Comment 8 Warner Losh freebsd_committer freebsd_triage 2024-07-19 18:58:30 UTC
IANA is barely updated. It's still the old file that expires this year (we know there's no leap second Dec 31, so having this expire Dec 29th is bad). It took them 6 weeks to get this updated to the OLD version.
IERS already has the updated to expire in June 2025 one live.

So don't MFC this. The IANA source is still hopelessly unreliable.
Comment 9 Cy Schubert freebsd_committer freebsd_triage 2024-07-19 19:02:58 UTC
(In reply to Warner Losh from comment #7)

IANA has updated their copy.

Output from, diff leap-seconds.iers leap-seconds.iana

1,2c1,2
[... comments removed ...]
63c63
< #$    3929093563
---
> #$    3913697179
67c67
< #     File expires on 28 June 2025
---
> #     File expires on 28 December 2024
71c71
< #@    3960057600
---
> #@    3944332800
120c120
< #h    be738595 57b0cf1b b0218343 fb77062f 5a775e7
---
> #h    9dac5845 8acd32c0 2947d462 daf4a943 f58d9391

Mirroring the file would be fine or maybe a vendor branch? Though a vendor branch would be overkill. Probably mirroring it somewhere.
Comment 10 Cy Schubert freebsd_committer freebsd_triage 2024-07-19 19:12:27 UTC
(In reply to Warner Losh from comment #8)

Let's mirror it then.

Someone, dephij, philip, or des, have been updating src quite regularly. The last time it was updated was,

commit 8a607939decc9eddf31420a169d7a7ffe22295bf
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: Tue Jun 18 19:10:33 2024 -0700
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: Tue Jun 18 19:10:33 2024 -0700

    Update leap-seconds to leap-seconds.3676924800
    
    Obtained from:  ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.3676924800
    MFC after:      3 days

M       usr.sbin/ntp/ntpd/leap-seconds

We should probably continue to do this and push out the next time a SA or EN is published. By rights this should itself be an EN.
Comment 11 CrazyMihey 2024-07-20 10:57:10 UTC
I suggested a Decision in «/etc/rc.conf» or «/etc/rc.conf.local», not Changing Distributed «/etc/defaults/rc.conf». «/etc/defaults/rc.conf» Will be OverWritten on Next Run «mergemaster», so it is better not to Change.
IPv6-Only Hosts with Default Settings still can not Get this File (FreeBSD 14.1-RELEASE-p2).
The Simpliefed One-Line Version of the Fix:

[ "${ntp_leapfile_sources%[Ii][Aa][Nn][Aa]*}" == "${ntp_leapfile_sources}" ] && ntp_leapfile_sources="${ntp_leapfile_sources}${ntp_leapfile_sources:+" "}HTTPS://Data.IANA.Org/time-zones/tzdb/leap-seconds.list"

Sorry for My Previous Post, the Code was too Long for Universality…
Comment 12 Cy Schubert freebsd_committer freebsd_triage 2024-07-20 12:32:32 UTC
(In reply to CrazyMihey from comment #11)

There is no decision made in /etc/rc and /etc/rc.d/ntpd simply has a loop where it stops at the last entry that fetched successfully. The suggestion overly complicates a simple problem.
Comment 13 Cy Schubert freebsd_committer freebsd_triage 2024-07-20 13:04:12 UTC
I will commit the IERS copy of leap-seconds on Monday and MFC it three days later. We should consider MFS to releng/.
Comment 14 CrazyMihey 2024-07-20 15:53:11 UTC
(In reply to Cy Schubert from comment #12)
I understand This. But Problems with «leap-seconds.list» have existed since I have been using FreeBSD, and This Problem is still not Solved in the Supplied System at the Moment. ThereFore, We have to use Crutches in «/etc/rc.conf.local»…
The Loop in «/etc/rc.d/ntpd» Works Correctly (Slower, of course) with Space-Separated List of URIs, so Who Wants to Work, Can Fix His «/etc/rc.conf», Others Will Wait until «/etc/defaults/rc.conf» Will Be Fixed.
Comment 15 Cy Schubert freebsd_committer freebsd_triage 2024-07-20 15:57:13 UTC
(In reply to CrazyMihey from comment #14)

Simply add ntp_leapfile_sources= to your rc.conf, i.e.,

ntp_leapfile_sources="https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list https://data.iana.org/time-zones/tzdb/leap-seconds.list"
Comment 16 CrazyMihey 2024-07-20 16:44:30 UTC
(In reply to Cy Schubert from comment #15)
That is Done in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279413#c11 :)
Comment 17 Cy Schubert freebsd_committer freebsd_triage 2024-07-20 16:51:10 UTC
(In reply to CrazyMihey from comment #16)

You did the correct thing.
Comment 18 Warner Losh freebsd_committer freebsd_triage 2024-07-20 16:52:53 UTC
(In reply to Cy Schubert from comment #13)
I concur with your plan.
We should update it and MFC it agressively, then merge the MFC to supported release branches the next round of EN/SA that go out and just do this every N months.

Bonus points if we can somehow snag it from a git mirror, then we can add that to the list as fallback options :)
Comment 19 Cy Schubert freebsd_committer freebsd_triage 2024-07-20 16:57:04 UTC
(In reply to CrazyMihey from comment #16)

Sorry, let me answer this correctly.

The correct solution is to add ntp_leapfile_sources as specified to your rc.conf.
Comment 20 Cy Schubert freebsd_committer freebsd_triage 2024-07-20 16:59:31 UTC
(In reply to Warner Losh from comment #18)

I'll do this tonight after I get back home.
Comment 21 commit-hook freebsd_committer freebsd_triage 2024-07-21 01:57:15 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=04b4dcf04fc345b29b78e5061768091648b8ee2a

commit 04b4dcf04fc345b29b78e5061768091648b8ee2a
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-07-21 01:41:09 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-07-21 01:55:41 +0000

    leap-seconds: Update to leap-seconds 3960057600 obtained from IERS

    IERS is the canonical source of leap-seconds. IANA, NIST and USNO obtain
    their leap-second updates from IERS.

    This resolves an issue for IPv6-only hosts as IERS is not accessible
    via IPv6, requiring IPv6-only host to rely on some other source,
    above.

    From this point forward we should fetch the file from IERS, the
    organization responsible for deciding when to insert leap-seconds.

    PR:             279413
    Obtained from:  https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
    Discussed with: imp
    MFC after:      1 day

 usr.sbin/ntp/ntpd/leap-seconds | 373 +++++++++++++----------------------------
 1 file changed, 119 insertions(+), 254 deletions(-)
Comment 22 commit-hook freebsd_committer freebsd_triage 2024-07-22 02:37:11 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=13f9c4addb6ed36221d89e61194ea9fe5f8f3aaf

commit 13f9c4addb6ed36221d89e61194ea9fe5f8f3aaf
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-07-19 18:04:43 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-07-22 02:36:30 +0000

    rc.conf: Leap-seconds sources: Add IANA back

    11da791920ba switched Leap-seconds source from IANA to IERS, as IERS
    is the canonoical source. The problem ist that IERS is not accessible
    from IPv6 only networks. To work around this we must add IANA back in
    order to provide IPv6-only users a source for leap-seconds fetch.

    PR:             279413
    Fixes:          11da791920ba

    (cherry picked from commit 66f360515d2829d261c0ad7bd516e9dd18c2dd83)

 libexec/rc/rc.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 23 commit-hook freebsd_committer freebsd_triage 2024-07-22 02:37:12 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=12f2e9525bd8be328febbc5839f763e4a271c05d

commit 12f2e9525bd8be328febbc5839f763e4a271c05d
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-07-21 01:41:09 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-07-22 02:36:30 +0000

    leap-seconds: Update to leap-seconds 3960057600 obtained from IERS

    IERS is the canonical source of leap-seconds. IANA, NIST and USNO obtain
    their leap-second updates from IERS.

    This resolves an issue for IPv6-only hosts as IERS is not accessible
    via IPv6, requiring IPv6-only host to rely on some other source,
    above.

    From this point forward we should fetch the file from IERS, the
    organization responsible for deciding when to insert leap-seconds.

    PR:             279413
    Obtained from:  https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
    Discussed with: imp

    (cherry picked from commit 04b4dcf04fc345b29b78e5061768091648b8ee2a)

 usr.sbin/ntp/ntpd/leap-seconds | 373 +++++++++++++----------------------------
 1 file changed, 119 insertions(+), 254 deletions(-)
Comment 24 commit-hook freebsd_committer freebsd_triage 2024-07-22 02:38:14 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=fad8955b97cc2d29c2d66b63c4346611715eff6e

commit fad8955b97cc2d29c2d66b63c4346611715eff6e
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-07-21 01:41:09 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-07-22 02:37:03 +0000

    leap-seconds: Update to leap-seconds 3960057600 obtained from IERS

    IERS is the canonical source of leap-seconds. IANA, NIST and USNO obtain
    their leap-second updates from IERS.

    This resolves an issue for IPv6-only hosts as IERS is not accessible
    via IPv6, requiring IPv6-only host to rely on some other source,
    above.

    From this point forward we should fetch the file from IERS, the
    organization responsible for deciding when to insert leap-seconds.

    PR:             279413
    Obtained from:  https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
    Discussed with: imp

    (cherry picked from commit 04b4dcf04fc345b29b78e5061768091648b8ee2a)

 usr.sbin/ntp/ntpd/leap-seconds | 373 +++++++++++++----------------------------
 1 file changed, 119 insertions(+), 254 deletions(-)
Comment 25 commit-hook freebsd_committer freebsd_triage 2024-07-22 02:38:15 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=176f8488e167ec3943108965c7c0e3e98fe167da

commit 176f8488e167ec3943108965c7c0e3e98fe167da
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-07-19 18:04:43 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-07-22 02:37:03 +0000

    rc.conf: Leap-seconds sources: Add IANA back

    11da791920ba switched Leap-seconds source from IANA to IERS, as IERS
    is the canonoical source. The problem ist that IERS is not accessible
    from IPv6 only networks. To work around this we must add IANA back in
    order to provide IPv6-only users a source for leap-seconds fetch.

    PR:             279413
    Fixes:          11da791920ba

    (cherry picked from commit 66f360515d2829d261c0ad7bd516e9dd18c2dd83)

 libexec/rc/rc.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)