ntpd question

Alexander Timoshenko gonzo at ukrweb.net
Mon Nov 29 11:32:25 PST 2004


Configuration: 5.3-STABLE. I have 2 DHCP interfaces (a bit strange, 
but it does not matter). Right after dhclient i have the next situation:

em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=1b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING>
        inet 192.168.0.114 netmask 0xffffff00 broadcast 192.168.0.255
        ether 00:e0:81:61:1b:fd
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        inet 127.0.0.1 netmask 0xff000000 
rue0: flags=108843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
        ether 00:10:60:e9:33:2c
        media: Ethernet autoselect (none)
        status: no carrier

Note that rue0 has address 0.0.0.0 
Now i'd like to sync time on the box using ntpd -q, and i got 

--- quote
Nov 29 21:08:09 pbxbox ntpd[71729]: ntpd 4.2.0-a Wed Oct 20 14:36:02
EEST 2004 (1)
Nov 29 21:08:09 pbxbox ntpd[71729]: no IPv6 interfaces found
Nov 29 21:08:09 pbxbox ntpd[71729]: bind() fd 7, family 2, port 123,
addr 0.0.0.0, in_classd=0 flags=8 fails: Address already in use
Nov 29 21:08:27 pbxbox ntpd[71729]: no reply; clock not set
--- /quote

I've made some research and found the source of problem. It is in
ntp_io.c See lines 522-526. They blacklist addresses of local
interfaces.
But hack_restrict has this code fo find restrictions list
entry(ntp_restrict:327):
                if (addr == 0) {
                        rlprev = 0;
                        rl = restrictlist;
                } else {
it finds first entry of list (0.0.0.0/0.0.0.0) and marks it as
blacklisted. Theis means we restrict all packets. I think the fix will
be 
                if ((addr == 0) && (mask == 0)) {

Any comments from gurus?

PS Sorry for a bit long message, i just want to make the things clear.

-- 
gonzo


More information about the freebsd-hackers mailing list