DragonFly commits List (threaded) for 2009-01
DragonFly BSD
DragonFly commits List (threaded) for 2009-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: DragonFly-2.1.1.346.g4d1d7 master usr.sbin/dntpd client.h defs.h dntpd.8 main.c socket.c


From: "Sepherosa Ziehau" <sepherosa@xxxxxxxxx>
Date: Fri, 9 Jan 2009 22:04:30 +0800

On Fri, Jan 9, 2009 at 9:27 PM, Simon 'corecode' Schubert
<corecode@fs.ei.tum.de> wrote:
> Sepherosa Ziehau wrote:
>>
>> On Fri, Jan 9, 2009 at 8:47 PM, Simon 'corecode' Schubert
>> <corecode@fs.ei.tum.de> wrote:
>>>
>>> Sepherosa Ziehau wrote:
>>>>
>>>> On Fri, Jan 9, 2009 at 8:19 PM, Simon 'corecode' Schubert
>>>> <corecode@fs.ei.tum.de> wrote:
>>>>>
>>>>> Matthias Schmidt wrote:
>>>>>>
>>>>>> commit 4d1d74ba3c1fe85df343e4059c80bc704eec0312
>>>>>> Author: Matthias Schmidt <matthias@dragonflybsd.org>
>>>>>> Date:   Fri Jan 9 12:35:25 2009 +0100
>>>>>>
>>>>>>  Add IPv6 support to dntpd
>>>>>>      This commit allows dntpd to work with either IPv4 or IPv6 NTP
>>>>>> servers.  I added
>>>>>>  two new command line switches (-4/-6) to force dntpd to use only
>>>>>> v4/v6
>>>>>> addresses.
>>>>>>  Thanks to sephe@ for some good hints.
>>>>>
>>>>> Are you sure this works if the ipv6 server is unreachable?  I don't
>>>>> think
>>>>> that a connect(2) on a udp socket will find that out.  You'd actually
>>>>> have
>>>>
>>>> udp_socket() only sets up a UDP socket; by calling connect(2) we could
>>>> receive ICMP error and use write(2) like functions.  As far as I
>>>> understand the code, it never intends to verify the reachability of
>>>> the server.
>>>
>>> But it has to do that now!  The DNS might return ipv6 and ipv4, but the
>>> ipv4
>>> one is only reachable.  So you *have* to check availability, otherwise it
>>
>> Do you mean the host does not have global scope ipv6 unicast addresses
>> or the host does not have a valid default ipv6 route?  If that's what
>> you mean, connect(2) will fail on all resolved ipv6 server addresses.
>
> The host might have an ipv6 address listed in DNS, but might not listen to
> it, or there might be a routing advertisement for ipv6 on the local network
> but routing might be broken nevertheless, etc.  IPV6 might be
> filtered upstream, etc.

Quickest solution, but still incorrect, is prefer ipv4 address over
ipv6 address or use ipv4 address only by default.
Else we try the ipv4 address if one of the ipv6 address failed
(read(2) server response timed out or got ICMP error in the main
loop), and try ipv6 address if ipv4 address failed.  I don't remember
NTP has keepalive or echo like messages, so I don't think we should
check reachability in udp_socket().

Best Regards,
sephe

-- 
Live Free or Die



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]