summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/connections/bond2
-rw-r--r--src/lib/connections/ethernet2
-rw-r--r--src/lib/wpa21
3 files changed, 15 insertions, 10 deletions
diff --git a/src/lib/connections/bond b/src/lib/connections/bond
index af95753..c22fc82 100644
--- a/src/lib/connections/bond
+++ b/src/lib/connections/bond
@@ -10,7 +10,7 @@ bond_up() {
report_error "Interface '$Interface' already exists"
return 1
else
- ip link add dev "$Interface" type bond
+ ip link add name "$Interface" type bond
fi
bring_interface_up "$Interface"
diff --git a/src/lib/connections/ethernet b/src/lib/connections/ethernet
index dfd0117..3db69a0 100644
--- a/src/lib/connections/ethernet
+++ b/src/lib/connections/ethernet
@@ -22,7 +22,7 @@ ethernet_up() {
if ! is_yes "${SkipNoCarrier:-no}"; then
# Some cards are plain slow to come up. Don't fail immediately.
if ! timeout_wait "${TimeoutCarrier:-5}" '(( $(< "/sys/class/net/$Interface/carrier") ))'; then
- report_error "No connection on interface '$Interface'"
+ report_error "No connection found on interface '$Interface' (timeout)"
bring_interface_down "$Interface"
return 1
fi
diff --git a/src/lib/wpa b/src/lib/wpa
index ff869db..8804f34 100644
--- a/src/lib/wpa
+++ b/src/lib/wpa
@@ -67,6 +67,11 @@ wpa_start() {
local interface=$1 driver=$2 configuration=$3
local pidfile="/run/wpa_supplicant_$interface.pid"
+ if ! type wpa_supplicant &> /dev/null; then
+ report_error "You need to install 'wpa_supplicant'"
+ return 127
+ fi
+
if [[ $configuration ]]; then
configuration="-c$configuration"
else
@@ -78,7 +83,7 @@ wpa_start() {
"$configuration" $WPAOptions
# Wait up to one second for the pid file to appear
- if ! timeout_wait 1 '[[ -f "$pidfile" ]]'; then
+ if ! timeout_wait 1 '[[ -f $pidfile ]]'; then
# Remove the configuration file if it was generated
configuration="$STATE_DIR/wpa_supplicant_$interface.conf"
[[ -f $configuration && -O $configuration ]] && rm -f "$configuration"
@@ -145,7 +150,7 @@ wpa_supplicant_scan() {
(( spawned_wpa == 1 )) && wpa_stop "$interface"
# File of 0 length: no ssid's
- if [[ ! -s "$essids" ]]; then
+ if [[ ! -s $essids ]]; then
rm -f "$essids"
return 1
fi
@@ -172,11 +177,11 @@ wpa_quote() {
## Hex: 737472696e67 -> string
wpa_unquote() {
local string="$1"
- if [[ ${string:0:1} == '"' && ${string:(-1)} == '"' ]]; then
+ if [[ $string == \"*\" ]]; then
printf "%s" "${string:1:-1}"
- elif [[ "$string" =~ ^([[:xdigit:]]{2})+$ ]]; then
- while [[ -n "$string" ]]; do
- printf "\x"${string:0:2}
+ elif [[ $string == +([[:xdigit:]][[:xdigit:]]) ]]; then
+ while [[ $string ]]; do
+ printf "\x${string:0:2}"
string=${string:2}
done
else
@@ -218,7 +223,7 @@ wpa_make_config_block() {
wep)
echo "key_mgmt=NONE"
echo "wep_tx_keyidx=0"
- if (( ${#Key} % 2 == 0 )) && [[ "$Key" = +([[:xdigit:]]) ]]; then
+ if [[ $Key == +([[:xdigit:]][[:xdigit:]]) ]]; then
echo "wep_key0=$Key"
else
echo "wep_key0=$(wpa_quote "$Key")"
@@ -226,7 +231,7 @@ wpa_make_config_block() {
;;
wpa)
echo "proto=RSN WPA"
- if [[ "${#Key}" -eq 64 && "$Key" = +([[:xdigit:]]) ]]; then
+ if [[ "${#Key}" -eq 64 && $Key == +([[:xdigit:]]) ]]; then
echo "psk=$Key"
else
echo "psk=$(wpa_quote "$Key")"