Re: [ntp:questions] Reference 'sntp' utility: how do you set the destination port number

2019-07-22 Thread Marco Marongiu



On 22/07/2019 11:41, Miroslav Lichvar wrote:
> Those (and yours) didn't make it back to the newsgroup where the
> question was posted. The gateway seems to work only in the direction
> to the mailing list.

Man, that newsgroup is more harmful than hail! :-D

Thanks Miroslav. That also could explain why some people get their
messages moderated by mailman a gazillion times, and don't care
subscribing: they see their messages go through anyway and don't know it
may be a problem.

Ciao!
-- bronto
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] Reference 'sntp' utility: how do you set the destination port number

2019-07-22 Thread Miroslav Lichvar
On Mon, Jul 22, 2019 at 11:32:07AM +0200, Marco Marongiu wrote:
> On 21/07/2019 01:26, stua...@longlandclan.id.au wrote:
> > after no on-list replies
> 
> Just to say that I *do* see on-list replies from "A C" and Harlan Stenn
> himself, so not sure what you mean here...

Those (and yours) didn't make it back to the newsgroup where the
question was posted. The gateway seems to work only in the direction
to the mailing list.

-- 
Miroslav Lichvar
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] Reference 'sntp' utility: how do you set the destination port number

2019-07-22 Thread Marco Marongiu



On 21/07/2019 01:26, stua...@longlandclan.id.au wrote:
> after no on-list replies

Just to say that I *do* see on-list replies from "A C" and Harlan Stenn
himself, so not sure what you mean here...

-- M


___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] Reference 'sntp' utility: how do you set the destination port number

2019-07-22 Thread stuartl
On Sunday, 30 June 2019 12:09:53 UTC+10, stu...@longlandclan.id.au  wrote:
> Hi all,
> 
> This will seem like a silly request, but how do you set the sntp client 
> (distributed with the 'ntp' package in Debian) port number?

Okay, so after no on-list replies, but one off-list reply offering (likely for 
a significant fee) to provide a patched version that had the required feature.  
This implies that someone was naïve enough to assume the destination port 
number was never going to change.

So, a work-around which I'll post here for the next person who needs this.

There exists a very simple SNTP client at 
https://github.com/lettier/ntpclient/blob/master/source/python/ntpclient.py

It is crude, but my workplace actually uses the C version of this with good 
results on 6LoWPAN based networks.

The code in the Python version normally just returns the current time.  Add 
`import os` to the start of the file, then replace the final `print` line with 
the following:

```
# Set the time
os.system('date %s' % ts_val.strftime('%m%d%H%M%Y.%S'))
```

Now when called as `root` from a `cron` job, it will update the system time.  
There's a few additional tweaks needed to make it work on Python 3, but the 
gist is there.

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] Reference 'sntp' utility: how do you set the destination port number

2019-07-21 Thread David Woolley

On 21/07/2019 00:26, stua...@longlandclan.id.au wrote:

This implies that someone was naïve enough to assume the destination port 
number was never going to change.


The reference version is almost certainly just that, a reference 
version.  It is there to illustrate how the protocol works, and part of 
that is using the standard port number.  I suspect the maintainers of 
the source code would rather everyone used the full version.


However, although I haven't looked at the source code, I imagine the 
port number is easy to change without any really specific C language 
knowledge, provided you are prepared to recompile it.


___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] Reference 'sntp' utility: how do you set the destination port number

