From nobody@FreeBSD.org  Mon Apr 18 08:27:35 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C7BD316A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Apr 2005 08:27:35 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6F01243D5F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Apr 2005 08:27:35 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j3I8RZu0076707
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Apr 2005 08:27:35 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j3I8RZTn076706;
	Mon, 18 Apr 2005 08:27:35 GMT
	(envelope-from nobody)
Message-Id: <200504180827.j3I8RZTn076706@www.freebsd.org>
Date: Mon, 18 Apr 2005 08:27:35 GMT
From: Thomas Schweikle <tps@vr-web.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: dns-servers are started to late if not named
X-Send-Pr-Version: www-2.3

>Number:         80054
>Category:       ports
>Synopsis:       dns/dnsmasq: dns-servers are started too late if not named
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 18 08:30:28 GMT 2005
>Closed-Date:    Sat Jul 16 01:23:16 GMT 2005
>Last-Modified:  Sat Jul 16 01:23:16 GMT 2005
>Originator:     Thomas Schweikle
>Release:        FreeBSD 5.4-STABLE
>Organization:
>Environment:
FreeBSD hazel.tps 5.4-STABLE FreeBSD 5.4-STABLE #32: Wed Apr 13 12:49:28 CEST 2005     screen@hazel.tps:/usr/obj/usr/src/sys/HAZEL  i386
>Description:
      if an other dns server than named is used, like dnsmasq, this server is started after other daemons requiring dns services, like ntpdate and ntpd.
>How-To-Repeat:
      In /etc/rc.conf set:
| dnsmasq_enable="YES"
| named_enable="NO"

Configure dnsmasq in /usr/local/etc/dnsmasq.conf:
| domain-needed
| bogus-priv
| filterwin2k
| resolv-file=/etc/resolv.dnsmasq
| local=/invalid/
| expand-hosts
| domain=invalid
| dhcp-range=192.168.1.100,192.168.1.199,255.255.255.0,192.168.1.255,48h
| dhcp-option=3,192.168.1.1
| dhcp-authoritative
| cache-size=150
| no-negcache

Configure /etc/resolv.dnsmasq:
| search invalid
| nameserver 217.237.150.141
| nameserver 217.237.150.97

Configure /etc/resolv.conf:
| search invalid
| nameserver 127.0.0.1
| nameserver 192.168.1.11

Restart.
ntpdate will now be started before dnsmasq is running. Thus ntpdate will never find configured servers. This makes the system start extremly slow, since it waits for ntpdates dns query to time out. Second: time is never set by ntpdate, in tune ntpd does not sync if the local clocks displacement is to large.
>Fix:
      Any dns server selected has to start before and daemon using dns services. This makes daemon starting global. It can't matter a daemon being "Local" or "System". It maters what it provides.

The error is within the start procedure first starting all "System" daemons, then local ones. We can't do it this way. We have to intermix both, then find what has to be started first, regardless of "Local" or "System".
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-port-bugs 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Mon Apr 18 12:03:36 GMT 2005 
Responsible-Changed-Why:  
This is issue with dnsmasq port, not with base system. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80054 
Responsible-Changed-From-To: freebsd-port-bugs->freebsd-ports-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Apr 25 22:04:18 GMT 2005 
Responsible-Changed-Why:  
Fix assignment. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80054 
State-Changed-From-To: open->feedback 
State-Changed-By: leeym 
State-Changed-When: Wed May 11 04:46:26 GMT 2005 
State-Changed-Why:  
The maintainer is noticed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80054 
Responsible-Changed-From-To: freebsd-ports-bugs->leeym 
Responsible-Changed-By: leeym 
Responsible-Changed-When: Wed May 11 04:46:30 GMT 2005 
Responsible-Changed-Why:  
I will take care of this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80054 

