summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2006-01-10 15:39:39 +0000
committerChristian Heim <phreak@gentoo.org>2006-01-10 15:39:39 +0000
commitced906bbd71781d3e5766c470a18619f27386198 (patch)
tree96ed38ca2bbde50c4cc5f43d1e7eafa80144ccb3 /net-scripts/net.modules.d
parentImporting latest baselayout/trunk changes. This is a merge with revision 1768. (diff)
downloadbaselayout-vserver-ced906bbd71781d3e5766c470a18619f27386198.tar.gz
baselayout-vserver-ced906bbd71781d3e5766c470a18619f27386198.tar.bz2
baselayout-vserver-ced906bbd71781d3e5766c470a18619f27386198.zip
Importing latest baselayout/trunk changes. This merge is based upon revision 1797.
svn path=/baselayout-vserver/trunk/; revision=194
Diffstat (limited to 'net-scripts/net.modules.d')
-rw-r--r--net-scripts/net.modules.d/adsl2
-rw-r--r--net-scripts/net.modules.d/apipa2
-rw-r--r--net-scripts/net.modules.d/arping2
-rw-r--r--net-scripts/net.modules.d/bonding2
-rw-r--r--net-scripts/net.modules.d/bridge10
-rw-r--r--net-scripts/net.modules.d/dhclient2
-rw-r--r--net-scripts/net.modules.d/dhcpcd2
-rw-r--r--net-scripts/net.modules.d/essidnet4
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/dhclient-wrapper5
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/dhcp2
-rw-r--r--net-scripts/net.modules.d/helpers.d/dhcp-state2
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/dhcpcd-wrapper2
-rw-r--r--net-scripts/net.modules.d/helpers.d/functions4
-rw-r--r--net-scripts/net.modules.d/helpers.d/module-loader6
-rw-r--r--net-scripts/net.modules.d/helpers.d/pppd-wrapper2
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/pump-wrapper2
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/udhcpc-wrapper2
-rw-r--r--net-scripts/net.modules.d/iproute21
-rw-r--r--net-scripts/net.modules.d/iwconfig45
-rw-r--r--net-scripts/net.modules.d/wpa_supplicant12
20 files changed, 65 insertions, 46 deletions
diff --git a/net-scripts/net.modules.d/adsl b/net-scripts/net.modules.d/adsl
index facf9fd..5175315 100644
--- a/net-scripts/net.modules.d/adsl
+++ b/net-scripts/net.modules.d/adsl
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/apipa b/net-scripts/net.modules.d/apipa
index 9e6bbfa..6be2858 100644
--- a/net-scripts/net.modules.d/apipa
+++ b/net-scripts/net.modules.d/apipa
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/arping b/net-scripts/net.modules.d/arping
index 110d458..3d178fa 100644
--- a/net-scripts/net.modules.d/arping
+++ b/net-scripts/net.modules.d/arping
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/bonding b/net-scripts/net.modules.d/bonding
index 7b44a5a..7e1cb3d 100644
--- a/net-scripts/net.modules.d/bonding
+++ b/net-scripts/net.modules.d/bonding
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/bridge b/net-scripts/net.modules.d/bridge
index 6780a18..6c77067 100644
--- a/net-scripts/net.modules.d/bridge
+++ b/net-scripts/net.modules.d/bridge
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
@@ -131,22 +131,24 @@ bridge_pre_start() {
if [[ -z ${!ports} && -n ${!briface} ]]; then
ports="${iface}"
iface="${!briface}"
+ else
+ ports="${!ports}"
fi
# Create the bridge if needed
bridge_exists "${iface}" || bridge_create "${iface}"
- if [[ -n ${!ports} ]]; then
+ if [[ -n ${ports} ]]; then
einfo "Adding ports to ${iface}"
eindent
- for i in ${!ports}; do
+ for i in ${ports}; do
interface_exists "${i}" && continue
eerror "interface ${i} does not exist"
return 1
done
- for i in ${!ports}; do
+ for i in ${ports}; do
ebegin "${i}"
bridge_add_port "${iface}" "${i}"
eend $? || return 1
diff --git a/net-scripts/net.modules.d/dhclient b/net-scripts/net.modules.d/dhclient
index 91a751a..c97360a 100644
--- a/net-scripts/net.modules.d/dhclient
+++ b/net-scripts/net.modules.d/dhclient
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/dhcpcd b/net-scripts/net.modules.d/dhcpcd
index b7b942f..ab8f9dc 100644
--- a/net-scripts/net.modules.d/dhcpcd
+++ b/net-scripts/net.modules.d/dhcpcd
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/essidnet b/net-scripts/net.modules.d/essidnet
index fbb8b30..f2bd823 100644
--- a/net-scripts/net.modules.d/essidnet
+++ b/net-scripts/net.modules.d/essidnet
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
@@ -41,7 +41,7 @@ essidnet_pre_start() {
configure_variables "${iface}" "${essid}" "${mac}"
# Backwards compat for old gateway var
- x="gateway_${essid}}"
+ x="gateway_${essid}"
[[ -n ${!x} ]] && gateway="${iface}/${!x}"
veend 0 2>/dev/null
diff --git a/net-scripts/net.modules.d/helpers.d/dhclient-wrapper b/net-scripts/net.modules.d/helpers.d/dhclient-wrapper
index d857b6c..08a9433 100755
--- a/net-scripts/net.modules.d/helpers.d/dhclient-wrapper
+++ b/net-scripts/net.modules.d/helpers.d/dhclient-wrapper
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
@@ -7,6 +7,9 @@
# Instead of writing new functions for dhclient, we simply map their variables
# over to udhcpc style ones and call those scripts!
+[[ -e /etc/dhcp/dhclient-enter-hooks ]] \
+ && ( . /etc/dhcp/dhclient-enter-hooks )
+
case "${reason}" in
BOUND|REBOOT|REBIND) action="bound" ;;
RENEW) action="renew" ;;
diff --git a/net-scripts/net.modules.d/helpers.d/dhcp b/net-scripts/net.modules.d/helpers.d/dhcp
index bb96565..35d6775 100755
--- a/net-scripts/net.modules.d/helpers.d/dhcp
+++ b/net-scripts/net.modules.d/helpers.d/dhcp
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/helpers.d/dhcp-state b/net-scripts/net.modules.d/helpers.d/dhcp-state
index 6c91bea..c5de21f 100644
--- a/net-scripts/net.modules.d/helpers.d/dhcp-state
+++ b/net-scripts/net.modules.d/helpers.d/dhcp-state
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2005 Gentoo Foundation
+# Copyright (c) 2005-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper b/net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper
index f5e5a9c..5769103 100755
--- a/net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper
+++ b/net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2005 Gentoo Foundation
+# Copyright (c) 2005-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/helpers.d/functions b/net-scripts/net.modules.d/helpers.d/functions
index a16cdb7..eebb55d 100644
--- a/net-scripts/net.modules.d/helpers.d/functions
+++ b/net-scripts/net.modules.d/helpers.d/functions
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# We will be loaded after conf.d/rc and conf.d/net so we can set a default
@@ -317,7 +317,7 @@ merge_configs() {
# Selects the best interface to apply state information to
# This is currently based on routing metrics
select_best_interface() {
- local -a ifs=( $(order_interfaces true) )
+ local -a ifs=( $(order_interfaces) )
# Move lo to the back of the pecking order of it's active
local x=" ${ifs[@]} "
diff --git a/net-scripts/net.modules.d/helpers.d/module-loader b/net-scripts/net.modules.d/helpers.d/module-loader
index 3fac7bf..fe6d1df 100644
--- a/net-scripts/net.modules.d/helpers.d/module-loader
+++ b/net-scripts/net.modules.d/helpers.d/module-loader
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
@@ -10,7 +10,9 @@ MODULES_DIR="${svclib}/net.modules.d"
. "${MODULES_DIR}/system"
. "${MODULES_DIR}/helpers.d/functions"
-conf=$(add_suffix "/etc/conf.d/net")
+conf="$(add_suffix /etc/conf.d/net)"
+[[ -e ${conf} ]] && source "${conf}"
+conf="$(add_suffix /etc/conf.d/net.${interface})"
[[ -e ${conf} ]] && source "${conf}"
# Create some dummy functions, so we can depend on a module
diff --git a/net-scripts/net.modules.d/helpers.d/pppd-wrapper b/net-scripts/net.modules.d/helpers.d/pppd-wrapper
index 829d0be..63a868a 100644
--- a/net-scripts/net.modules.d/helpers.d/pppd-wrapper
+++ b/net-scripts/net.modules.d/helpers.d/pppd-wrapper
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2005 Gentoo Foundation
+# Copyright (c) 2005-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/helpers.d/pump-wrapper b/net-scripts/net.modules.d/helpers.d/pump-wrapper
index 2a3dacc..fec705c 100755
--- a/net-scripts/net.modules.d/helpers.d/pump-wrapper
+++ b/net-scripts/net.modules.d/helpers.d/pump-wrapper
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2005 Gentoo Foundation
+# Copyright (c) 2005-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/helpers.d/udhcpc-wrapper b/net-scripts/net.modules.d/helpers.d/udhcpc-wrapper
index ba317e5..3edab95 100755
--- a/net-scripts/net.modules.d/helpers.d/udhcpc-wrapper
+++ b/net-scripts/net.modules.d/helpers.d/udhcpc-wrapper
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
diff --git a/net-scripts/net.modules.d/iproute2 b/net-scripts/net.modules.d/iproute2
index f734e77..cff83e2 100644
--- a/net-scripts/net.modules.d/iproute2
+++ b/net-scripts/net.modules.d/iproute2
@@ -139,6 +139,7 @@ iproute2_del_addresses() {
local pre=""
${2:-false} && pre="-f inet"
ip ${pre} addr flush label "$1" scope global &>/dev/null
+ ip ${pre} addr flush label "$1" scope site &>/dev/null
ip ${pre} addr flush label "$1" scope host &>/dev/null
return 0
}
diff --git a/net-scripts/net.modules.d/iwconfig b/net-scripts/net.modules.d/iwconfig
index 3f1eb22..232cf0a 100644
--- a/net-scripts/net.modules.d/iwconfig
+++ b/net-scripts/net.modules.d/iwconfig
@@ -68,7 +68,8 @@ iwconfig_get_wep_status() {
if [[ -n ${key} ]]; then
status="enabled"
- mode=" - $( iwconfig "$1" | sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p' )"
+ mode="$( iwconfig $1 | sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p' )"
+ [[ -n ${mode} ]] && mode=" - ${mode}"
fi
echo "(WEP ${status}${mode})"
@@ -81,7 +82,7 @@ iwconfig_get_essid() {
local i essid
for (( i=0; i<5; i++ )); do
- essid=$( iwgetid "$1" 2>/dev/null | sed -n -e 's/^.*ESSID:"\(.*\)"$/\1/p' )
+ essid="$( iwgetid $1 2>/dev/null | sed -n -e 's/^.*ESSID:"\(.*\)"$/\1/p' )"
if [[ -n ${essid} ]]; then
echo "${essid}"
return 0
@@ -152,27 +153,34 @@ iwconfig_get_wep_key() {
echo "${!key:-off}"
}
-# void iwconfig_user_config(char *iface)
+# void iwconfig_user_config(char *iface, char *ifvar)
#
# Applies the user configuration to the interface
iwconfig_user_config() {
- local iface="$1" conf ifvar=$( bash_variable "$1" )
+ local iface="$1" conf aconf ifvar="$2"
+ [[ -z ${ifvar} ]] && ifvar=$( bash_variable "$1" )
# Apply the user configuration
conf="iwconfig_${ifvar}"
if [[ -n ${!conf} ]]; then
- if ! eval iwconfig "${iface}" "${!conf}" ; then
- ewarn "${iface} does not support the following configuration commands"
- eval ewarn " ${!conf}"
- fi
+ aconf=( "${!conf} ")
+ for conf in "${aconf[@]}" ; do
+ if ! eval iwconfig "${iface}" "${conf}" ; then
+ ewarn "${iface} does not support the following configuration commands"
+ ewarn " ${conf}"
+ fi
+ done
fi
- conf="iwpriv_${ifvar}"
+ conf="iwpriv_${ifvar}[@]"
if [[ -n ${!conf} ]]; then
- if ! eval iwpriv "${iface}" "${!conf}" ; then
- ewarn "${iface} does not support the following private ioctls"
- ewarn " ${!conf}"
- fi
+ aconf=( "${!conf}" )
+ for conf in "${aconf[@]}" ; do
+ if ! eval iwpriv "${iface}" "${conf}" ; then
+ ewarn "${iface} does not support the following private ioctls"
+ ewarn " ${conf}"
+ fi
+ done
fi
}
@@ -217,6 +225,8 @@ iwconfig_setup_specific() {
fi
fi
+ iwconfig_user_config "${iface}" "${ESSIDVAR}"
+
# Finally set the ESSID
if ! iwconfig "${iface}" essid "${ESSID}" ; then
eerror "${iface} does not support setting ESSID to \"${dessid}\""
@@ -224,7 +234,6 @@ iwconfig_setup_specific() {
fi
iwconfig "${iface}" nick "${ESSID}" 2>/dev/null
- iwconfig_user_config "${iface}"
iwconfig_report "${iface}"
return 0
@@ -331,12 +340,11 @@ iwconfig_associate() {
ESSIDVAR=$( bash_variable "${ESSID}" )
key=$( iwconfig_get_wep_key "${mac}" )
if [[ ${wep_required} == "on" && ${key} == "off" ]]; then
- vewarn "WEP key is not set for \"${dessid}\" - not connecting"
- return 1
+ ewarn "WEP key is not set for \"${dessid}\""
fi
if [[ ${wep_required} == "off" && ${key} != "off" ]]; then
key="off"
- vewarn "\"${dessid}\" is not WEP enabled - ignoring setting"
+ ewarn "\"${dessid}\" is not WEP enabled - ignoring setting"
fi
if ! eval iwconfig "${iface}" key "${key}" ; then
@@ -349,6 +357,8 @@ iwconfig_associate() {
[[ ${key} != "off" ]] && w=$( iwconfig_get_wep_status "${iface}" )
fi
+ iwconfig_user_config "${iface}" "${ESSIDVAR}"
+
if ! iwconfig "${iface}" essid "${ESSID}" ; then
if [[ ${ESSID} != "any" ]]; then
ewarn "${iface} does not support setting ESSID to \"${dessid}\""
@@ -382,7 +392,6 @@ iwconfig_associate() {
return $?
fi
- iwconfig_user_config "${iface}"
iwconfig_report "${iface}"
if is_function postassociate ; then
diff --git a/net-scripts/net.modules.d/wpa_supplicant b/net-scripts/net.modules.d/wpa_supplicant
index 2e0f1c4..8458c0f 100644
--- a/net-scripts/net.modules.d/wpa_supplicant
+++ b/net-scripts/net.modules.d/wpa_supplicant
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (c) 2004-2005 Gentoo Foundation
+# Copyright (c) 2004-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
@@ -58,7 +58,7 @@ wpa_supplicant_get_essid() {
local i essid
for (( i=0; i<5; i++ )); do
- essid=$( wpa_cli -i"$1" status | sed -n -e 's/^ssid=//p' )
+ essid="$( wpa_cli -i$1 status | sed -n -e 's/^ssid=//p' )"
if [[ -n ${essid} ]]; then
echo "${essid}"
return 0
@@ -83,10 +83,11 @@ wpa_supplicant_get_ap_mac_address() {
# Note that just because we are associated does not mean we are using the
# correct encryption keys
wpa_supplicant_associated() {
- local -a status=( "$( wpa_cli -i"$1" status | sed -n -e 's/^\(key_mgmt\|wpa_state\|EAP state\)=\([^=]\+\).*/\U\2/p' )" )
+ local -a status
+ eval status=( $( wpa_cli -i"$1" status | sed -n -e 's/^\(key_mgmt\|wpa_state\|EAP state\)=\([^=]\+\).*/\U\"\2\"/p' ) )
case "${status[0]}" in
- "NONE") [[ ${status[1]} == "ASSOCIATED" ]] ;;
+ "NONE") [[ ${status[1]} == "ASSOCIATED" || ${status[1]} == "COMPLETED" ]] ;;
"IEEE 802.1X (no WPA)") [[ ${status[2]} == "SUCCESS" ]] ;;
*) [[ ${status[1]} == "COMPLETED" ]] ;;
esac
@@ -310,7 +311,8 @@ wpa_supplicant_pre_start() {
ESSIDVAR=$( bash_variable "${ESSID}" )
save_options "ESSID" "${ESSID}"
- local -a status=( "$( wpa_cli -i${iface} status | sed -n -e 's/^\(bssid\|pairwise_cipher\|key_mgmt\)=\([^=]\+\).*/\"\U\2\"/p' | tr '[:lower:]' '[:upper:]' )" )
+ local -a status
+ eval status=( $( wpa_cli -i"${iface}" status | sed -n -e 's/^\(bssid\|pairwise_cipher\|key_mgmt\)=\([^=]\+\).*/\"\U\2\"/p' | tr '[:lower:]' '[:upper:]' ) )
einfo "${iface} connected to \"${ESSID//\\\\/\\\\}\" at ${status[0]}"
if [[ ${status[2]} == "NONE" ]]; then