summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/8021x1
-rw-r--r--src/connections/ethernet5
-rw-r--r--src/connections/wireless15
-rw-r--r--src/network50
4 files changed, 42 insertions, 29 deletions
diff --git a/src/8021x b/src/8021x
index 0a39e82..8cdf0d5 100644
--- a/src/8021x
+++ b/src/8021x
@@ -169,6 +169,7 @@ make_wpa_config_file() {
# make empty tmp dir with correct permissions, rename it
check_make_state_dir
# create symlink for old compatibility
+ mkdir -p /run/wpa_supplicant
if [ ! -e /var/run/wpa_supplicant ]; then
ln -s /run/wpa_supplicant /var/run
fi
diff --git a/src/connections/ethernet b/src/connections/ethernet
index 3743dc8..9b471bb 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -1,4 +1,9 @@
#! /bin/bash
+# Source file for the 'ethernet' connection
+# ethernet_up $profile
+# ethernet_down $profile
+# ethernet_status
+
. /usr/lib/network/network
report_iproute()
diff --git a/src/connections/wireless b/src/connections/wireless
index 09017e7..7f95c6f 100644
--- a/src/connections/wireless
+++ b/src/connections/wireless
@@ -54,6 +54,9 @@ wireless_up() {
fi
fi
+ report_debug wireless_up stop_wpa "$INTERFACE"
+ stop_wpa "$INTERFACE"
+
# Manually set iwconfig options (DEPRECATED)
if [[ -n "$IWCONFIG" ]]; then
report_warn "The use of IWCONFIG option is deprecated."
@@ -68,12 +71,6 @@ wireless_up() {
none|wep|wpa|wpa-configsection)
echo -e "network={ \n$(make_wpa_config) \n}" >> "$WPA_CONF"
report_debug wireless_up "Configuration generated at $WPA_CONF"
- report_debug wireless_up wpa_reconfigure "$INTERFACE"
- if ! wpa_reconfigure "$INTERFACE"; then
- report_fail "WPA configuration failed!"
- stop_wpa "$INTERFACE"
- return 1
- fi
;;
*)
report_fail "Invalid SECURITY setting: $SECURITY"
@@ -86,6 +83,12 @@ wireless_up() {
report_debug wireless_up ifup
bring_interface up "$INTERFACE" || return 1
+ report_debug wireless_up start_wpa "$INTERFACE" "$WPA_CONF" "$WPA_DRIVER" "$WPA_OPTS"
+ if ! start_wpa "$INTERFACE" "$WPA_CONF" "$WPA_DRIVER" "$WPA_OPTS"; then
+ report_fail "wpa_supplicant did not start, possible configuration error"
+ return 1
+ fi
+
report_debug wireless_up wpa_check
if ! wpa_check "$INTERFACE" "$TIMEOUT"; then
report_fail "WPA Authentication/Association Failed"
diff --git a/src/network b/src/network
index 87c0e77..195c480 100644
--- a/src/network
+++ b/src/network
@@ -2,10 +2,8 @@
. /usr/lib/network/globals
# will load hooks and they in turn will load /etc/rc.d/functions if they need to
-### Profile loading
-##
-# load_profile profile
-# source profile, checking whether it exists and is usable
+## Loads a profile.
+# $1: profile name
load_profile()
{
[[ -z "$1" ]] && return 1
@@ -31,10 +29,11 @@ load_profile()
fi
}
-### Profile up/down
-##
-# all_down
-# take all registered profiles down
+##################
+# Profile up/down
+##################
+
+## Take all registered profiles down.
all_down()
{
for prof in $(find "$STATE_DIR/profiles/" -maxdepth 1 -type f -printf '%f\n'); do
@@ -42,7 +41,7 @@ all_down()
done
}
-# Create the state dir and sub directories if they don't already exist
+## Create the state dir and sub directories if they don't already exist.
check_make_state_dir()
{
[[ ! -d "$STATE_DIR" ]] && mkdir -p "$STATE_DIR"/{interfaces,profiles}
@@ -51,8 +50,9 @@ check_make_state_dir()
done
}
-# interface_suspend interface/all [call_profile_down? default=yes]
-# store a list of running profiles and take them down (unless $2 is "no")
+## Save the list of running profiles and take them down if needed
+# $1: interface name or "all"
+# $2: take associated profiles down (optional, default="yes")
interface_suspend()
{
report_debug interface_suspend "$@"
@@ -72,14 +72,13 @@ interface_suspend()
done
}
-# all_suspend
-# store a list of running profiles and take them down
+## Save the list of all running profiles and take them down
all_suspend() {
interface_suspend all
}
-# all_resume
-# resume suspended interfaces
-# optional arguments: interfaces not to resume (e.g., because they're disabled)
+
+## Restore saved profiles (for resume purposes).
+# $@: a list of interfaces not to resume (e.g., because they're disabled)
all_resume()
{
report_debug all_resume "$@"
@@ -95,9 +94,8 @@ all_resume()
done
}
-# profile_up profile
-# put all profiles up
-#
+## Puts up a profile.
+# $1: the profile name
profile_up()
{
(
@@ -187,9 +185,8 @@ profile_up()
); return $?
}
-# profile_down profile
-# take profile down
-#
+## Puts a profile down.
+# $1: the profile name
profile_down()
{
(
@@ -240,7 +237,9 @@ profile_down()
); return $?
}
-# Check if variable is a member of an array
+## Check if variable is a member of an array
+# $1: the variable to find
+# $2...: the array elements
inarray()
{
local item search="$1"
@@ -253,6 +252,8 @@ inarray()
return 1
}
+## Check if a given quirk is enabled
+# $1: the quirk name
quirk() {
inarray "$1" "${QUIRKS[@]}"
return $?
@@ -349,6 +350,9 @@ is_interface() {
return 0
}
+## Changes a network interface state.
+# $1: up, flush, or down.
+# $2: the interface name
bring_interface()
{
local INTERFACE="$2"