Page MenuHomeFreeBSD

rc: Add /etc/defaults/rc.conf.d/routed
Needs ReviewPublic

Authored by ivy on Sun, Aug 10, 4:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Aug 21, 1:59 AM
Unknown Object (File)
Wed, Aug 20, 11:41 PM
Unknown Object (File)
Mon, Aug 18, 8:59 AM
Unknown Object (File)
Mon, Aug 18, 8:16 AM
Unknown Object (File)
Mon, Aug 18, 2:44 AM
Unknown Object (File)
Mon, Aug 18, 2:00 AM
Unknown Object (File)
Thu, Aug 14, 7:09 AM
Unknown Object (File)
Thu, Aug 14, 4:00 AM
Subscribers

Details

Reviewers
imp
emaste
adrian
Group Reviewers
rc
pkgbase

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 66150
Build 63033: arc lint + arc unit

Event Timeline

ivy requested review of this revision.Sun, Aug 10, 4:28 PM
ivy created this revision.

s/FILEGROUPS/FILESGROUPS/

I would suggest putting entries in /etc/defaults/rc.conf into each rc.d scripts, instead of maintaining rc.d/routed and defaults/rc.conf.d/routed separately. I already added the necessary framework a long time ago, but it was not populated. The change based on the idea looks like the following. It should work without any change to rc.subr:

diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index 07cb9803882c..9c5adf14d787 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -457,9 +457,6 @@ static_arp_pairs=""		# Set to static ARP list (or leave empty).
 static_ndp_pairs=""		# Set to static NDP list (or leave empty).
 static_routes=""		# Set to static route list (or leave empty).
 gateway_enable="NO"		# Set to YES if this host will be a gateway.
-routed_enable="NO"		# Set to YES to enable a routing daemon.
-routed_program="/sbin/routed"	# Name of routing daemon to use if enabled.
-routed_flags="-q"		# Flags for routing daemon.
 arpproxy_all="NO"		# replaces obsolete kernel option ARP_PROXYALL.
 forward_sourceroute="NO"	# do source routing (only if gateway_enable is set to "YES")
 accept_sourceroute="NO"		# accept source routed packets to us
diff --git a/libexec/rc/rc.d/routed b/libexec/rc/rc.d/routed
index 9338cf034edd..fe5618f7f2c4 100755
--- a/libexec/rc/rc.d/routed
+++ b/libexec/rc/rc.d/routed
@@ -13,8 +13,13 @@ name="routed"
 desc="Network RIP and router discovery routing daemon"
 rcvar="routed_enable"
 
-: ${routed_svcj_options:="net_basic"}
-
+set_rcvar routed_enable	NO "Set to YES to enable a routing daemon"
+set_rcvar routed_program "/sbin/routed" "Name of routing daemon to use if enabled"
+set_rcvar routed_flags	"-q" "Flags for routing daemon"
+set_rcvar routed_svcj_options	"net_basic"
 set_rcvar_obsolete router_enable routed_enable
 set_rcvar_obsolete router routed_program
 set_rcvar_obsolete router_flags	routed_flags

While the entries in etc/defaults/rc.conf are removed, you can still extract a simlar output to them using service routed rcvar:

# routed : Network RIP and router discovery routing daemon
#
routed_enable="NO"
# - Set to YES to enable a routing daemon
#   (default: "NO")
routed_program="/sbin/routed"
# - Name of routing daemon to use if enabled
#   (default: "/sbin/routed")
routed_flags="-q"
# - Flags for routing daemon
#   (default: "-q")
routed_svcj_options="net_basic"
#   (default: "net_basic")

I think the goal is the same as your suggestion, and I would like to know your thoughts about this direction.

In D51855#1185583, @hrs wrote:

I would suggest putting entries in /etc/defaults/rc.conf into each rc.d scripts, instead of maintaining rc.d/routed and defaults/rc.conf.d/routed separately.

does this work with load_rc_config? for example, rc.d/mountd wants to load configuration of rc.d/zfs to determine if ZFS is enabled or not.

I think the goal is the same as your suggestion, and I would like to know your thoughts about this direction.

i don't really have a strong opinion here: my aim is to remove entries from /etc/defaults/rc.conf for packages which are not installed, so if there's consensus to do that via set_rcvar, i can do that instead.