#
# Add ${name}_setfib functionality to rc.subr
#
--- rc.subr.orig	2012-01-03 08:26:59.000000000 +0100
+++ rc.subr		2012-05-02 23:16:44.000000000 +0200
@@ -499,6 +499,10 @@
 #
 #	${name}_nice	n	Nice level to run ${command} at.
 #
+#	${name}_setfib	n	Routing table for ${command} to use. Requires
+#				kernel with options ROUTETABLES=<nr> compiled.
+#
+#
 #	${name}_user	n	User to run ${command} as, using su(1) if not
 #				using ${name}_chroot.
 #				Requires /usr to be mounted.
@@ -675,7 +679,8 @@
 	fi
 	eval _chdir=\$${name}_chdir	_chroot=\$${name}_chroot \
 	    _nice=\$${name}_nice	_user=\$${name}_user \
-	    _group=\$${name}_group	_groups=\$${name}_groups
+	    _group=\$${name}_group	_groups=\$${name}_groups \
+        _setfib=\$${name}_setfib
 
 	if [ -n "$_user" ]; then	# unset $_user if running as that user
 		if [ "$_user" = "$(eval $IDCMD)" ]; then
@@ -755,6 +760,7 @@
 			check_startmsgs && echo "Starting ${name}."
 			if [ -n "$_chroot" ]; then
 				_doit="\
+${_setfib:+setfib -F $_setfib }\
 ${_nice:+nice -n $_nice }\
 chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
 $_chroot $command $rc_flags $command_args"
@@ -771,6 +777,9 @@
 					fi
 					_doit="nice -n $_nice $_doit"
 				fi
+                if [ -n "$_setfib" ]; then
+				    _doit="setfib -F $_setfib $_doit"
+                fi
 			fi
 
 					# run the full command
