summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2006-05-02 14:37:46 +0000
committerChristian Heim <phreak@gentoo.org>2006-05-02 14:37:46 +0000
commit195eba806279ebfe643e076704e02aa54bff99a8 (patch)
tree72a2b6eff27167332e4f1daf63c6bfd452ed3ed6 /net-scripts
parentMerging r2014 (diff)
downloadbaselayout-vserver-195eba806279ebfe643e076704e02aa54bff99a8.tar.gz
baselayout-vserver-195eba806279ebfe643e076704e02aa54bff99a8.tar.bz2
baselayout-vserver-195eba806279ebfe643e076704e02aa54bff99a8.zip
Merging baselayout r2022 for branches/rc-scripts_1_6, branches/baselayout-1_12 and trunk
svn path=/baselayout-vserver/trunk/; revision=350
Diffstat (limited to 'net-scripts')
-rw-r--r--net-scripts/conf.d/net.example2
-rw-r--r--net-scripts/net/iwconfig.sh4
-rw-r--r--net-scripts/net/wpa_supplicant.sh34
3 files changed, 21 insertions, 19 deletions
diff --git a/net-scripts/conf.d/net.example b/net-scripts/conf.d/net.example
index f103905..2d62a18 100644
--- a/net-scripts/conf.d/net.example
+++ b/net-scripts/conf.d/net.example
@@ -156,7 +156,7 @@
# To choose wpa_supplicant over iwconfig
#modules=( "wpa_supplicant" )
# To configure wpa_supplicant
-#wpa_supplicant_eth0="-Dprism54" # For Prism54 based cards
+#wpa_supplicant_eth0="-Dwext" # For generic wireless
#wpa_supplicant_ath0="-Dmadwifi" # For Atheros based cards
# Consult wpa_supplicant for more drivers
# By default don't wait for wpa_suppliant to associate and authenticate.
diff --git a/net-scripts/net/iwconfig.sh b/net-scripts/net/iwconfig.sh
index 6cca973..f3b1206 100644
--- a/net-scripts/net/iwconfig.sh
+++ b/net-scripts/net/iwconfig.sh
@@ -60,7 +60,7 @@ iwconfig_check_installed() {
# Checks to see if wireless extensions are enabled on the interface
iwconfig_exists() {
[[ ! -e /proc/net/wireless ]] && return 1
- grep -q "^[ \t]*$1:[ \t]" /proc/net/wireless
+ grep -q "^[ \t]*$1:" /proc/net/wireless
}
# char* iwconfig_get_wep_status(char *interface)
@@ -349,7 +349,7 @@ iwconfig_associate() {
ESSIDVAR="$( bash_variable "${ESSID}" )"
key="$( iwconfig_get_wep_key "${mac}" )"
if [[ ${wep_required} == "on" && ${key} == "off" ]]; then
- eerror "WEP key is not set for \"${dessid}\" - not connecting"
+ ewarn "WEP key is not set for \"${dessid}\" - not connecting"
return 1
fi
if [[ ${wep_required} == "off" && ${key} != "off" ]]; then
diff --git a/net-scripts/net/wpa_supplicant.sh b/net-scripts/net/wpa_supplicant.sh
index 1f54548..4ecff2d 100644
--- a/net-scripts/net/wpa_supplicant.sh
+++ b/net-scripts/net/wpa_supplicant.sh
@@ -9,7 +9,11 @@ wpa_supplicant() {
}
wpa_cli() {
- LC_ALL=C /bin/wpa_cli "$@"
+ if [[ -n ${ctrl_dir} ]] ; then
+ LC_ALL=C /bin/wpa_cli -p "${ctrl_dir}" "$@"
+ else
+ LC_ALL=C /bin/wpa_cli "$@"
+ fi
}
# void wpa_supplicant_depend(void)
@@ -53,7 +57,7 @@ wpa_supplicant_check_installed() {
# Checks to see if wireless extensions are enabled on the interface
wpa_supplicant_exists() {
[[ ! -e /proc/net/wireless ]] && return 1
- grep -q "^[ \t]*$1:[ \t]" /proc/net/wireless
+ grep -q "^[ \t]*$1:" /proc/net/wireless
}
# char* wpa_supplicant_get_essid(char *interface)
@@ -131,14 +135,6 @@ wpa_supplicant_kill() {
start-stop-daemon --stop --exec /sbin/wpa_supplicant \
--pidfile "${pidfile}"
${report} && eend "$?"
- else
- # Support wpa_supplicant-0.3.x
- local pid="$( pgrep -f "^/sbin/wpa_supplicant .* -i${iface}[ ]*$" )"
- if [[ -n ${pid} ]] ; then
- ${report} && ebegin "Stopping wpa_supplicant on ${iface}"
- kill -s TERM "${pid}"
- ${report} && eend 0
- fi
fi
# If wpa_supplicant exits uncleanly, we need to remove the stale dir
@@ -278,13 +274,19 @@ wpa_supplicant_pre_start() {
return 1
fi
+ # Work out where the ctrl_interface dir is if it's not specified
local ctrl_dir="$( sed -n -e 's/[ \t]*#.*//g;s/[ \t]*$//g;s/^ctrl_interface=//p' "${cfgfile}" )"
- if [[ ${ctrl_dir} != "/var/run/wpa_supplicant" ]] ; then
- eerror "${cfgfile} must set"
- eerror " ctrl_interface=/var/run/wpa_supplicant"
- eend 1
- return 1
+ if [[ -z ${ctrl_dir} ]] ; then
+ ctrl_dir="${opts##* -C}"
+ if [[ -n ${ctrl_dir} && ${ctrl_dir} != "${opts}" ]] ; then
+ [[ ${ctrl_dir:0:1} == " " ]] && ctrl_dir="${ctrl_dir# *}"
+ ctrl_dir="${ctrl_dir%% *}"
+ else
+ ctrl_dir="/var/run/wpa_supplicant"
+ opts="${opts} -C${ctrl_dir}"
+ fi
fi
+ save_options ctrl_dir "${ctrl_dir}"
# Some drivers require the interface to be up
interface_up "${iface}"
@@ -314,7 +316,7 @@ wpa_supplicant_pre_start() {
ebegin "Starting wpa_cli on ${iface}"
start-stop-daemon --start --exec /bin/wpa_cli \
--pidfile "/var/run/wpa_cli-${iface}.pid" \
- -- -a"${actfile}" -i"${iface}" \
+ -- -a"${actfile}" -p"${ctrl_dir}" -i"${iface}" \
-P"/var/run/wpa_cli-${iface}.pid" -B
eend "$?" || return 1
fi