2019-07-02 Thread Harlan Stenn
A C writes:
> On 2019-06-29 19:09, stua...@longlandclan.id.au wrote:
> > Hi all,
> > 
> > This will seem like a silly request, but how do you set the sntp client (di
> stributed with the 'ntp' package in Debian) port number?
> > 
> > The reason I need this is that I need to synchronise time with clients whos
> e only link to the outside world is a 1200-baud AX.25 packet radio network.  
> Running TCP/IP over this is an impossibility at present.
> > 
> > The devices (partly due to an oversight on my part), do not have an RTC.  W
> hen first booted, they think the time is 2016.
> > 
> > The boards have been manufactured, it's too late to suggest that as the sol
> ution.  (The next revision *does* have a space for an RTC.)  The devices have
>  two serial ports, one connected to an RFID reader, the other to an AX.25 TNC
> .  There is no room for a GPS, and no time to order one.
> > 
> > Hindsight is 20/20, so I'm looking for a quick software solution.
> > 
> > I have therefore written a program that can bind to an arbitrary UDP port, 
> and can relay the NTP client requests and server responses over the AX.25 net
> work.  It is written in Python 3 and implements all of the AX.25 logic along 
> with the data collection function it is meant to perform.
> > 
> > Basically, UDP datagram (containing NTP payload) goes in, APRS-formatted AX
> .25 "un-numbered information frame" comes out.  APRS UI frame comes in, UDP d
> atagram gets sent back to the (S)NTP client.
> > 
> > I do not need, nor want, this script to run as 'root'.  So there goes bindi
> ng to port 123/udp.  I am instead using 3123/udp.  I'd like 'sntp' to talk to
>  that.
> > 
> > 'chrony' can talk on an alternate port, but it takes many measurements to s
> ynchronise the time, which is not ideal, it often takes many minutes to synch
> ronise.  I don't need millisecond precision, I just need stations to be withi
> n 60 seconds of each other ('ntp' can take over and fine tune it from there).
>   I don't care that the date suddenly jumps from 2016 to 2019 -- I care more 
> that the device "lives in 2016" for more than a few minutes.
> > 
> > I really just need a one-shot tool like 'ntpdate'.  I understand that 'sntp
> ' is that tool.  What is the command line option I use to make it talk to a N
> TP server that is on a different port to the standard?
>
> Clients don't bind to ports.  sntp will connect outbound on UDP 123 as a
> normal user just fine (I just tested it myself on a Debian system).
> However, if you don't run as root you won't be able to set the system clock.
>
> $ sntp -d 10.0.0.1
>  2 Jul 07:48:55 sntp[16408]: Started sntp
>  2 Jul 07:48:55 sntp[16408]: kod_init_kod_db(): Cannot open KoD db file
> /var/db/ntp-kod
> sntp sendpkt: Sending packet to 10.0.0.1... Packet sent.
> sntp recvpkt: packet received from 10.0.0.1 is not authentic.
> Authentication not enforced.
> sntp handle_pkt: Received 48 bytes from 10.0.0.1
> sntp offset_calculation:t21: -0.000545   t34: -0.011008
> delta: 0.010462  offset: -0.005776
> 2019-07-02 07:48:55.219316 (+0800) -0.005776 +/- 0.031540 secs
>  2 Jul 07:48:55 sntp[16408]: Can't open KOD db file /var/db/ntp-kod for
> writing!
>
>
>
> You can also look at the fake-hwclock package which keeps a timestamped
> file updated and reads the timestamp at boot to get the clock close to
> current time.  That will at least solve your 2016/2019 problem.

I think you are running an old sntp.

Sntp doesn't bind to port 123 by default.

H




___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] Reference 'sntp' utility: how do you set the destination port number

2019-07-02 Thread A C
On 2019-06-29 19:09, stua...@longlandclan.id.au wrote:
> Hi all,
> 
> This will seem like a silly request, but how do you set the sntp client 
> (distributed with the 'ntp' package in Debian) port number?
> 
> The reason I need this is that I need to synchronise time with clients whose 
> only link to the outside world is a 1200-baud AX.25 packet radio network.  
> Running TCP/IP over this is an impossibility at present.
> 
> The devices (partly due to an oversight on my part), do not have an RTC.  
> When first booted, they think the time is 2016.
> 
> The boards have been manufactured, it's too late to suggest that as the 
> solution.  (The next revision *does* have a space for an RTC.)  The devices 
> have two serial ports, one connected to an RFID reader, the other to an AX.25 
> TNC.  There is no room for a GPS, and no time to order one.
> 
> Hindsight is 20/20, so I'm looking for a quick software solution.
> 
> I have therefore written a program that can bind to an arbitrary UDP port, 
> and can relay the NTP client requests and server responses over the AX.25 
> network.  It is written in Python 3 and implements all of the AX.25 logic 
> along with the data collection function it is meant to perform.
> 
> Basically, UDP datagram (containing NTP payload) goes in, APRS-formatted 
> AX.25 "un-numbered information frame" comes out.  APRS UI frame comes in, UDP 
> datagram gets sent back to the (S)NTP client.
> 
> I do not need, nor want, this script to run as 'root'.  So there goes binding 
> to port 123/udp.  I am instead using 3123/udp.  I'd like 'sntp' to talk to 
> that.
> 
> 'chrony' can talk on an alternate port, but it takes many measurements to 
> synchronise the time, which is not ideal, it often takes many minutes to 
> synchronise.  I don't need millisecond precision, I just need stations to be 
> within 60 seconds of each other ('ntp' can take over and fine tune it from 
> there).  I don't care that the date suddenly jumps from 2016 to 2019 -- I 
> care more that the device "lives in 2016" for more than a few minutes.
> 
> I really just need a one-shot tool like 'ntpdate'.  I understand that 'sntp' 
> is that tool.  What is the command line option I use to make it talk to a NTP 
> server that is on a different port to the standard?

