Bug 137506 - dns/dnsmasq starts without configuration files.
Summary: dns/dnsmasq starts without configuration files.
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-07 06:00 UTC by fumifumi
Modified: 2009-08-13 22:06 UTC (History)
0 users

See Also:


Attachments
file.diff (604 bytes, patch)
2009-08-07 06:00 UTC, fumifumi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description fumifumi 2009-08-07 06:00:08 UTC
Dnsmasq starts without etc/dnsmasq.conf, and there is no proper place
to set ${dnsmasq_conf} on booting.

Fix: The order of loading rc.conf and setting values are reversed.
A patch file is attached.

Thank you.


Patch attached with submission follows:
How-To-Repeat: Install dns/dnsmasq, remove or rename /usr/local/etc/dnsmasq.conf, and start it.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2009-08-07 06:00:20 UTC
Maintainer of dns/dnsmasq,

Please note that PR ports/137506 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/137506

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2009-08-07 06:00:22 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Matthias Andree 2009-08-07 10:07:22 UTC
Please use the patch below instead:

------BEGIN CHANGELOG
* Fix rcfile bugs (and bump PORTREVISION):
- load configuration earlier so that we don't run without config file,
  analyzed, reported and patch suggested by Fumiyuki Shimizu
- mention /etc/rc.conf.local (as suggested in the Porter's handbook)
- mention dnsmasq_flags for additional command line arguments
- pass pidfile and dnsmasq_conf as arguments to dnsmasq (previously,
  overriding dnsmasq_conf had no effect).

* Fix COMMENT to mention TFTP server; shorten it so it fully fits on the
  pkg_info list.
------END CHANGELOG

Add further PR and submitter info as usual.

--- dnsmasq-2.49_2.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/dns/dnsmasq/Makefile /usr/home/ma/ports/dns/dnsmasq/Makefile
--- /usr/ports/dns/dnsmasq/Makefile	2009-07-16 00:57:30.000000000 +0200
+++ /usr/home/ma/ports/dns/dnsmasq/Makefile	2009-08-07 10:56:37.000000000 +0200
@@ -7,14 +7,14 @@
 
 PORTNAME=	dnsmasq
 PORTVERSION=	2.49
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	dns ipv6
 MASTER_SITES=	http://www.thekelleys.org.uk/dnsmasq/ \
 		${MASTER_SITE_GENTOO}
 MASTER_SITE_SUBDIR=	distfiles
 
 MAINTAINER=	matthias.andree@gmx.de
-COMMENT=	Lightweight, easy to configure DNS forwarder and DHCP server
+COMMENT=	Lightweight DNS forwarder, DHCP and TFTP server
 
 MAN8=		dnsmasq.8
 
diff -ruN --exclude=CVS /usr/ports/dns/dnsmasq/files/dnsmasq.sh.in /usr/home/ma/ports/dns/dnsmasq/files/dnsmasq.sh.in
--- /usr/ports/dns/dnsmasq/files/dnsmasq.sh.in	2009-07-16 00:57:30.000000000 +0200
+++ /usr/home/ma/ports/dns/dnsmasq/files/dnsmasq.sh.in	2009-08-07 10:48:41.000000000 +0200
@@ -5,25 +5,36 @@
 # BEFORE:  DAEMON
 # KEYWORD: shutdown
 #
-# Add the following line to /etc/rc.conf to enable dnsmasq:
+# Add the following line to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
 #
-# dnsmasq_enable="YES"
+# dnsmasq_enable (bool):  Set to "NO" by default.
+#                         Set it to "YES" to enable dnsmasq at boot.
+#
+# Further settings you can change in /etc/rc.conf if desired:
+#
+# dnsmasq_conf (path):    Set to %%PREFIX%%/etc/dnsmasq.conf by default.
+#                         Set it to another configuration file if you want.
+#
+# dnsmasq_flags (string): Empty by default. Set it to additional command
+#                         line arguments if desired.
 #
-
-# override these variables in /etc/rc.conf
-dnsmasq_enable=${dnsmasq_enable:-"NO"}
 
 . %%RC_SUBR%%
 
 name=dnsmasq
 rcvar=$(set_rcvar)
 
-command=%%PREFIX%%/sbin/${name}
+command="%%PREFIX%%/sbin/${name}"
+extra_commands=reload
 pidfile=/var/run/${name}.pid
+
+load_rc_config ${name}
+
+: ${dnsmasq_enable="NO"}
+: ${dnsmasq_conf="%%PREFIX%%/etc/${name}.conf"}
 required_files=${dnsmasq_conf}
 
-extra_commands=reload
+command_args="-x $pidfile -C $dnsmasq_conf"
 
-load_rc_config ${name}
 run_rc_command "$1"
-
--- dnsmasq-2.49_2.patch ends here ---
Comment 4 Martin Wilke freebsd_committer freebsd_triage 2009-08-13 22:06:01 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!