summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile31
-rw-r--r--NEWS10
-rw-r--r--config/netcfg12
-rw-r--r--docs/examples/bonding9
-rw-r--r--docs/examples/wireless-wpa5
-rw-r--r--docs/netcfg-profiles.txt21
-rw-r--r--docs/netcfg.txt4
-rwxr-xr-xrc.d/net-auto-wired (renamed from ifplugd/net-auto-wired)39
-rwxr-xr-xrc.d/net-auto-wireless (renamed from wpa_actiond/net-auto-wireless)0
-rwxr-xr-xrc.d/net-profiles (renamed from scripts/net-profiles)1
-rwxr-xr-xrc.d/net-rename (renamed from scripts/net-rename)0
-rw-r--r--scripts/ifplugd.action (renamed from ifplugd/netcfg.action)2
-rwxr-xr-xscripts/netcfg2
-rwxr-xr-xscripts/netcfg-wpa_actiond (renamed from wpa_actiond/netcfg-wpa_actiond)3
-rwxr-xr-xscripts/netcfg-wpa_actiond-action (renamed from wpa_actiond/netcfg-wpa_actiond-action)0
-rwxr-xr-xscripts/wifi-menu260
-rw-r--r--src/8021x32
-rw-r--r--src/connections/bond6
-rw-r--r--src/connections/ethernet31
-rw-r--r--src/connections/wireless5
-rw-r--r--systemd/net-auto-wired.service (renamed from ifplugd/net-auto-wired.service)1
-rw-r--r--systemd/net-auto-wireless.service (renamed from wpa_actiond/net-auto-wireless.service)4
22 files changed, 427 insertions, 51 deletions
diff --git a/Makefile b/Makefile
index 711c9e9..e736d94 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,12 @@
DESTDIR=
-VERSION=2.6.7
+VERSION=2.7
VPATH = doc
.PHONY: install docs
install:
# Configuration files
- install -d $(DESTDIR)/etc/network.d/{examples,hooks,interfaces}
+ install -d $(DESTDIR)/etc/network.d/{examples,interfaces}
install -D -m644 config/netcfg $(DESTDIR)/etc/conf.d/netcfg
install -m644 config/iftab $(DESTDIR)/etc/iftab
install -m644 docs/examples/* $(DESTDIR)/etc/network.d/examples/
@@ -24,16 +24,29 @@ install:
# Hooks
install -m755 src/hooks/* ${DESTDIR}/usr/lib/network/hooks/
# Scripts
- install -Dm755 scripts/netcfg $(DESTDIR)/usr/bin/netcfg2
+ install -d $(DESTDIR)/usr/bin
+ install -m755 scripts/netcfg $(DESTDIR)/usr/bin/netcfg2
ln -s netcfg2 $(DESTDIR)/usr/bin/netcfg
- install -Dm755 scripts/netcfg-menu $(DESTDIR)/usr/bin/netcfg-menu
- install -m755 wpa_actiond/netcfg-wpa_actiond{,-action} ifplugd/net-auto-wired $(DESTDIR)/usr/bin
- install -Dm755 ifplugd/netcfg.action $(DESTDIR)/etc/ifplugd/netcfg.action
+ install -m755 \
+ scripts/netcfg-menu \
+ scripts/netcfg-wpa_actiond \
+ scripts/netcfg-wpa_actiond-action \
+ scripts/wifi-menu \
+ $(DESTDIR)/usr/bin
+ install -Dm755 scripts/ifplugd.action $(DESTDIR)/etc/ifplugd/netcfg.action
# Daemons
install -d $(DESTDIR)/etc/rc.d
- install -m755 scripts/net-{profiles,rename} wpa_actiond/net-auto-wireless ifplugd/net-auto-wired $(DESTDIR)/etc/rc.d
+ install -m755 \
+ rc.d/net-profiles \
+ rc.d/net-rename \
+ rc.d/net-auto-wireless \
+ rc.d/net-auto-wired \
+ $(DESTDIR)/etc/rc.d
install -d $(DESTDIR)/lib/systemd/system
- install -m644 wpa_actiond/net-auto-wireless.service ifplugd/net-auto-wired.service $(DESTDIR)/lib/systemd/system
+ install -m644 \
+ systemd/net-auto-wireless.service \
+ systemd/net-auto-wired.service \
+ $(DESTDIR)/lib/systemd/system
# Shell Completion
install -Dm644 contrib/bash-completion $(DESTDIR)/etc/bash_completion.d/netcfg
install -Dm644 contrib/zsh-completion $(DESTDIR)/usr/share/zsh/site-functions/_netcfg
@@ -57,7 +70,7 @@ tarball: docs
sed -i "s/NETCFG_VER=.*/NETCFG_VER=$(VERSION)/g" scripts/netcfg
rm -rf netcfg-$(VERSION)
mkdir -p netcfg-$(VERSION)
- cp -r docs config src scripts src-wireless ifplugd wpa_actiond contrib Makefile LICENSE README netcfg-$(VERSION)
+ cp -r docs config rc.d src scripts src-wireless systemd contrib Makefile LICENSE README netcfg-$(VERSION)
tar -zcvf netcfg-$(VERSION).tar.gz netcfg-$(VERSION)
rm -rf netcfg-$(VERSION)
diff --git a/NEWS b/NEWS
index 75336ec..c054718 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,13 @@
+version 2.7
+- add support for tunnel interfaces
+- add support for interface bonding (FS#24802)
+- add support for hexadecimal ESSIDs (FS#24333)
+
+version 2.6.8
+- fix broken 802.11 in non-wireless setups (FS#25473)
+- fix rfkill errors in net-auto-wireless (FS#25514)
+- fix error message about non-existing net.ipv6.conf... (FS#25530)
+
version 2.6.7
- fix wrong quoting of $profile (FS#25362)
- fix wrong parsing of wpa_supplicant configuration (FS#25464)
diff --git a/config/netcfg b/config/netcfg
index 055a87d..9bee668 100644
--- a/config/netcfg
+++ b/config/netcfg
@@ -1,4 +1,14 @@
-## Define to the name of your wireless interface for net-auto-wireless
+# Enable these netcfg profiles at boot-up.
+# - set to 'menu' to present a menu during boot-up (dialog package required)
+# - prefix an entry with a ! to disable it
+# Network profiles are found in /etc/network.d
+#
+#NETWORKS=(menu)
+
+## Specify the name of your wired interface for net-auto-wired
+WIRED_INTERFACE="eth0"
+
+## Specify the name of your wireless interface for net-auto-wireless
WIRELESS_INTERFACE="wlan0"
## List of profiles that can be started by net-auto-wireless
diff --git a/docs/examples/bonding b/docs/examples/bonding
new file mode 100644
index 0000000..7b70d46
--- /dev/null
+++ b/docs/examples/bonding
@@ -0,0 +1,9 @@
+CONNECTION="bond"
+DESCRIPTION='Bond Interface'
+INTERFACE='bond0'
+IP='static'
+ADDR="10.0.0.1"
+NETMASK="255.0.0.0"
+BOND_INTERFACES=("eth0" "eth2")
+SKIPNOCARRIER="yes"
+
diff --git a/docs/examples/wireless-wpa b/docs/examples/wireless-wpa
index 20f5509..e2511f3 100644
--- a/docs/examples/wireless-wpa
+++ b/docs/examples/wireless-wpa
@@ -2,8 +2,13 @@ CONNECTION='wireless'
DESCRIPTION='A simple WPA encrypted wireless connection'
INTERFACE='wlan0'
SECURITY='wpa'
+
ESSID='MyNetwork'
+## Uncomment if the supplied ESSID is hexadecimal
+#ESSID_TYPE='hex'
KEY='WirelessKey'
+
IP='dhcp'
+
# Uncomment this if your ssid is hidden
#HIDDEN=yes
diff --git a/docs/netcfg-profiles.txt b/docs/netcfg-profiles.txt
index 5e11076..2aa7653 100644
--- a/docs/netcfg-profiles.txt
+++ b/docs/netcfg-profiles.txt
@@ -1,7 +1,7 @@
-% NETCFG-PROFILES(5) netcfg 2.6.7 | Arch Linux
+% NETCFG-PROFILES(5) netcfg 2.6.8 | Arch Linux
% Rémy Oudompheng <remy@archlinux.org>
James Rayner <james@archlinux.org>
-% 8 August 2011
+% 14 August 2011
NAME
====
@@ -42,6 +42,8 @@ ethernet
wireless
: Wireless connection, with **wpa_supplicant**(1) as configuration
back-end.
+bond
+: Bonded network interfaces using **ifenslave**.
bridge
: Network bridge setup using **brctl**(8).
tuntap
@@ -159,7 +161,12 @@ SECURITY (required for security of 'wep', 'wpa', 'wpa-configsection' or 'wpa-con
KEY (required for SECURITY of 'wpa' or 'wep' only)
: Wireless encryption key.
ESSID (this or AP is required)
-: Name of network to connect to.
+: Name of network to connect to, or hexadecimal digits (see
+ 'ESSID_TYPE')
+ESSID_TYPE (optional, defaults to 'ascii')
+: Set to 'ascii' or 'hex', if set to 'hex', ESSID will be interpreted
+ as an hexadecimal SSID and written unquoted to the wpa_supplicant
+ configuration file.
AP (this or ESSID is required)
: AP (BSSID) of the network to connect to.
HIDDEN (optional)
@@ -257,6 +264,14 @@ LOCAL
REMOTE
: The address of the remote end of the tunnel.
+Options for 'bond' connections
+==============================
+
+Standard 'ethernet' options apply for IP configuration.
+
+SLAVE_INTERFACES (Bash array)
+: An array of names of interfaces to be bound together.
+
Options for 'openvpn' connections
================================
diff --git a/docs/netcfg.txt b/docs/netcfg.txt
index e85abd8..0cb4408 100644
--- a/docs/netcfg.txt
+++ b/docs/netcfg.txt
@@ -1,7 +1,7 @@
-% NETCFG(8) netcfg 2.6.7 | Arch Linux
+% NETCFG(8) netcfg 2.6.8 | Arch Linux
% Rémy Oudompheng <remy@archlinux.org>
James Rayner <james@archlinux.org>
-% July 2011
+% 2011-08-14
NAME
====
diff --git a/ifplugd/net-auto-wired b/rc.d/net-auto-wired
index 9af8505..21f487d 100755
--- a/ifplugd/net-auto-wired
+++ b/rc.d/net-auto-wired
@@ -2,12 +2,20 @@
. /etc/rc.conf
. /etc/rc.d/functions
+. /usr/lib/network/globals
+. /etc/conf.d/netcfg
if [[ ! -x /usr/sbin/ifplugd ]]; then
echo "Please install 'ifplugd' to use net-auto-wired"
exit 1
fi
+if [ -z "${WIRED_INTERFACE}" ]; then
+ echo "No interface name set. Add to /etc/conf.d/netcfg a line"
+ echo " WIRED_INTERFACE=\"your_interface\""
+ exit 1
+fi
+
CFG=/etc/ifplugd/ifplugd.conf
ACTION=/etc/ifplugd/netcfg.action
PIDFILE=/var/run/ifplugd.$WIRED_INTERFACE.pid
@@ -18,35 +26,40 @@ PIDFILE=/var/run/ifplugd.$WIRED_INTERFACE.pid
case "$1" in
start)
+ if ! ck_daemon net-auto-wired; then
+ exit_stderr "net-auto-wired has already been started: try \"/etc/rc.d/net-auto-wired restart\""
+ fi
stat_busy "Starting netcfg auto-wired mode for interface ${WIRED_INTERFACE}"
A="`eval echo \$\{ARGS_${WIRED_INTERFACE}\}`"
[ -z "$A" ] && A="$ARGS"
[ -z "$PID" ] && /usr/sbin/ifplugd -i $WIRED_INTERFACE -r $ACTION $A
# ifplugd may return non-zero, but still succeed if -w is passed, as default in upstream config.
sleep 1
- if [[ ! -f $PIDFILE ]]; then
- stat_fail
- else
+ if [[ -f $PIDFILE ]]; then
add_daemon net-auto-wired
stat_done
+ else
+ stat_fail
fi
;;
stop)
- stat_busy "Stopping netcfg auto-wired mode for interface ${WIRED_INTERFACE}"
- [ -n "$PID" ] && /usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon net-auto-wired
- stat_done
+ if ! ck_daemon net-auto-wired; then
+ stat_busy "Stopping netcfg auto-wired mode for interface ${WIRED_INTERFACE}"
+ [ -n "$PID" ] && /usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r $ACTION
+ if [ $? -eq 0 ]; then
+ rm_daemon net-auto-wired
+ stat_done
+ else
+ stat_fail
+ fi
fi
;;
restart)
- $0 stop
+ "$0" stop
sleep 1
- $0 start
+ "$0" start
;;
*)
- echo "usage: $0 {start|stop|restart}"
+ echo "Usage: $0 {start|stop|restart}"
esac
exit 0
diff --git a/wpa_actiond/net-auto-wireless b/rc.d/net-auto-wireless
index d6a3c44..d6a3c44 100755
--- a/wpa_actiond/net-auto-wireless
+++ b/rc.d/net-auto-wireless
diff --git a/scripts/net-profiles b/rc.d/net-profiles
index cbaea30..15a1a4c 100755
--- a/scripts/net-profiles
+++ b/rc.d/net-profiles
@@ -1,6 +1,7 @@
#!/bin/bash
. /usr/lib/network/globals
+. /etc/conf.d/netcfg
case "$1" in
start)
diff --git a/scripts/net-rename b/rc.d/net-rename
index 1a51ffe..1a51ffe 100755
--- a/scripts/net-rename
+++ b/rc.d/net-rename
diff --git a/ifplugd/netcfg.action b/scripts/ifplugd.action
index 0c081df..602e61a 100644
--- a/ifplugd/netcfg.action
+++ b/scripts/ifplugd.action
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# ifplugd.action script for netcfg
diff --git a/scripts/netcfg b/scripts/netcfg
index 63fed27..9d341e5 100755
--- a/scripts/netcfg
+++ b/scripts/netcfg
@@ -2,7 +2,7 @@
. /usr/lib/network/network
-NETCFG_VER=2.6.7
+NETCFG_VER=2.7
version()
{
diff --git a/wpa_actiond/netcfg-wpa_actiond b/scripts/netcfg-wpa_actiond
index 9ad319f..bb144c3 100755
--- a/wpa_actiond/netcfg-wpa_actiond
+++ b/scripts/netcfg-wpa_actiond
@@ -21,7 +21,8 @@ case $1 in
netcfg -i "$interface"
stop_wpa "$interface"
kill $(cat "/run/wpa_actiond_${2}.pid")
- if [[ -n "$RFKILL" ]]; then
+ # only try to disable software rfkill switches (FS#25514)
+ if [[ "$RFKILL" == "soft" ]]; then
set_rf_state "$interface" disabled $RFKILL_NAME || exit $?
fi
exit
diff --git a/wpa_actiond/netcfg-wpa_actiond-action b/scripts/netcfg-wpa_actiond-action
index 3547fef..3547fef 100755
--- a/wpa_actiond/netcfg-wpa_actiond-action
+++ b/scripts/netcfg-wpa_actiond-action
diff --git a/scripts/wifi-menu b/scripts/wifi-menu
new file mode 100755
index 0000000..fc21a9b
--- /dev/null
+++ b/scripts/wifi-menu
@@ -0,0 +1,260 @@
+#! /bin/bash
+
+. /usr/lib/network/network
+. $SUBR_DIR/8021x
+. /etc/conf.d/netcfg
+
+# The right value depends on the connected profile.
+WPA_CTRL_PATH=/run/wpa_supplicant
+
+usage()
+{
+ cat << END
+Usage: wifi-menu [-o | --obscure] [-h | --help] [interface]
+
+Interactively connect to a wireless network.
+
+Arguments:
+ -o, --obscure Show asterisks for the characters of the password
+ and store the password as a hexadecimal string.
+ -h, --help Show this help.
+ interface The wireless interface to use.
+ (default: WIRELESS_INTERFACE from /etc/conf.d/netcfg)
+
+For choosing from all available profiles, use netcfg-menu.
+END
+}
+
+# Fills PROFILES and ESSIDS with the profile names and essids of the profiles
+# for interface $1.
+init_profiles()
+{
+ local i=0 essid profile
+ for profile in $(list_profiles); do
+ essid=$(
+ unset INTERFACE ESSID
+ . "$PROFILE_DIR/$profile" &> /dev/null
+ if [[ "$INTERFACE" = "$1" && -n "$ESSID" ]]; then
+ printf "%s" "$ESSID"
+ if [[ "$DESCRIPTION" =~ "Automatically generated" ]]; then
+ return 2
+ else
+ return 1
+ fi
+ fi
+ return 0
+ )
+ case $? in
+ 2)
+ GENERATED[${#GENERATED[@]}]="$profile"
+ ;&
+ 1)
+ PROFILES[$i]="$profile"
+ ESSIDS[$i]="$essid"
+ let i++
+ ;;
+ esac
+ done
+}
+
+# Builds ENTRIES as an argument list for dialog based on scan results in $1.
+init_entries()
+{
+ local i=0 flags security signal ssid
+ while IFS=$'\t' read signal flags ssid; do
+ ENTRIES[$i]="--" # $ssid might look like an option to dialog.
+ let i++
+ ENTRIES[$i]="$ssid"
+ let i++
+ if inarray "$ssid" "${ESSIDS[@]}"; then
+ if inarray "$(ssid_to_profile "$ssid")" "${GENERATED[@]}"; then
+ ENTRIES[$i]="+" # Automatically generated
+ else
+ ENTRIES[$i]="*" # Handmade
+ fi
+ else
+ ENTRIES[$i]="-" # Not present
+ fi
+ if [[ "$ssid" = "$CONNECTION" ]]; then
+ ENTRIES[$i]="!" # Currently connected
+ fi
+ security="$(expr match "$flags" ".*\(WPA2\|WPA\|WEP\)")"
+ : ${security:="NONE"}
+ ENTRIES[$i]+=":${security,,}"
+ ENTRIES[$i]+=" :$signal"
+ let i++
+ done < "$1"
+}
+
+# Finds a profile name for ssid $1.
+ssid_to_profile()
+{
+ local i
+ for i in $(seq 0 $((${#ESSIDS[@]}-1))); do
+ if [[ "$1" = "${ESSIDS[$i]}" ]]; then
+ printf "%s" "${PROFILES[$i]}"
+ return 0
+ fi
+ done
+ return 1
+}
+
+# Creates a profile for ssid $1.
+create_profile()
+{
+ local flags key msg security
+ PROFILE="$INTERFACE-$1"
+ [[ -f "$PROFILE_DIR/$PROFILE" ]] && PROFILE+=".wifi-menu"
+ flags="$(grep -m 1 $'\t'"$1\$" "$NETWORKS" | cut -f 2)"
+ security="$(expr match "$flags" ".*\(WPA\|WEP\)")"
+ : ${security:="NONE"}
+ if [[ "$flags" =~ "PSK"|"WEP" ]]; then
+ msg="Enter $security security key for\n'$1'"
+ if [[ "$OBSCURE" ]]; then
+ key=$(wpa_passphrase "$1" "$(dialog --insecure --passwordbox \
+ "$msg" 10 40 --stdout)" \
+ | grep "^[[:space:]]*psk=")
+ RETURN=$?
+ key="KEY=${key#*psk=}"
+ else
+ key="KEY='$(dialog --inputbox "$msg" 10 40 --stdout)'"
+ RETURN=$?
+ fi
+ [[ $RETURN -eq 0 ]] || return $RETURN
+ fi
+ cat << EOF > "$PROFILE_DIR/$PROFILE" || return 4
+CONNECTION='wireless'
+DESCRIPTION='Automatically generated profile by wifi-menu'
+INTERFACE='$INTERFACE'
+SECURITY='${security,,}'
+ESSID='$1'
+IP='dhcp'
+$key
+EOF
+ printf "%s" "$PROFILE"
+ return 0
+}
+
+# Connects to ssid $1 using an available profile or an automatically created
+# one if none exists.
+connect_to_ssid()
+{
+ local msg
+ PROFILE=$(ssid_to_profile "$1")
+ if [[ $? -eq 0 ]]; then
+ clear
+ check_profile "$PROFILE" && profile_down "$PROFILE"
+ else
+ PROFILE=$(create_profile "$1")
+ RETURN=$?
+ [[ $RETURN -eq 0 ]] || return $RETURN
+ SPAWNED_PROFILE=1
+ clear
+ fi
+ if ! profile_up "$PROFILE"; then
+ if [[ "$SPAWNED_PROFILE" ]]; then
+ msg=" CONNECTING FAILED
+
+Do you want to keep the generated profile ('$PROFILE')?"
+ dialog --yesno "$msg" 10 40 --stdout || rm "$PROFILE_DIR/$PROFILE"
+ clear
+ fi
+ return 2
+ fi
+ return 0
+}
+
+while [[ "$1" = -* ]]; do
+ case "$1" in
+ -h|--help)
+ usage
+ exit
+ ;;
+ -o|--obscure)
+ OBSCURE=1
+ shift
+ ;;
+ -*)
+ report_err "Invalid option: $1"
+ usage
+ exit 255
+ ;;
+ esac
+done
+if [[ $# -gt 1 ]]; then
+ report_err "Too many arguments"
+ usage
+ exit 255
+fi
+
+if [[ $(id -u) -ne 0 ]]; then
+ exit_stderr "This script needs to be run with root privileges"
+fi
+
+INTERFACE="${1-$WIRELESS_INTERFACE}"
+if [[ -z "$INTERFACE" ]]; then
+ report_err "Missing interface specification"
+ usage
+ exit 255
+fi
+
+cd / # We do not want to spawn anything that can block unmounting
+is_interface "$INTERFACE" || exit_fail "No such interface: $INTERFACE"
+if [[ -z "$(ip link show up dev $INTERFACE)" ]]; then
+ [[ -f "$IFACE_DIR/$INTERFACE" ]] && . "$IFACE_DIR/$INTERFACE"
+ bring_interface up "$INTERFACE" || exit_fail "Interface unavailable"
+ SPAWNED_INTERFACE=1
+fi
+
+report_try "Scanning for networks"
+CONNECTION=$(expr substr \
+ "$(wpa_cli -p "$WPA_CTRL_PATH" -i "$INTERFACE" status \
+ 2> /dev/null | grep "^ssid=")" 6 32)
+init_profiles "$INTERFACE"
+NETWORKS=$(wpa_supplicant_scan_info "$INTERFACE" 3,4,5)
+[[ $? -eq 0 ]] && init_entries "$NETWORKS"
+if [[ ${#ENTRIES[@]} -eq 0 ]]; then
+ report_fail
+ RETURN=3
+else
+ report_success
+ MSG="Select the network you wish to use
+Flags description:
+ * - handmade profile present
+ + - automatically generated profile present
+ - - no profile present
+ ! - active connection present"
+ CHOICE=$(dialog --column-separator : --menu "$MSG" 24 50 12 \
+ "${ENTRIES[@]}" --stdout)
+ RETURN=$?
+ if [[ $RETURN -eq 0 ]]; then
+ connect_to_ssid "$CHOICE"
+ RETURN=$?
+ fi
+fi
+case $RETURN in
+ 0|2) # Connected | Connecting failed
+ ;;
+ 1) # Canceled
+ clear
+ ;;
+ 3) # No networks found
+ report_err "No networks found"
+ ;;
+ 4) # Unable to create profile
+ clear
+ report_err "Could not create a profile for '$CHOICE'"
+ ;;
+ 255) # ESC or error
+ clear
+ report_err "Aborted"
+ ;;
+ *) # Should not happen
+ clear
+ report_err "Unexpected return code from dialog: $RETURN"
+ RETURN=7
+ ;;
+esac
+[[ -f "$NETWORKS" ]] && rm -f "$NETWORKS"
+[[ $RETURN -ne 0 && "$SPAWNED_INTERFACE" ]] && bring_interface down "$INTERFACE"
+exit $RETURN
diff --git a/src/8021x b/src/8021x
index 3de0a00..13c5b6e 100644
--- a/src/8021x
+++ b/src/8021x
@@ -31,7 +31,13 @@ start_wpa()
shift 3
local WPA_OPTS="$*"
- wpa_supplicant -B -P "/run/wpa_supplicant_${INTERFACE}.pid" -i "$INTERFACE" -D "$WPA_DRIVER" -c "$WPA_CONF" $WPA_OPTS
+ if [[ -n "$WPA_CONF" ]]; then
+ WPA_CONF="-c$WPA_CONF"
+ else
+ WPA_CONF="-C$WPA_CTRL_PATH"
+ fi
+
+ wpa_supplicant -B -P "/run/wpa_supplicant_${INTERFACE}.pid" -i "$INTERFACE" -D "$WPA_DRIVER" "$WPA_CONF" $WPA_OPTS
sleep 1
if [[ ! -f "/run/wpa_supplicant_${INTERFACE}.pid" ]]; then
@@ -124,14 +130,18 @@ list_networks() {
}
wpa_supplicant_scan_info() {
- local INTERFACE="$1" fields="$2" essids
+ local INTERFACE="$1" fields="$2" essids spawned_wpa=0
# temp file used, as keeping ESSID's with spaces in their name in arrays
# is hard, obscure and kinda nasty. This is simpler and clearer.
[[ -z "$INTERFACE" ]] && return 1
essids=$(mktemp --tmpdir essid.XXXXXXXX)
- wpa_supplicant -B -i"$INTERFACE" -Dnl80211,wext -C/run/wpa_supplicant -P/run/wpa_supplicant.pid || return 1
+ if [[ "$(wpa_cli -p "$WPA_CTRL_PATH" -i "$INTERFACE" ping 2> /dev/null)" != "PONG" ]]; then
+ start_wpa "$INTERFACE" "" nl80211,wext || return 1
+ spawned_wpa=1
+ fi
+
wpa_cli -p "$WPA_CTRL_PATH" -i "$INTERFACE" scan &> /dev/null
sleep 2.5
wpa_cli -p "$WPA_CTRL_PATH" -i "$INTERFACE" scan_results |
@@ -149,7 +159,7 @@ wpa_supplicant_scan_info() {
# Re-sort by strength as the removal disorders the list
# Cut to the AP/essid fields only
- kill "$(cat /run/wpa_supplicant.pid)"
+ (( $spawned_wpa == 1 )) && stop_wpa "$INTERFACE"
# File of 0 length, ie. no ssid's.
if [[ ! -s "$essids" ]]; then
@@ -186,7 +196,19 @@ make_wpa_config_file() {
make_wpa_config() {
case $SECURITY in
wep|wep-old|wpa|none|none-old)
- echo "ssid=\"$ESSID\""
+ case "${ESSID_TYPE:-ascii}" in
+ ascii)
+ echo "ssid=\"$ESSID\""
+ ;;
+ hex)
+ # Hex ESSID is written unquoted ans lowercase (FS#24333)
+ echo "ssid=${ESSID,,}"
+ ;;
+ *)
+ report_fail "ESSID_TYPE must be set to 'ascii' or 'hex'."
+ return 1
+ ;;
+ esac
if [[ -n "$AP" ]]; then
echo "bssid=${AP,,}"
fi
diff --git a/src/connections/bond b/src/connections/bond
index 6ba463e..ea6af77 100644
--- a/src/connections/bond
+++ b/src/connections/bond
@@ -14,8 +14,8 @@ bond_up() {
bring_interface up "$INTERFACE"
"$CONN_DIR/ethernet" up "$1"
- for slave in ${SLAVE_INTERFACES[@]}; do
- bring_interface up "$INTERFACE"
+ for slave in "${SLAVE_INTERFACES[@]}"; do
+ bring_interface up "$slave"
$IFENSLAVE $INTERFACE $slave
done
@@ -25,7 +25,7 @@ bond_up() {
bond_down() {
load_profile "$1"
- for slave in ${SLAVE_INTERFACES[@]}; do
+ for slave in "${SLAVE_INTERFACES[@]}"; do
$IFENSLAVE $INTERFACE -d $slave
done
diff --git a/src/connections/ethernet b/src/connections/ethernet
index f9c660c..78f8240 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -22,6 +22,11 @@ ethernet_up() {
fi
fi
+ # Disable IPv6 before the interface to prevent SLAAC
+ if [[ "$IP6" == "no"]]; then
+ sysctl -q -w net.ipv6.conf.$INTERFACE.disable_ipv6=1
+ fi
+
report_debug ethernet_iproute_up ifup
bring_interface up "$INTERFACE"
@@ -37,7 +42,12 @@ ethernet_up() {
. "$SUBR_DIR/8021x"
[[ -z "$WPA_CONF" ]] && WPA_CONF="/etc/wpa_supplicant.conf"
[[ -z "$WPA_DRIVER" ]] && WPA_DRIVER="wired"
-
+ # Set wpa_supplicant control path (FS#25473)
+ WPA_CTRL_PATH=/var/run/wpa_supplicant
+ if grep "^ *ctrl_interface=" "$WPA_CONF" &>/dev/null; then
+ WPA_CTRL_PATH=$(grep -m 1 "^ *ctrl_interface=" "$WPA_CONF" | tail -n 1 | cut -d= -f 2- | sed -r 's/DIR=(.*) +GROUP=.*/\1/')
+ fi
+
report_debug ethernet_iproute_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"
@@ -127,6 +137,19 @@ ethernet_up() {
done
fi
+ # Load ipv6 module if necessary (FS#25530)
+ case "$IP6" in
+ dhcp*|stateless|static)
+ [ -d "/proc/sys/net/ipv6" ] || modprobe ipv6
+ ;;
+ no)
+ [ -d /proc/sys/net/ipv6 ] && sysctl -q -w net.ipv6.conf.$INTERFACE.accept_ra=0
+ ;;
+ *)
+ report_iproute "IP6 must be 'dhcp', 'dhcp-noaddr', 'stateless', 'static' or 'no'"
+ ;;
+ esac
+
case "$IP6" in
dhcp*)
if [[ -x /usr/sbin/dhclient ]]; then
@@ -178,12 +201,6 @@ ethernet_up() {
done
fi
;;
- ""|no)
- sysctl -q -w net.ipv6.conf.$INTERFACE.accept_ra=0
- ;;
- *)
- report_iproute "IP6 must be 'dhcp', 'dhcp-noaddr', 'stateless', 'static' or 'no'"
- ;;
esac
# Set hostname
diff --git a/src/connections/wireless b/src/connections/wireless
index 7ed5abe..b19afde 100644
--- a/src/connections/wireless
+++ b/src/connections/wireless
@@ -30,8 +30,8 @@ wireless_up() {
if [ "$SECURITY" = "wpa-config" ]; then
WPA_CONF="${WPA_CONF:-/etc/wpa_supplicant.conf}"
# Use defined control path (FS#24949)
- if grep "ctrl_interface=" "$WPA_CONF" &>/dev/null; then
- WPA_CTRL_PATH=$(grep -m 1 "^ctrl_interface=" "$WPA_CONF" | tail -n 1 | cut -d= -f 2- | sed -r 's/DIR=(.*) +GROUP=.*/\1/')
+ if grep "^ *ctrl_interface=" "$WPA_CONF" &>/dev/null; then
+ WPA_CTRL_PATH=$(grep -m 1 "^ *ctrl_interface=" "$WPA_CONF" | tail -n 1 | cut -d= -f 2- | sed -r 's/DIR=(.*) +GROUP=.*/\1/')
fi
else
WPA_CONF=$(make_wpa_config_file $INTERFACE)
@@ -122,7 +122,6 @@ wireless_down() {
# Handle wireless kill switches
# Any reason why a hardware switch should be considered on interface down?
if [[ "$RFKILL" == "soft" ]]; then
- . "$SUBR_DIR/wireless"
set_rf_state "$INTERFACE" disabled $RFKILL_NAME || return 1
fi
}
diff --git a/ifplugd/net-auto-wired.service b/systemd/net-auto-wired.service
index b356fef..321a62e 100644
--- a/ifplugd/net-auto-wired.service
+++ b/systemd/net-auto-wired.service
@@ -4,6 +4,7 @@ Before=network.target
[Service]
EnvironmentFile=/etc/rc.conf
+EnvironmentFile=/etc/conf.d/netcfg
EnvironmentFile=-/etc/ifplugd/ifplugd.conf
ExecStart=-/usr/sbin/ifplugd -i $WIRED_INTERFACE -r /etc/ifplugd/netcfg.action -fIn -u0 -d10
ExecStop=-/usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r /etc/ifplugd/netcfg.action
diff --git a/wpa_actiond/net-auto-wireless.service b/systemd/net-auto-wireless.service
index 7075cb5..6f7a8c0 100644
--- a/wpa_actiond/net-auto-wireless.service
+++ b/systemd/net-auto-wireless.service
@@ -1,6 +1,6 @@
[Unit]
Description=Provides automatic netcfg wireless connection
-After=dbus.service
+Before=network.target
[Service]
EnvironmentFile=/etc/rc.conf
@@ -11,4 +11,4 @@ RemainAfterExit=yes
Type=forking
[Install]
-WantedBy=network.target
+WantedBy=multi-user.target