summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-scripts/init.d/net.lo')
-rwxr-xr-xnet-scripts/init.d/net.lo29
1 files changed, 17 insertions, 12 deletions
diff --git a/net-scripts/init.d/net.lo b/net-scripts/init.d/net.lo
index b9c2352..43bfd46 100755
--- a/net-scripts/init.d/net.lo
+++ b/net-scripts/init.d/net.lo
@@ -16,7 +16,7 @@ depend() {
# Load any custom depend functions for the given interface
# For example, br0 may need eth0 and eth1
- local iface="${myservice##*.}"
+ local iface="${myservice#*.}"
[[ $(type -t "depend_${iface}") == "function" ]] && depend_${iface}
return 0
@@ -25,10 +25,7 @@ depend() {
# Define where our modules are
MODULES_DIR="${svclib}/net.modules.d"
-# Some defaults
-background="${background:-no}"
-
-# Load some functions shared between ourselves and our dhcp helpers
+# Load some functions shared between ourselves and our DHCP helpers
source "${MODULES_DIR}/helpers.d/functions"
# Make some wrappers to fudge after/before/need/use depend flags.
@@ -571,12 +568,11 @@ iface_start() {
# Otherwise a default of NULL
if [[ -z ${config} ]]; then
# if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
+ ewarn "Configuration not set for ${iface} - assuming DHCP"
if is_function "dhcp_start" ; then
config=( "dhcp" )
- ewarn "Configuration not set for ${iface} - assuming dhcp"
else
- eerror "Cannot default to dhcp as there is no dhcp module loaded"
- eerror "No configuration for ${iface}"
+ eerror "No DHCP client installed"
return 1
fi
# else
@@ -621,7 +617,11 @@ iface_start() {
[[ ${x} == "0" ]] && interface_add_address "${iface}" ${conf[@]}; x="$?"
eend "${x}" && config_worked=true && continue
else
- eerror "No loaded modules provide \"${conf[0]}\" (${conf[0]}_start)"
+ if [[ ${conf[0]} == "dhcp" ]] ; then
+ eerror "No DHCP client installed"
+ else
+ eerror "No loaded modules provide \"${conf[0]}\" (${conf[0]}_start)"
+ fi
fi
if [[ -n ${fallback[config_counter]} ]]; then
@@ -855,11 +855,8 @@ run() {
local -a MODULES mods
local IN_BACKGROUND="${IN_BACKGROUND}"
- # No point in backgrounding if we're already there ...
- # This is also required so we can select the "best" interface
if [[ ${IN_BACKGROUND} == "true" || ${IN_BACKGROUND} == "1" ]]; then
IN_BACKGROUND=true
- background=false
else
IN_BACKGROUND=false
fi
@@ -885,6 +882,14 @@ run() {
run_stop "${iface}" && r=0
remove_state "${iface}"
else
+ # Only hotplug on ethernet interfaces
+ if [[ ${IN_HOTPLUG} == 1 ]] ; then
+ if ! interface_is_ethernet "${iface}" ; then
+ eerror "We only hotplug for ethernet interfaces"
+ return 1
+ fi
+ fi
+
run_start "${iface}" && r=0
fi
fi