Clients don't bind to ports.  sntp will connect outbound on UDP 123 as a
normal user just fine (I just tested it myself on a Debian system).
However, if you don't run as root you won't be able to set the system clock.

$ sntp -d 10.0.0.1
 2 Jul 07:48:55 sntp[16408]: Started sntp
 2 Jul 07:48:55 sntp[16408]: kod_init_kod_db(): Cannot open KoD db file
/var/db/ntp-kod
sntp sendpkt: Sending packet to 10.0.0.1... Packet sent.
sntp recvpkt: packet received from 10.0.0.1 is not authentic.
Authentication not enforced.
sntp handle_pkt: Received 48 bytes from 10.0.0.1
sntp offset_calculation:t21: -0.000545   t34: -0.011008
delta: 0.010462  offset: -0.005776
2019-07-02 07:48:55.219316 (+0800) -0.005776 +/- 0.031540 secs
 2 Jul 07:48:55 sntp[16408]: Can't open KOD db file /var/db/ntp-kod for
writing!



You can also look at the fake-hwclock package which keeps a timestamped
file updated and reads the timestamp at boot to get the clock close to
current time.  That will at least solve your 2016/2019 problem.
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


[ntp:questions] Reference 'sntp' utility: how do you set the destination port number

2019-07-02 Thread stuartl
Hi all,

This will seem like a silly request, but how do you set the sntp client 
(distributed with the 'ntp' package in Debian) port number?

The reason I need this is that I need to synchronise time with clients whose 
only link to the outside world is a 1200-baud AX.25 packet radio network.  
Running TCP/IP over this is an impossibility at present.

The devices (partly due to an oversight on my part), do not have an RTC.  When 
first booted, they think the time is 2016.

The boards have been manufactured, it's too late to suggest that as the 
solution.  (The next revision *does* have a space for an RTC.)  The devices 
have two serial ports, one connected to an RFID reader, the other to an AX.25 
TNC.  There is no room for a GPS, and no time to order one.

Hindsight is 20/20, so I'm looking for a quick software solution.

I have therefore written a program that can bind to an arbitrary UDP port, and 
can relay the NTP client requests and server responses over the AX.25 network.  
It is written in Python 3 and implements all of the AX.25 logic along with the 
data collection function it is meant to perform.

Basically, UDP datagram (containing NTP payload) goes in, APRS-formatted AX.25 
"un-numbered information frame" comes out.  APRS UI frame comes in, UDP 
datagram gets sent back to the (S)NTP client.

I do not need, nor want, this script to run as 'root'.  So there goes binding 
to port 123/udp.  I am instead using 3123/udp.  I'd like 'sntp' to talk to that.

'chrony' can talk on an alternate port, but it takes many measurements to 
synchronise the time, which is not ideal, it often takes many minutes to 
synchronise.  I don't need millisecond precision, I just need stations to be 
within 60 seconds of each other ('ntp' can take over and fine tune it from 
there).  I don't care that the date suddenly jumps from 2016 to 2019 -- I care 
more that the device "lives in 2016" for more than a few minutes.

I really just need a one-shot tool like 'ntpdate'.  I understand that 'sntp' is 
that tool.  What is the command line option I use to make it talk to a NTP 
server that is on a different port to the standard?

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions