Subject: [Ntp] New NTP on old FreeBSD

From: John Ackermann N8UR <[email-masked]>
Date: Mon, 22 Nov 2021 10:44:03 -0500

Hi -- I suspect I know a number of the folks here from other mailing 
lists.  I was on the old ntp:questions list but I seem to have dropped 
off it at some point, or based on some googling, maybe it's gone inactive.

I am dusting off my stack of four modified Soekris Net4501 servers after 
about five years shut down (when we moved from Atlanta back to Dayton). 
They are currently running FreeBSD 9.0 and ntp version 4.2.6p5 --quite 
ancient.

I've emailed with Poul-Henning and he suggests that the newer releases 
of FreeBSD may not support the kernel hooks that are needed to get the 
sub-microsecond timing the Net4501 is capable of.  So, I'm planning to 
stay on FreeBSD 9.0.

The ntp version is of course very ancient and for security reasons if 
nothing else I should upgrade it.  As I don't ordinarily run FreeBSD, I 
set up a VM with 9.3, downloaded the ntp 4.2.8p15 tarball, did a 
configure with all clocks enabled and started compiling.

I got an error in timexsup.c:
/usr/include/sys/timex.h:180: error: field 'time' has incomplete type

The OS in the VM is factory-new, with just the default FreeBSD tools 
installed; there've been no optional programs added.

I don't know whether this error is due to something on the OS side that 
I need to install, or a change to ntp that relies on a newer version of 
FreeBSD than mine.

Does anyone have any thoughts on how to cure this?  Or is there a better 
way to get updated binaries onto the Soekris boxes?

Thanks!
John

---

From: "Gary E. Miller" <[email-masked]>
Date: Mon, 22 Nov 2021 11:06:33 -0800

Yo John!

On Mon, 22 Nov 2021 10:44:03 -0500
John Ackermann N8UR <[email-masked]> wrote:

> I've emailed with Poul-Henning and he suggests that the newer
> releases of FreeBSD may not support the kernel hooks that are needed
> to get the sub-microsecond timing the Net4501 is capable of.  So, I'm
> planning to stay on FreeBSD 9.0.

We have many people here that run *BSD.  I'm not one of them.

> /usr/include/sys/timex.h:180: error: field 'time' has incomplete type

Can you send us that line, and the surrounding 3 lines?  Probably 
just an include order problem.  *BSD is prone to those.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	[email-masked]  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

---

From: Martin Burnicki <[email-masked]>
Date: Mon, 22 Nov 2021 23:19:42 +0100

>> /usr/include/sys/timex.h:180: error: field 'time' has incomplete type

Hm, a quick try I made on FreeBSD 9 shows that the line that causes the 
error uses struct timespec. So sys/timespec.h needs to be included 
included before sys/timex.h.

This can be solved at the top of libntp/timexsup.c:

#ifdef HAVE_SYS_TIMEX_H
# include <sys/timespec.h>  // this line added
# include <sys/timex.h>
#endif

However, once this has been fixed, another error occurs later:

ntpd.c:149:47: error: sys/procctl.h: No such file or directory

This is the relevant section of ntpd/ntpd.c:

#ifdef __FreeBSD__
#include <sys/procctl.h>  // this line causes the error
#ifndef PROC_STACKGAP_CTL
...

There is no file procctl.h below /usr/include on my FreeBSD 9 system.

If you simply comment the #include out, the next error is

ntpd.c:450: warning: implicit declaration of function 'procctl'

I'm not very familiar with FreeBSD, but I'm assuming procctl is a 
feature that has been introduced after FreeBSD 9.

Anyway, if you also comment out the call to procctl() in line 450 of 
ntpd/ntpd, compilation at least finishes successfully, and ntpd can be 
started.

Don't know whether it works with the specific features of the Soekris 
board, though.

I'm going to send a patch to John.

Regards,

Martin

---

From: John Ackermann N8UR <[email-masked]>
Date: Mon, 22 Nov 2021 17:26:49 -0500

Thanks, Martin!

---

From: "Gary E. Miller" <[email-masked]>
Date: Mon, 22 Nov 2021 14:32:41 -0800

Yo Martin!

On Mon, 22 Nov 2021 23:19:42 +0100

> I'm going to send a patch to John.

Send it here as well.  I'll apply it.

BTW, is this for NTP Classic or NTPsec?

RGDS
GARY

---

From: Martin Burnicki <[email-masked]>
Date: Mon, 22 Nov 2021 23:37:42 +0100

Hi Gary,

> BTW, is this for NTP Classic or NTPsec?

Since John mentioned ntp-4.2.8p15, I made the patch for the original 
ntpd. You've received a copy of my email to John.

Regards,

Martin

---

From: "Gary E. Miller" <[email-masked]>
Date: Mon, 22 Nov 2021 14:57:40 -0800

Yo Martin!

On Mon, 22 Nov 2021 23:37:42 +0100
Martin Burnicki <[email-masked]> wrote:

> Since John mentioned ntp-4.2.8p15,

Sorry, I missed that.

> I made the patch for the original 

Hmm, looks like 3 complete files, not a patch?

Thanks.  A brief look and I don't see anything in NTPsec that fixes.

Hal Murray keeps NTPsec honest with *BSD.

RGDS
GARY

---

From: Martin Burnicki <[email-masked]>
Date: Tue, 23 Nov 2021 00:02:15 +0100

Hi Gary,

> Hmm, looks like 3 complete files, not a patch?

Yes, indeed. I thought it might be easier for John to simply copy the 
old files over the new ones.

Regards,

Martin

---

From: John Ackermann N8UR <[email-masked]>
Date: Mon, 22 Nov 2021 18:26:59 -0500

Gary, for now I'm using NTP classic.  I'd be interested in trying NTPsec 
but for now I'm trying to bite off one thing at a time -- these boxes 
were all tuned and running with the various refclocks under classic, and 
I'm hoping just to update the files and let them run as they did before 
at least to set a baseline.

John
----

On 11/22/21 5:32 PM, Gary E. Miller wrote:
> _______________________________________________
> ntp mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/ntp
>

---

From: Hal Murray <[email-masked]>
Date: Tue, 23 Nov 2021 02:30:52 -0800

[email-masked] said:
> I've emailed with Poul-Henning and he suggests that the newer releases  of
> FreeBSD may not support the kernel hooks that are needed to get the
> sub-microsecond timing the Net4501 is capable of.  So, I'm planning to  stay
> on FreeBSD 9.0. 

If that means what I think it does, you can get the kernel hooks if you are 
willing to build your own kernel.  This is the CONFIG file I use:
        # PPS-GENERIC -- FreeBSD Kernel configuration file 
        # Add PPS to GENERIC config
        #
        include GENERIC
        ident PPS-GENERIC
        options PPS_SYNC
(I can say more if you haven't built kernels.)

The package collection for FreeBSD has both ntpsec and chrony.  Both support 
NTS.
ntpsec-1.2.0_2                 Network Time Protocol suite, refactored
chrony-4.1                     System clock synchronization client and server
chrony-lite-4.1                System clock synchronization client and server 
(lite)

-- 
These are my opinions.  I hate spam.