From: Yen-Ming Lee <leeym@FreeBSD.org>
To: bug-followup@FreeBSD.org, tps@vr-web.de, steven@honson.org
Cc:  
Subject: Re: ports/80054: dns/dnsmasq: dns-servers are started too late if not named
Date: Wed, 11 May 2005 12:45:35 +0800

 --4bRzO86E/ozDv8r1
 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc"
 Content-Disposition: inline
 
 
 --C7zPtVaVf+AK4Oqc
 Content-Type: text/plain; charset=big5
 Content-Disposition: inline
 
 Hi, Thomas and Steven,
 
 Could you take a look on PR 80054?
 http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/80054
 
 and could you test the attached patch? It's copied from /etc/rc.d/named
 
 thanks and regards,
 -- 
 Yen-Ming Lee [utf7:+Z05fZWYO] | KeyID:0x5EB52E51 | Taipei, Taiwan
 
 --C7zPtVaVf+AK4Oqc
 Content-Type: text/plain; charset=big5
 Content-Disposition: attachment; filename="dnsmasq.diff"
 
 Index: files/dnsmasq.sh
 ===================================================================
 RCS file: /home/pcvs/ports/dns/dnsmasq/files/dnsmasq.sh,v
 retrieving revision 1.2
 diff -u -r1.2 dnsmasq.sh
 --- files/dnsmasq.sh	13 Dec 2004 01:12:31 -0000	1.2
 +++ files/dnsmasq.sh	11 May 2005 04:42:15 -0000
 @@ -2,7 +2,8 @@
  #
  #
  # PROVIDE: dnsmasq
 -# REQUIRE: DAEMON NETWORKING SERVERS
 +# REQUIRE: SERVERS
 +# BEFORE:  DAEMON
  # KEYWORD: FreeBSD
  #
  # Add the following line to /etc/rc.conf to enable dnsmasq:
 
 --C7zPtVaVf+AK4Oqc--
 
 --4bRzO86E/ozDv8r1
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (FreeBSD)
 
 iQCVAwUBQoGN78nMx0NetS5RAQK/awP+PL0BosteqqFqVa9hdkHKpE4iM+v2pg8Q
 MtWy8Di7lB+y1lTVdcdMllF77GWgjqgrS+KrFgdO3O9fP+VFd7jTEffC35qV5Fd4
 DKUckpyqLvf2HiZE5EFf4jpop/tZfCVPFmdDgU8RI1b65Wcdk8gmSB6N6H1OscI1
 butRcKdcLhU=
 =alO6
 -----END PGP SIGNATURE-----
 
 --4bRzO86E/ozDv8r1--

From: Thomas Schweikle <tps@vr-web.de>
To: bug-followup@FreeBSD.org, tps@vr-web.de
Cc:  
Subject: Re: ports/80054: dns/dnsmasq: dns-servers are started too late if
 not named
