From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 29 19:32:25 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7AF4C16A4CE for ; Mon, 29 Nov 2004 19:32:25 +0000 (GMT) Received: from expo.ukrweb.net (expo.ukrweb.net [193.125.78.116]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A89443D5D for ; Mon, 29 Nov 2004 19:32:21 +0000 (GMT) (envelope-from gonzo@ukrweb.net) Received: from gonzo by expo.ukrweb.net with local (Exim 4.34 (FreeBSD)) id 1CYrFo-0008Vs-2R for freebsd-hackers@freebsd.org; Mon, 29 Nov 2004 21:32:08 +0200 Date: Mon, 29 Nov 2004 21:32:08 +0200 From: Alexander Timoshenko To: freebsd-hackers@freebsd.org Message-ID: <20041129193208.GA32673@univ.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: FreeBSD/5.2.1-RELEASE-p10 (i386) User-Agent: Mutt/1.5.6i Subject: ntpd question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2004 19:32:25 -0000 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 mtu 1500 options=1b inet 192.168.0.114 netmask 0xffffff00 broadcast 192.168.0.255 ether 00:e0:81:61:1b:fd media: Ethernet autoselect (100baseTX ) status: active lo0: flags=8049 mtu 16384 inet 127.0.0.1 netmask 0xff000000 rue0: flags=108843 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