[ntp:questions] Re: Need ntpdc command to recreate sockets

mayer at gis.net mayer at gis.net
Mon Jan 10 13:51:04 UTC 2005


Enrique Perez-Terron wrote:
> 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


It's harder than you think and is on my list of things to do. We
basically need to rescan the interfaces, remove the deleted IP
addresses and add the new IP addresses. While it would be possible
to implement a scheme via ntpdc to add/delete a specific IP address,
it would not be easy either. This problem is logged as bug #51 in
bugzilla.

I will try to get to it as soon as I have the IPv6 multicasting
issues resolved.

Danny




More information about the questions mailing list