Date: Wed, 11 May 2005 13:04:32 +0200

 This is a MIME-formatted message.  If you see this text it means that your
 E-mail software does not support MIME-formatted messages.
 
 --=_vrwf203-26952-1115809485-0001-2
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 OK. I've tested. No change.
 
 This was something I tried first.
 
 The start script does:
 - read all headers from files in "/etc/rc.d",
 - calculate dependencies,
 - start everything in dependency order,
 - read all headers from files in "/usr/local/etc/rc.d",
 - calculate dependencies,
 - start everything in dependency order
 
 The start script does no:
 - read all headers from files in "/etc/rc.d", "/usr/local/etc/rc.d",
 - calculate dependencies,
 - start everything in dependency order
 
 Given the above: dnsmasq will *always* start *after* ntpdate, since
 starting ntpdate is done with "/etc/rc.d/ntpdate". This is worked on and
 run *before* any file in "/usr/local/etc/rc.d" is touched.
 
 With the second approach this would be done --- but this is not what
 "/etc/rc" tells rcorder to do:
 files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
 
 for _rc_elem in ${files}; do
         run_rc_script ${_rc_elem} ${_boot}
 done
 
 Only "/etc/rc.d" is looked at. rcorder should instead have had looked at
 both: "/etc/rc.d" *and* "/usr/local/etc/rc.d". Handling over the full
 list of daemons to start in "${files}".
 
 Given instead in "/etc/rc":
 files=`rcorder ${skip} /etc/rc.d/* /usr/local/etc/rc.d/*\.sh \
   2>/dev/null`
 
 would solve the problem.
 
 
 BTW: Your patch makes "rcorder /etc/rc.d/* /usr/local/etc/rc.d/*\.sh"
 exaust:
 /etc/rc.d/NETWORKING
 /etc/rc.d/devd
 /etc/rc.d/mountcritremote
 /etc/rc.d/accounting
 /etc/rc.d/cleanvar
 /etc/rc.d/ipmon
 /etc/rc.d/syslogd
 /etc/rc.d/savecore
 /etc/rc.d/SERVERS
 /etc/rc.d/named                <---
 /etc/rc.d/ntpdate              <---
 /etc/rc.d/rpcbind
 /etc/rc.d/nfsclient
 /etc/rc.d/nisdomain
 /etc/rc.d/ypserv
 /etc/rc.d/ypbind
 /etc/rc.d/amd
 /etc/rc.d/atm3
 /etc/rc.d/tmp
 /etc/rc.d/cleartmp
 /etc/rc.d/dmesg
 /etc/rc.d/ike
 /etc/rc.d/ipsec
 /etc/rc.d/ipxrouted
 /etc/rc.d/kerberos
 /etc/rc.d/kadmind
 /etc/rc.d/keyserv
 /etc/rc.d/kpasswdd
 /etc/rc.d/ldconfig
 /etc/rc.d/quota
 /etc/rc.d/nfsserver
 /etc/rc.d/mountd
 /etc/rc.d/nfsd
 /etc/rc.d/nfslocking
 /etc/rc.d/pflog
 /etc/rc.d/pf
 /etc/rc.d/pppoed
 /etc/rc.d/pwcheck
 /etc/rc.d/virecover
 /usr/local/etc/rc.d/apache2.sh
 rcorder: Circular dependency on provision `DAEMON' in file
 `/usr/local/etc/rc.d/dnsmasq.sh'.
 /usr/local/etc/rc.d/dnsmasq.sh <---
 
 While "/etc/rc.d/named" is started *before* "/etc/rc.d/ntpdate",
 "/usr/local/etc/rc.d/dnsmasq.sh" ist called after. But it would be
 necessary to call "/usr/local/etc/rc.d/dnsmasq.sh" right after
 "/etc/rc.d/named".
 
 There is a atage missing in between "NETWORK" and "SERVER" we could put
 services in required by other services, or alternatively: a keyword
 ordering "named" or "dnsmasq" right after all "NETWORK" started.
 
 Changing the header of "/usr/local/etc/rc.d/dnsmasq.sh" to:
 #! /bin/sh
 #
 #
 # PROVIDE: dnsmasq
 # REQUIRE: NETWORKING syslogd cleanvar
 # BEFORE:  SERVERS
 # KEYWORD: FreeBSD
 #
 # Add the following line to /etc/rc.conf to enable dnsmasq:
 
 BTW: The same should be done for "/etc/rc.d/named" --- just to make
 shure it is there before any other maybe requiring dns services are started.
 
 Additionaly it would be of high use, if "named" and "dnsmasq" could
 provide "dns" ("dnsmasq" additionaly "dhcp"). Other services depending
 on these could just ask for "dns" (or "dhcp") to have it started before
 this particular service. For "ntpdate":
 
 # PROVIDE: ntpdate
 # REQUIRE: NETWORKING syslogd
 # KEYWORD: nojail
 
 could be changed to
 
 # PROVIDE: ntpdate
 # REQUIRE: NETWORKING syslogd dns
 # KEYWORD: nojail
 
 -- 
 Thomas
 
 
 --=_vrwf203-26952-1115809485-0001-2
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Transfer-Encoding: 7bit
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (FreeBSD)
 
 iD8DBQFCgebAJuPdOes4UCQRAmmsAJ9a2QngsPTjh3C9DeVxSVApQmolsACfWYFc
 P3R5LM0kLezuf0mNBLWR/Sk=
 =dfrz
 -----END PGP SIGNATURE-----
 
 --=_vrwf203-26952-1115809485-0001-2--
 
Responsible-Changed-From-To: leeym->freebsd-ports-bugs 
Responsible-Changed-By: leeym 
Responsible-Changed-When: Mon Jun 6 16:38:54 GMT 2005 
Responsible-Changed-Why:  
Need to patch /etc/rc which is not in ports. Release to the pool. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80054 
State-Changed-From-To: feedback->closed 
State-Changed-By: leeym 
State-Changed-When: Sat Jul 16 01:23:12 GMT 2005 
State-Changed-Why:  
Fixed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80054 
>Unformatted:
