summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/rc.d/archdep4
-rw-r--r--etc/rc.d/atm14
-rw-r--r--etc/rc.d/bluetooth9
-rw-r--r--etc/rc.d/geli9
-rw-r--r--etc/rc.d/hcsecd16
-rw-r--r--etc/rc.d/ip6fw15
-rwxr-xr-xetc/rc.d/ipfilter36
-rw-r--r--etc/rc.d/ipfw14
-rwxr-xr-xetc/rc.d/ipnat20
-rw-r--r--etc/rc.d/mdconfig14
-rw-r--r--etc/rc.d/mdconfig214
-rwxr-xr-xetc/rc.d/mountcritremote6
-rw-r--r--etc/rc.d/natd8
-rw-r--r--etc/rc.d/nfsclient14
-rw-r--r--etc/rc.d/nfsserver15
-rw-r--r--etc/rc.d/pf16
-rw-r--r--etc/rc.d/pflog10
-rw-r--r--etc/rc.d/pfsync19
-rw-r--r--etc/rc.d/sdpd16
-rw-r--r--etc/rc.d/syscons2
-rw-r--r--etc/rc.d/ugidfw16
21 files changed, 43 insertions, 234 deletions
diff --git a/etc/rc.d/archdep b/etc/rc.d/archdep
index 220d94f..466f45f 100644
--- a/etc/rc.d/archdep
+++ b/etc/rc.d/archdep
@@ -19,13 +19,13 @@ ibcs2_compat()
{
if checkyesno ibcs2_enable; then
echo -n ' ibcs2'
- kldload ibcs2 > /dev/null 2>&1
+ load_kld ibcs2
case ${ibcs2_loaders} in
[Nn][Oo])
;;
*)
for i in ${ibcs2_loaders}; do
- kldload ibcs2_$i > /dev/null 2>&1
+ load_kld ibcs2_$i
done
;;
esac
diff --git a/etc/rc.d/atm1 b/etc/rc.d/atm1
index dc91700..da50df0 100644
--- a/etc/rc.d/atm1
+++ b/etc/rc.d/atm1
@@ -48,7 +48,7 @@ atm_start()
{
if [ -n "${natm_interfaces}" ] ; then
# Load the HARP pseudo interface
- kldstat -v | grep -q if_harp || kldload if_harp
+ load_kld if_harp || return 1
# Load all the NATM drivers that we need
for natm in ${natm_interfaces} ; do
@@ -58,7 +58,7 @@ atm_start()
# Load loadable HARP drivers
for dev in ${atm_load} ; do
- kldstat -v | grep -q ${dev} || kldload ${dev}
+ load_kld ${dev} || return 1
done
# Locate all probed ATM adapters
diff --git a/etc/rc.d/bluetooth b/etc/rc.d/bluetooth
index c48af64..cfcf104 100644
--- a/etc/rc.d/bluetooth
+++ b/etc/rc.d/bluetooth
@@ -36,6 +36,7 @@ name="bluetooth"
rcvar=
start_cmd="bluetooth_start"
stop_cmd="bluetooth_stop"
+required_modules="ng_bluetooth ng_hci ng_l2cap ng_btsocket"
##############################################################################
# Read and parse Bluetooth device configuration file
@@ -231,17 +232,11 @@ bluetooth_start()
dev=$1
- # Automatically load modules
- kldload ng_bluetooth > /dev/null 2>&1
- kldload ng_hci > /dev/null 2>&1
- kldload ng_l2cap > /dev/null 2>&1
- kldload ng_btsocket > /dev/null 2>&1
-
# Try to figure out device type by looking at device name
case "${dev}" in
# sioX - serial/UART Bluetooth device
sio*)
- kldload ng_h4 > /dev/null 2>&1
+ load_kld ng_h4 || return 1
hook="hook"
diff --git a/etc/rc.d/geli b/etc/rc.d/geli
index f642589..253dbab 100644
--- a/etc/rc.d/geli
+++ b/etc/rc.d/geli
@@ -34,20 +34,15 @@
. /etc/rc.subr
name="geli"
+start_precmd='[ -n "$(geli_make_list)" ]'
start_cmd="geli_start"
stop_cmd="geli_stop"
+required_modules="geom_eli:g_eli"
geli_start()
{
devices=`geli_make_list`
- # If there are no devices return before loading geom_eli.ko.
- if [ -z "${devices}" ]; then
- return
- fi
-
- kldstat -q -m g_eli || geli load || err 1 'geom_eli module failed to load.'
-
if [ -z "${geli_tries}" ]; then
if [ -n "${geli_attach_attempts}" ]; then
# Compatibility with rc.d/gbde.
diff --git a/etc/rc.d/hcsecd b/etc/rc.d/hcsecd
index 413b898..c78ce9d 100644
--- a/etc/rc.d/hcsecd
+++ b/etc/rc.d/hcsecd
@@ -14,21 +14,7 @@ name="hcsecd"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
rcvar=`set_rcvar`
-start_precmd="hcsecd_prestart"
-
-hcsecd_prestart()
-{
- if ! kldstat -q -m ng_btsocket ; then
- if kldload ng_btsocket > /dev/null 2>&1 ; then
- info 'ng_btsocket module loaded'
- else
- warn 'ng_btsocket module failed to load'
- return 1
- fi
- fi
-
- return 0
-}
+required_modules="ng_btsocket"
load_rc_config $name
config="${hcsecd_config:-/etc/bluetooth/${name}.conf}"
diff --git a/etc/rc.d/ip6fw b/etc/rc.d/ip6fw
index 6688cbd..b96daec 100644
--- a/etc/rc.d/ip6fw
+++ b/etc/rc.d/ip6fw
@@ -13,21 +13,8 @@
name="ip6fw"
rcvar=`set_rcvar ipv6_firewall`
start_cmd="ip6fw_start"
-start_precmd="ip6fw_prestart"
stop_cmd="${SYSCTL_W} net.inet6.ip6.fw.enable=0"
-
-ip6fw_prestart()
-{
- # Load IPv6 firewall module, if not already loaded
- if ! ${SYSCTL} net.inet6.ip6.fw.enable > /dev/null 2>&1; then
- kldload ipfw && {
- debug 'Kernel IPv6 firewall module loaded.'
- return 0
- }
- warn 'IPv6 firewall kernel module failed to load.'
- return 1
- fi
-}
+required_modules="ipfw"
ip6fw_start()
{
diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter
index 9142ec2..ca9ddc8 100755
--- a/etc/rc.d/ipfilter
+++ b/etc/rc.d/ipfilter
@@ -16,7 +16,7 @@ rcvar=`set_rcvar`
load_rc_config $name
stop_precmd="test -f ${ipfilter_rules} -o -f ${ipv6_ipfilter_rules}"
-start_precmd="ipfilter_prestart"
+start_precmd="$stop_precmd"
start_cmd="ipfilter_start"
stop_cmd="ipfilter_stop"
reload_precmd="$stop_precmd"
@@ -26,35 +26,7 @@ resync_cmd="ipfilter_resync"
status_precmd="$stop_precmd"
status_cmd="ipfilter_status"
extra_commands="reload resync status"
-
-ipfilter_loaded()
-{
- if ! kldstat -v | grep "ipfilter$" > /dev/null 2>&1; then
- return 1
- else
- return 0
- fi
-}
-
-ipfilter_prestart()
-{
- # load ipfilter kernel module if needed
- if ! ipfilter_loaded; then
- if kldload ipl; then
- info 'IP-filter module loaded.'
- else
- err 1 'IP-filter module failed to load.'
- fi
- fi
-
- # check for ipfilter rules
- if [ ! -r "${ipfilter_rules}" ] && [ ! -r "${ipv6_ipfilter_rules}" ]
- then
- warn 'IP-filter: NO IPF RULES'
- return 1
- fi
- return 0
-}
+required_modules="ipl:ipfilter"
ipfilter_start()
{
@@ -111,10 +83,6 @@ ipfilter_reload()
ipfilter_resync()
{
- # Don't resync if ipfilter is not loaded
- if ! ipfilter_loaded; then
- return
- fi
${ipfilter_program:-/sbin/ipf} -y ${ipfilter_flags}
}
diff --git a/etc/rc.d/ipfw b/etc/rc.d/ipfw
index 88eff40..849a62c 100644
--- a/etc/rc.d/ipfw
+++ b/etc/rc.d/ipfw
@@ -14,20 +14,8 @@
name="ipfw"
rcvar="firewall_enable"
start_cmd="ipfw_start"
-start_precmd="ipfw_precmd"
stop_cmd="ipfw_stop"
-
-ipfw_precmd()
-{
- if ! ${SYSCTL} net.inet.ip.fw.enable > /dev/null 2>&1; then
- if ! kldload ipfw; then
- warn unable to load firewall module.
- return 1
- fi
- fi
-
- return 0
-}
+required_modules="ipfw"
ipfw_start()
{
diff --git a/etc/rc.d/ipnat b/etc/rc.d/ipnat
index 4298f8e..d77f6ee 100755
--- a/etc/rc.d/ipnat
+++ b/etc/rc.d/ipnat
@@ -14,31 +14,15 @@
name="ipnat"
rcvar=`set_rcvar`
load_rc_config $name
-start_precmd="ipnat_precmd"
start_cmd="ipnat_start"
stop_cmd="${ipnat_program} -F -C"
reload_cmd="${ipnat_program} -F -C -f ${ipnat_rules}"
extra_commands="reload"
-
-ipnat_precmd()
-{
- # Make sure ipfilter is loaded before continuing
- if ! ${SYSCTL} net.inet.ipf.fr_pass >/dev/null 2>&1; then
- if kldload ipl; then
- info 'IP-filter module loaded.'
- else
- err 1 'IP-filter module failed to load.'
- fi
- fi
- return 0
-}
+required_files="${ipnat_rules}"
+required_modules="ipl:ipfilter"
ipnat_start()
{
- if [ ! -f ${ipnat_rules} ]; then
- warn 'NO IPNAT RULES'
- return 0
- fi
echo "Installing NAT rules."
${ipnat_program} -CF -f ${ipnat_rules} ${ipnat_flags}
}
diff --git a/etc/rc.d/mdconfig b/etc/rc.d/mdconfig
index 5a7fad6..32aba48 100644
--- a/etc/rc.d/mdconfig
+++ b/etc/rc.d/mdconfig
@@ -36,6 +36,8 @@
name="mdconfig"
stop_cmd="mdconfig_stop"
start_cmd="mdconfig_start"
+start_precmd='[ -n "${_mdconfig_list}" ]'
+required_modules="geom_md:g_md"
is_readonly()
{
@@ -83,8 +85,6 @@ init_variables()
err 2 "You need to specify \"-f <file>\" in mdconfig_${_md} for vnode devices"
fi
if [ "${_file}" != "${_file%.uzip}" ]; then
- # Load geom_uzip kernel module if needed
- kldstat -q -m g_uzip || kldload geom_uzip || err 1 "geom_uzip failed to load."
_dev="/dev/${_md}.uzip"
fi
for _i in `df ${_file} 2>/dev/null`; do _fs=${_i}; done
@@ -103,13 +103,6 @@ mdconfig_start()
{
local _md _mp _config _type _dev _file _fs _newfs _fsck_cmd
- # If there are no devices return before loading geom_md.ko.
- if [ -z "${_mdconfig_list}" ]; then
- return
- fi
-
- kldstat -q -m g_md || kldload geom_md || err 1 "geom_md failed to load."
-
for _md in ${_mdconfig_list}; do
init_variables ${_md}
# Create md(4) devices of types swap, malloc and vnode if the
@@ -120,6 +113,9 @@ mdconfig_start()
warn "${_fs} is mounted read-only, skipping ${_md}."
continue
fi
+ if [ "${_file}" != "${_file%.uzip}" ]; then
+ load_kld -m g_uzip geom_uzip || return 3
+ fi
fi
if mdconfig -l -u ${_md} >/dev/null 2>&1; then
err 3 "${_md} already exists"
diff --git a/etc/rc.d/mdconfig2 b/etc/rc.d/mdconfig2
index 7178765..efd26a8 100644
--- a/etc/rc.d/mdconfig2
+++ b/etc/rc.d/mdconfig2
@@ -36,6 +36,8 @@
name="mdconfig2"
stop_cmd="mdconfig2_stop"
start_cmd="mdconfig2_start"
+start_precmd='[ -n "${_mdconfig2_list}" ]'
+required_modules="geom_md:g_md"
is_readonly()
{
@@ -88,8 +90,6 @@ init_variables()
fi
if [ "${_file}" != "${_file%.uzip}" ]; then
- # Load geom_uzip kernel module if needed
- kldstat -q -m g_uzip || kldload geom_uzip || err 1 "geom_uzip failed to load."
_dev="/dev/${_md}.uzip"
fi
for _i in `df ${_file} 2>/dev/null`; do _fs=${_i}; done
@@ -111,13 +111,6 @@ mdconfig2_start()
{
local _md _fs _mp _mounted _dev _config _type _file _owner _perms _files _populate _fsck_cmd _i
- # If there are no devices return before loading geom_md.ko.
- if [ -z "${_mdconfig2_list}" ]; then
- return
- fi
-
- kldstat -q -m g_md || kldload geom_md || err 1 "geom_md failed to load."
-
for _md in ${_mdconfig2_list}; do
init_variables ${_md}
if [ ! -r ${_file} ]; then
@@ -128,6 +121,9 @@ mdconfig2_start()
# non-root partition. Swap and malloc md(4) devices have already
# been created.
if [ "${_type}" = "vnode" -a "${_fs}" != "/" ]; then
+ if [ "${_file}" != "${_file%.uzip}" ]; then
+ load_kld -m g_uzip geom_uzip || return 3
+ fi
if is_readonly ${_fs}; then
warn "${_fs} is mounted read-only, skipping ${_md}."
continue
diff --git a/etc/rc.d/mountcritremote b/etc/rc.d/mountcritremote
index 7800406..15ea27f 100755
--- a/etc/rc.d/mountcritremote
+++ b/etc/rc.d/mountcritremote
@@ -27,11 +27,7 @@ mountcritremote_precmd()
case "`mount -d -a -t nfs 2> /dev/null`" in
*mount_nfs*)
# Handle absent nfs client support
- if ! sysctl vfs.nfs >/dev/null 2>&1; then
- kldload nfsclient || { warn 'nfs mount ' \
- 'requested, but no nfs client in kernel'; \
- return 1; }
- fi
+ load_kld -m nfs nfsclient || return 1
;;
esac
return 0
diff --git a/etc/rc.d/natd b/etc/rc.d/natd
index a99df25..e22353a 100644
--- a/etc/rc.d/natd
+++ b/etc/rc.d/natd
@@ -14,16 +14,10 @@ rcvar=`set_rcvar`
command="/sbin/${name}"
pidfile="/var/run/${name}.pid"
start_precmd="natd_precmd"
+required_modules="ipdivert"
natd_precmd()
{
- if ! ${SYSCTL} net.inet.divert > /dev/null 2>&1; then
- if ! kldload ipdivert; then
- warn unable to load IPDIVERT module.
- return 1
- fi
- fi
-
if [ -n "${natd_interface}" ]; then
dhcp_list="`list_net_interfaces dhcp`"
for ifn in ${dhcp_list}; do
diff --git a/etc/rc.d/nfsclient b/etc/rc.d/nfsclient
index b6d4bf1..4888685 100644
--- a/etc/rc.d/nfsclient
+++ b/etc/rc.d/nfsclient
@@ -12,20 +12,8 @@
name="nfsclient"
rcvar="nfs_client_enable"
start_cmd="nfsclient_start"
-start_precmd="nfsclient_precmd"
stop_cmd="unmount_all"
-
-# Load nfs module if it was not compiled into the kernel
-nfsclient_precmd()
-{
- if ! sysctl vfs.nfs >/dev/null 2>&1; then
- if ! kldload nfsclient; then
- warn 'Could not load nfs client module'
- return 1
- fi
- fi
- return 0
-}
+required_modules="nfsclient:nfs"
nfsclient_start()
{
diff --git a/etc/rc.d/nfsserver b/etc/rc.d/nfsserver
index 76531ff..bfa3f12 100644
--- a/etc/rc.d/nfsserver
+++ b/etc/rc.d/nfsserver
@@ -11,20 +11,9 @@
name="nfsserver"
rcvar="nfs_server_enable"
-start_cmd="nfsserver_start"
+start_cmd=":"
stop_cmd=":"
-
-# Load nfs modules if they were not compiled into the kernel
-nfsserver_start()
-{
- if ! sysctl vfs.nfsrv >/dev/null 2>&1; then
- if ! kldload nfsserver; then
- warn 'Could not load NFS server module'
- return 1
- fi
- fi
- return 0
-}
+required_modules="nfsserver"
load_rc_config $name
run_rc_command "$1"
diff --git a/etc/rc.d/pf b/etc/rc.d/pf
index cf91da3..331fe8e 100644
--- a/etc/rc.d/pf
+++ b/etc/rc.d/pf
@@ -13,7 +13,6 @@
name="pf"
rcvar=`set_rcvar`
load_rc_config $name
-start_precmd="pf_prestart"
start_cmd="pf_start"
stop_cmd="pf_stop"
check_cmd="pf_check"
@@ -22,20 +21,7 @@ resync_cmd="pf_resync"
status_cmd="pf_status"
extra_commands="check reload resync status"
required_files="$pf_rules"
-
-pf_prestart()
-{
- # load pf kernel module if needed
- if ! kldstat -q -m pf ; then
- if kldload pf ; then
- info 'pf module loaded.'
- else
- warn 'pf module failed to load.'
- return 1
- fi
- fi
- return 0
-}
+required_modules="pf"
pf_start()
{
diff --git a/etc/rc.d/pflog b/etc/rc.d/pflog
index 9de6cc3..09a127a 100644
--- a/etc/rc.d/pflog
+++ b/etc/rc.d/pflog
@@ -22,15 +22,7 @@ resync_cmd="pflog_resync"
pflog_prestart()
{
- # load pflog kernel module if needed
- if ! kldstat -q -m pflog; then
- if kldload pflog; then
- info 'pflog module loaded.'
- else
- warn 'pflog module failed to load.'
- return 1
- fi
- fi
+ load_kld pflog || return 1
# set pflog0 interface to up state
if ! ifconfig pflog0 up; then
diff --git a/etc/rc.d/pfsync b/etc/rc.d/pfsync
index 8d49042..e7a0664 100644
--- a/etc/rc.d/pfsync
+++ b/etc/rc.d/pfsync
@@ -14,26 +14,23 @@ rcvar=`set_rcvar`
start_precmd="pfsync_prestart"
start_cmd="pfsync_start"
stop_cmd="pfsync_stop"
+required_modules="pf"
pfsync_prestart()
{
+ # XXX Currently pfsync cannot be a module as it must register
+ # a network protocol in a static kernel table.
+ if ! kldstat -q -m pfsync; then
+ warn "pfsync(4) must be statically compiled in the kernel."
+ return 1
+ fi
+
case "$pfsync_syncdev" in
'')
warn "pfsync_syncdev is not set."
return 1
;;
esac
-
- # load pf kernel module if needed
- if ! kldstat -q -m pf ; then
- if kldload pf ; then
- info "pf module loaded."
- else
- warn "pf module failed to load."
- return 1
- fi
- fi
-
return 0
}
diff --git a/etc/rc.d/sdpd b/etc/rc.d/sdpd
index 4a62264..ccf2257 100644
--- a/etc/rc.d/sdpd
+++ b/etc/rc.d/sdpd
@@ -13,21 +13,7 @@
name="sdpd"
command="/usr/sbin/${name}"
rcvar=`set_rcvar`
-start_precmd="sdpd_prestart"
-
-sdpd_prestart()
-{
- if ! kldstat -q -m ng_btsocket ; then
- if kldload ng_btsocket > /dev/null 2>&1 ; then
- info 'ng_btsocket module loaded'
- else
- warn 'ng_btsocket module failed to load'
- return 1
- fi
- fi
-
- return 0
-}
+required_modules="ng_btsocket"
load_rc_config $name
control="${sdpd_control:-/var/run/sdp}"
diff --git a/etc/rc.d/syscons b/etc/rc.d/syscons
index d9a4e4c..04accbb 100644
--- a/etc/rc.d/syscons
+++ b/etc/rc.d/syscons
@@ -213,7 +213,7 @@ syscons_start()
for i in `kldstat | awk '$5 ~ "^splash_.*$" { print $5 }'`; do
kldunload ${i}
done
- kldstat -v | grep -q _saver || kldload ${saver}_saver
+ load_kld -e _saver ${saver}_saver
;;
esac
diff --git a/etc/rc.d/ugidfw b/etc/rc.d/ugidfw
index 6b47a81..0008c5b 100644
--- a/etc/rc.d/ugidfw
+++ b/etc/rc.d/ugidfw
@@ -12,8 +12,8 @@
name="ugidfw"
rcvar="ugidfw_enable"
start_cmd="ugidfw_start"
-start_precmd="ugidfw_precmd"
stop_cmd="ugidfw_stop"
+required_modules="mac_bsdextended"
ugidfw_load()
{
@@ -22,20 +22,6 @@ ugidfw_load()
fi
}
-ugidfw_precmd()
-{
- if ! sysctl security.mac.bsdextended
- then kldload mac_bsdextended
- if [ "$?" -ne "0" ]
- then warn Unable to load the mac_bsdextended module.
- return 1
- else
- return 0
- fi
- fi
- return 0
-}
-
ugidfw_start()
{
[ -z "${bsdextended_script}" ] && bsdextended_script=/etc/rc.bsdextended
OpenPOWER on IntegriCloud