3
# Copyright (C) 2006 Debian/Ubuntu wpasupplicant Maintainers
4
# <pkg-wpa-devel@lists.alioth.debian.org>
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License
8
# as published by the Free Software Foundation; either version 2
9
# of the License, or (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# On Debian GNU/Linux systems, the text of the GPL license can be
17
# found in /usr/share/common-licenses/GPL.
19
if [ -n "$IF_WPA_MAINT_DEBUG" ]; then
23
# quit if we're called for the loopback
24
if [ "$IFACE" = lo ]; then
28
# allow wpa_supplicant interface to be specified via wpa-iface
29
# useful for starting wpa_supplicant on one interface of a bridge
30
if [ -n "$IF_WPA_IFACE" ]; then
31
WPA_IFACE="$IF_WPA_IFACE"
37
if [ -f /etc/wpa_supplicant/functions.sh ]; then
38
. /etc/wpa_supplicant/functions.sh
43
# quit if executables are not installed
44
if [ ! -x "$WPA_SUP_BIN" ] || [ ! -x "$WPA_CLI_BIN" ]; then
48
# quit if wpa_action is active
53
# preliminary sanity checks for roaming daemon
54
if [ -n "$IF_WPA_ROAM" ]; then
55
if [ "$METHOD" != "manual" ]; then
56
wpa_msg stderr "wpa-roam can only be used with the \"manual\" inet METHOD"
59
if [ -n "$IF_WPA_MAPPING_SCRIPT" ]; then
60
if ! type "$IF_WPA_MAPPING_SCRIPT" >/dev/null; then
61
wpa_msg stderr "wpa-mapping-script \"$IF_WPA_MAPPING_SCRIPT\" is not valid"
65
if [ -n "$IF_WPA_MAPPING_SCRIPT_PRIORITY" ] && [ -z "$IF_WPA_MAPPING_SCRIPT" ]; then
66
wpa_msg stderr "\"wpa-mapping-script-priority 1\" is invalid without a wpa-mapping-script"
69
IF_WPA_CONF="$IF_WPA_ROAM"
70
WPA_ACTION_SCRIPT="/sbin/wpa_action"
73
# master function; determines if ifupdown.sh should do something or not
74
if [ -n "$IF_WPA_CONF" ] && [ "$IF_WPA_CONF" != "managed" ]; then
75
if [ ! -s "$IF_WPA_CONF" ]; then
76
wpa_msg stderr "cannot read contents of $IF_WPA_CONF"
79
WPA_SUP_CONF_CTRL_DIR=$(sed --quiet \
80
's/[[:space:]]*#.*//g;s/[[:space:]]\+.*$//g;s/^\(ctrl_interface\|DIR\)=\(.*\)/\2/p' "$IF_WPA_CONF")
81
if [ -n "$WPA_SUP_CONF_CTRL_DIR" ]; then
82
WPA_CTRL_DIR="$WPA_SUP_CONF_CTRL_DIR"
84
WPA_SUP_CONF="-c $IF_WPA_CONF -C $WPA_CTRL_DIR"
85
elif set | grep --quiet "^IF_WPA"; then
86
WPA_SUP_CONF="-C $WPA_CTRL_DIR"
96
init_wpa_supplicant || exit 1
97
conf_wpa_supplicant || { kill_wpa_supplicant; exit 1; }
100
init_wpa_cli || { kill_wpa_supplicant; exit 1; }
114
wpa_msg stderr "unknown phase: \"$PHASE\""
121
wpa_msg stderr "unknown mode: \"$MODE\""