summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog26
-rwxr-xr-xnet-scripts/init.d/net.lo4
-rw-r--r--net-scripts/net/dhclient.sh2
-rw-r--r--net-scripts/net/dhcpcd.sh13
-rw-r--r--net-scripts/net/ifconfig.sh39
-rw-r--r--net-scripts/net/iwconfig.sh50
-rw-r--r--sbin/rc-daemon.sh12
7 files changed, 92 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index b1f8b7e..a520705 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,32 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2
+ 15 Aug 2006; Roy Marples <uberlord@gentoo.org>:
+
+ Fix start-stop-daemon using the --name option
+ #143951 thanks to Dustin J. Mitchell
+
+ Support old gateway variable with iproute2.
+ arpinging of available address can be disabled with
+ modules=( "!arping" )
+
+ 14 Aug 2006; Roy Marples <uberlord@gentoo.org>:
+
+ Only send a process the TERM signal once, #141832
+
+ Set frequency, channel and ap after ESSID, #143716 thanks to damage.
+
+ 13 Aug 2006; Roy Marples <uberlord@gentoo.org>:
+
+ Remove silly dhcpcd version check. Drop -o from dhcpcd options as
+ all dhcpcd versions in portage have been patches to not bring the interface
+ down and future versions may not support that option as they won't bring
+ the interface down at all.
+
+ Fix frequency parsing and add channel parsing to iwconfig, #143698
+
+ Start dhclient on the right interface, #130670 thanks to Petr Svoboda.
+
04 Aug 2006; Roy Marples <uberlord@gentoo.org>:
Add bootchart suppport, #74425 and #141114. Thanks to Paul Pacheco.
diff --git a/net-scripts/init.d/net.lo b/net-scripts/init.d/net.lo
index cab348d..22e0616 100755
--- a/net-scripts/init.d/net.lo
+++ b/net-scripts/init.d/net.lo
@@ -698,7 +698,7 @@ iface_start() {
if [[ -z ${config} ]] ; then
interface_get_old_config "${iface}" || return 1
if [[ -n ${config} ]] ; then
- ewarn "You are using a depreciated configuration syntax for ${iface}"
+ ewarn "You are using a deprecated configuration syntax for ${iface}"
ewarn "You are advised to read /etc/conf.d/net.example and upgrade it accordingly"
fi
fi
@@ -754,7 +754,7 @@ iface_start() {
elif [[ ${conf[0]:0:1} == [[:digit:]] || ${conf[0]} == *:* ]] ; then
x="0"
if ! is_loopback "${iface}" ; then
- if is_function arping_address_exists ; then
+ if [[ " ${MODULES[@]} " == *" arping "* ]] ; then
if arping_address_exists "${iface}" "${conf[0]}" ; then
eerror "${conf[0]%%/*} already taken on ${iface}"
x="1"
diff --git a/net-scripts/net/dhclient.sh b/net-scripts/net/dhclient.sh
index 10dfa59..d3b6196 100644
--- a/net-scripts/net/dhclient.sh
+++ b/net-scripts/net/dhclient.sh
@@ -106,7 +106,7 @@ dhclient_start() {
# Bring up DHCP for this interface (or alias)
ebegin "Running dhclient"
echo -e "${dhconf}" | start-stop-daemon --start --exec /sbin/dhclient \
- --pidfile "${pidfile}" -- ${opts} -q -1 -pf "${pidfile}"
+ --pidfile "${pidfile}" -- ${opts} -q -1 -pf "${pidfile}" "${iface}"
eend $? || return 1
# DHCP succeeded, show address retrieved
diff --git a/net-scripts/net/dhcpcd.sh b/net-scripts/net/dhcpcd.sh
index 6e6055d..ce0883a 100644
--- a/net-scripts/net/dhcpcd.sh
+++ b/net-scripts/net/dhcpcd.sh
@@ -23,15 +23,7 @@ dhcpcd_expose() {
#
# Returns 1 if dhcpcd is installed, otherwise 0
dhcpcd_check_installed() {
- if [[ -x /sbin/dhcpcd ]]; then
- if dhcpcd -h 2>&1 | grep -q "etcDir" ; then
- return 0
- else
- ${1:-false} && eerror "We require dhcpcd-2.0.0 or newer"
- return 1
- fi
- fi
-
+ [[ -x /sbin/dhcpcd ]] && return 0
${1:-false} && eerror "For DHCP (dhcpcd) support, emerge net-misc/dhcpcd"
return 1
}
@@ -93,9 +85,6 @@ dhcpcd_start() {
&& opts="-h \"${hname}\" ${opts}"
fi
- # Stop dhcpcd from bringing the interface down when we exit
- opts="${opts} -o"
-
# Add our route metric
metric="metric_${ifvar}"
[[ -n ${!metric} && ${!metric} != "0" ]] && opts="${opts} -m ${!metric}"
diff --git a/net-scripts/net/ifconfig.sh b/net-scripts/net/ifconfig.sh
index ddae01a..0fad6de 100644
--- a/net-scripts/net/ifconfig.sh
+++ b/net-scripts/net/ifconfig.sh
@@ -238,7 +238,7 @@ ifconfig_get_old_config() {
local -a aliases=() broadcasts=() netmasks=()
# Start with the primary interface
- config=( ${!i} )
+ config=( "${!i}" )
# ..then add aliases
aliases="alias_${ifvars}"
@@ -258,6 +258,24 @@ ifconfig_get_old_config() {
# Add inet6 addresses to our config if required
[[ -n ${inet6} ]] && config=( "${config[@]}" "${inet6[@]}" )
+ # BACKWARD COMPATIBILITY: set the default gateway
+ if [[ ${gateway} == "${iface}/"* ]]; then
+ i="routes_${ifvar}[@]"
+ local -a routes=( "${!i}" )
+
+ # We don't add the old gateway if one has been set in routes_IFACE
+ local gw=true
+ for i in "${routes[@]}"; do
+ [[ ${i} != *"default gw"* ]] && continue
+ gw=false
+ break
+ done
+
+ if ${gw} ; then
+ eval "routes_${ifvar}=( \"default gw \${gateway#*/}\" \"\${routes[@]}\" )"
+ fi
+ fi
+
return 0
}
@@ -311,7 +329,8 @@ ifconfig_pre_start() {
# fail, the routine should still return success to indicate that
# net.eth0 was successful
ifconfig_post_start() {
- local iface="$1" ifvar=$(bash_variable "$1") routes= x= metric= mtu= cidr=
+ local iface="$1" ifvar=$(bash_variable "$1") x= metric= mtu= cidr=
+ local -a routes=()
metric="metric_${ifvar}"
ifconfig_exists "${iface}" || return 0
@@ -323,20 +342,8 @@ ifconfig_post_start() {
mtu="mtu_${ifvar}"
[[ -n ${!mtu} ]] && ifconfig "${iface}" mtu "${!mtu}"
- routes="routes_${ifvar}[@]"
- routes=( "${!routes}" )
-
- # BACKWARD COMPATIBILITY: set the default gateway
- if [[ ${gateway} == "${iface}/"* ]]; then
- # We don't add the old gateway if one has been set in routes_IFACE
- local gw=true
- for x in "${routes[@]}"; do
- [[ ${x} != *"default gw"* ]] && continue
- gw=false
- break
- done
- ${gw} && routes=( "${routes[@]}" "default gw ${gateway#*/}" )
- fi
+ x="routes_${ifvar}[@]"
+ routes=( "${!x}" )
[[ -z ${routes} ]] && return 0
diff --git a/net-scripts/net/iwconfig.sh b/net-scripts/net/iwconfig.sh
index 9e31cda..fcf9ed2 100644
--- a/net-scripts/net/iwconfig.sh
+++ b/net-scripts/net/iwconfig.sh
@@ -222,14 +222,6 @@ iwconfig_setup_specific() {
iwconfig_set_mode "${iface}" "${mode}"
- channel="channel_${ifvar}"
- # We default the channel to 3
- channel="${!channel:-3}"
- if ! iwconfig "${iface}" channel "${channel}" ; then
- ewarn "${iface} does not support setting the channel to \"${channel}\""
- return 1
- fi
-
# Now set the key
if ! iwconfig "${iface}" key ${key} ; then
if [[ ${key} != "off" ]]; then
@@ -244,6 +236,13 @@ iwconfig_setup_specific() {
return 1
fi
+ channel="channel_${ifvar}"
+ # We default the channel to 3
+ if ! iwconfig "${iface}" channel "${!channel:-3}" ; then
+ ewarn "${iface} does not support setting the channel to \"${!channel:-3}\""
+ return 1
+ fi
+
# Finally apply the user Config
iwconfig_user_config "${iface}" "${ESSIDVAR}"
@@ -347,7 +346,7 @@ iwconfig_wait_for_association() {
# so we can fail gracefully without even trying to connect
iwconfig_associate() {
local iface="$1" mode="${2:-managed}"
- local mac="$3" wep_required="$4" freq="$5" w="(WEP Disabled)"
+ local mac="$3" wep_required="$4" freq="$5" chan="$6" w="(WEP Disabled)"
local dessid="${ESSID//\\\\/\\\\}" key=
iwconfig_set_mode "${iface}" "${mode}"
@@ -378,15 +377,20 @@ iwconfig_associate() {
[[ ${key} != "off" ]] && w=$(iwconfig_get_wep_status "${iface}")
fi
- [[ -n ${freq} ]] && iwconfig "${iface}" freq "${freq}"
- [[ -n ${mac} ]] && iwconfig "${iface}" ap "${mac}"
-
if ! iwconfig "${iface}" essid "${ESSID}" ; then
if [[ ${ESSID} != "any" ]]; then
ewarn "${iface} does not support setting ESSID to \"${dessid}\""
fi
fi
+ # Only use channel or frequency
+ if [[ -n ${chan} ]] ; then
+ iwconfig "${iface}" channel "${chan}"
+ elif [[ -n ${freq} ]] ; then
+ iwconfig "${iface}" freq "${freq}"
+ fi
+ [[ -n ${mac} ]] && iwconfig "${iface}" ap "${mac}"
+
# Finally apply the user Config
iwconfig_user_config "${iface}" "${ESSIDVAR}"
@@ -453,7 +457,7 @@ iwconfig_scan() {
[[ -z ${!x} || ${!x} -gt 0 ]] && sleep "${!x:-1}"
local error=true i=-1 line=
- local -a mac=() essid=() enc=() qual=() mode=()
+ local -a mac=() essid=() enc=() qual=() mode=() freq=() chan=()
while read line; do
error=false
@@ -476,6 +480,12 @@ iwconfig_scan() {
;;
*Frequency:*)
freq[i]="${line#*:}"
+ x="${freq[i]#* }"
+ freq[i]="${freq[i]%% *}${x:0:1}"
+ ;;
+ *Channel:*)
+ chan[i]="${line#*:}"
+ chan[i]="${chan[i]%% *}"
;;
*Quality*)
qual[i]="${line#*:}"
@@ -533,6 +543,7 @@ iwconfig_scan() {
unset mode[y]
unset enc[y]
unset freq[y]
+ unset chan[y]
fi
done
done
@@ -542,6 +553,7 @@ iwconfig_scan() {
mode=( "${mode[@]}" )
enc=( "${enc[@]}" )
freq=( "${freq[@]}" )
+ chan=( "${chan[@]}" )
for (( i=0; i<${#mac[@]}; i++ )); do
# Don't like ad-hoc nodes by default
@@ -557,6 +569,7 @@ iwconfig_scan() {
mode_APs[i]="${mode[${sortline[x]}]}"
enc_APs[i]="${enc[${sortline[x]}]}"
freq_APs[i]="${freq[${sortline[x]}]}"
+ chan_APs[i]="${chan[${sortline[x]}]}"
done
return 0
@@ -629,6 +642,7 @@ iwconfig_scan_report() {
unset mac_APs[i]
unset enc_APs[i]
unset freq_APs[i]
+ unset chan_APs[i]
done
# We need to squash our arrays so indexes work again
@@ -637,6 +651,7 @@ iwconfig_scan_report() {
mac_APs=( "${mac_APs[@]}" )
enc_APs=( "${enc_APs[@]}" )
freq_APs=( "${freq_APs[@]}" )
+ chan_APs=( "${chan_APs[@]}" )
}
# bool iwconfig_force_preferred(char *iface)
@@ -679,7 +694,7 @@ iwconfig_connect_preferred() {
if [[ ${essid} == "${essid_APs[i]}" ]]; then
ESSID="${essid}"
iwconfig_associate "${iface}" "${mode_APs[i]}" "${mac_APs[i]}" \
- "${enc_APs[i]}" "${freq_APs[i]}" && return 0
+ "${enc_APs[i]}" "${freq_APs[i]}" "${chan_APs[i]}" && return 0
break
fi
done
@@ -706,7 +721,7 @@ iwconfig_connect_not_preferred() {
if ! ${has_preferred} ; then
ESSID="${essid_APs[i]}"
iwconfig_associate "${iface}" "${mode_APs[i]}" "${mac_APs[i]}" \
- "${enc_APs[i]}" "${freq_APs[i]}" && return 0
+ "${enc_APs[i]}" "${freq_APs[i]}" "${chan_APs[i]}" && return 0
fi
done
@@ -751,12 +766,14 @@ iwconfig_strip_associated() {
unset mac_APs[j]
unset enc_APs[j]
unset freq_APs[j]
+ unset chan_APs[j]
# We need to squash our arrays so that indexes work
essid_APs=( "${essid_APs[@]}" )
mode_APs=( "${mode_APs[@]}" )
mac_APs=( "${mac_APs[@]}" )
enc_APs=( "${enc_APs[@]}" )
freq_APs=( "${freq_APs[@]}" )
+ chan_APs=( "${chan_APs[@]}" )
break
fi
done
@@ -780,7 +797,8 @@ iwconfig_strip_associated() {
# variables for the ESSID
iwconfig_configure() {
local iface="$1" e= x= ifvar=$(bash_variable "$1")
- local -a essid_APs=() mac_APs=() mode_APs=() enc_APs=() freq_APs=()
+ local -a essid_APs=() mac_APs=() mode_APs=()
+ local -a enc_APs=() freq_APs=() chan_APs=()
ESSID="essid_${ifvar}"
ESSID="${!ESSID}"
diff --git a/sbin/rc-daemon.sh b/sbin/rc-daemon.sh
index 58b0fe0..29698f3 100644
--- a/sbin/rc-daemon.sh
+++ b/sbin/rc-daemon.sh
@@ -86,15 +86,13 @@ rc_shift_args() {
#
# Setup our vars based on the start-stop-daemon command
rc_setup_daemon_vars() {
- local name i
- local -a sargs=( "${args%% \'--\' *}" )
- local -a eargs
- local x="${args// \'--\' /}"
+ local -a sargs=( "${args%% \'--\' *}" ) eargs=()
+ local x="${args// \'--\' /}" i=
[[ ${x} != "${args}" ]] && eargs=( "${args##* \'--\' }" )
eval rc_shift_args "${sargs[@]}"
- [[ -z ${cmd} ]] && cmd="${name}"
+ [[ -n ${name} ]] && cmd="${name}"
# We may want to launch the daemon with a custom command
# This is mainly useful for debugging with apps like valgrind, strace
@@ -155,7 +153,7 @@ rc_try_kill_pid() {
${e} || return 0
fi
else
- kill -s "${signal}" "${pid}" 2>/dev/null
+ [[ ${i} == "0" ]] && kill -s "${signal}" "${pid}" 2>/dev/null
[[ ! -d "/proc/${pid}" ]] && return 0
fi
LC_ALL=C /bin/sleep "${s}"
@@ -354,7 +352,7 @@ update_service_status() {
# how we are called
start-stop-daemon() {
local args="$( requote "$@" )" result i
- local cmd pidfile pid stopping signal nothing=false
+ local cmd name pidfile pid stopping signal nothing=false
local daemonfile=
local -a RC_DAEMONS=() RC_PIDFILES=()