Commit f2c3edb1 authored by Jouke Witteveen's avatar Jouke Witteveen
Browse files

Move away from using wpa_actiond

The same functionality is provided by wpa_supplicant, so we do not need
an extra and Arch Linux specific dependency.
parent 162af2a4
......@@ -9,8 +9,8 @@ Optional:
- dhcpcd or dhclient: for DHCP support
- wpa_supplicant: for WPA support
- dialog: for the interactive assistant
- ifplugd: for automatic connection
- wpa_actiond: for automatic connection
- ifplugd: for automatic wired connections
- ppp: for PPP support
For documentation generation:
- asciidoc
......
......@@ -15,7 +15,6 @@ optdepends=('dialog: for the menu based wifi assistant'
'dhcpcd: for DHCP support (or dhclient)'
'wpa_supplicant: for wireless networking support'
'ifplugd: for automatic wired connections through netctl-ifplugd'
'wpa_actiond: for automatic wireless connections through netctl-auto'
'ppp: for PPP connections'
'openvswitch: for Open vSwitch connections'
)
......
......@@ -5,16 +5,17 @@
. "$SUBR_DIR/ip"
export INTERFACE="$1"
export SSID="$2"
export ACTION="$4"
load_profile "$3"
load_interface_config "$INTERFACE"
export ACTION="$2"
PROFILE_FILE="$STATE_DIR/netctl-auto-$INTERFACE.profile"
case $ACTION in
CONNECT)
CONNECTED)
load_profile "$WPA_ID_STR"
load_interface_config "$INTERFACE"
DhcpcdOptions+=" -K -L"
ip_set || exit 1
mkdir -p "$(dirname "$PROFILE_FILE")"
printf '%s' "$Profile" > "$PROFILE_FILE"
# Sandbox the eval
if ! ( do_debug eval "$ExecUpPost" ); then
# Failing ExecUpPost will take the connection down
......@@ -22,20 +23,17 @@ case $ACTION in
exit 1
fi
;;
DISCONNECT)
# Sandbox the eval
if ! ( do_debug eval "$ExecDownPre" ); then
exit 1
DISCONNECTED)
if [[ -s "$PROFILE_FILE" ]]; then
load_profile "$(< "$PROFILE_FILE")"
load_interface_config "$INTERFACE"
rm -f "$PROFILE_FILE"
# Sandbox the eval
if ! ( do_debug eval "$ExecDownPre" ); then
exit 1
fi
ip_unset
fi
ip_unset
;;
LOST|REESTABLISHED)
# Not handled.
exit 0
;;
*)
# ???
exit 1
;;
esac
......
......@@ -6,7 +6,6 @@
. "$SUBR_DIR/rfkill"
. "$SUBR_DIR/wpa"
: ${ACTIOND:=wpa_actiond -p /run/wpa_supplicant}
: ${ACTION_SCRIPT:=$SUBR_DIR/auto.action}
......@@ -193,11 +192,10 @@ list() {
done
}
## Start and generate config file for the WPA supplicant, start wpa_actiond
## Start and generate config file for the WPA supplicant, monitor for changes
# $1: interface
start() {
local interface="$1"
local pidfile="$STATE_DIR/wpa_actiond-$interface.pid"
if interface_is_up "$interface"; then
exit_error "The interface '$interface' is already up"
......@@ -206,12 +204,11 @@ start() {
rf_enable "$interface" "$RFKill" || return 1
fi
local wpa_conf
if ! wpa_conf=$(wpa_make_config_file "$interface"); then
if ! WPAConfigFile=$(wpa_make_config_file "$interface"); then
exit_error "Could not create the configuration file for interface '$interface'"
fi
# Disable p2p to prevent wpa_supplicant from creating another control interface.
echo "p2p_disabled=1" >> "$wpa_conf"
# Disable p2p to prevent wpa_supplicant from creating another control interface
echo "p2p_disabled=1" >> "$WPAConfigFile"
local profile
list_profiles | while IFS= read -r profile; do
......@@ -222,16 +219,16 @@ start() {
is_yes "${ExcludeAuto:-no}" && exit
# Set default and exclude wpa-config as it does not fit this scheme
[[ ${Security:=none} != "wpa-config" ]] || exit
printf '%s\n' "network={" "$(wpa_make_config_block)" "id_str=\"$profile\"" "}" >> "$wpa_conf"
printf '%s\n' "network={" "$(wpa_make_config_block)" "id_str=\"$profile\"" "}" >> "$WPAConfigFile"
report_notice "Included profile '$profile'"
)
done
# Start the WPA supplicant and wpa_actiond
# Start the WPA supplicant and wpa_cli
: ${WPADriver:=nl80211,wext}
WPAOptions+=" -W"
if wpa_start "$interface" "$WPADriver" "$wpa_conf"; then
if $ACTIOND -i "$interface" -P "$pidfile" -a "$ACTION_SCRIPT"; then
if wpa_start "$interface" "$WPADriver" "$WPAConfigFile"; then
if wpa_call "$interface" -B -a "$ACTION_SCRIPT"; then
return 0
fi
wpa_stop "$interface"
......@@ -241,17 +238,16 @@ start() {
return 1
}
## Stop the WPA supplicant and wpa_actiond
## Stop the WPA supplicant, which automatically stops wpa_cli
# $1: interface
stop() {
local interface="$1"
local pidfile="$STATE_DIR/wpa_actiond-$interface.pid"
[[ -e "$pidfile" ]] && kill "$(< "$pidfile")"
timeout_wait 1 '! wpa_is_active "$interface"' || wpa_stop "$interface"
wpa_stop "$interface"
bring_interface_down "$interface"
[[ $RFKill ]] && rf_disable "$interface" "$RFKill"
return 0
if [[ $RFKill ]]; then
rf_disable "$interface" "$RFKill"
fi
}
## Remove WPA supplicant configuration files
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment