[ntp:questions] Need ntpdc command to recreate sockets

Enrique Perez-Terron enrio at online.no
Mon Jan 10 10:49:43 UTC 2005


Hello,

I am on a DSL account that regularly disconnects me for a minute and
then gives me a different IP address.  I have added a line to restart
ntpd whenever the ppp0 network device comes up, but I would like to have
ntpd handle the issues internally without loosing the time statistics.

It is not enough to instruct ntpd to recreate the peer structures, as it
keeps an UDP socket bound to the old IP address, and reuses this socket
for all communications. However, the socket does not work any more,
datagrams are set out with the old IP address as the IP-level
originating address, and no responses ever make it back.

I imagine it would be easy to add some code to ntpd and ntpdc or ntpq to
close the udp socket and reopen it. With an additional dup2() call one
can ensure the new socket has the same open file descriptor number as
the old one.

Do you think this is usefull? Are there any other solutions? Any issues
I have missed?

Maybe I can hack up a patch, but if somebody with "hacking" knowledge of
the ntpd internals could indicate what files to look at, and point at
any relevant invariants/data structures, it would save me days of code
reading and deciphering.

I suggest the ntpdc command could be called "recreate-sockets". I see no
point in adding an interface name or IP address argument, because I
cannot imagine it does any harm to close and reopen all of them.  Does
anyone think otherwise?

Regards,
Enrique Perez-Terron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ntp.org/pipermail/questions/attachments/20050110/ae85352f/attachment.pgp>


More information about the questions mailing list