From 06e9460aab959c2fefac9b52b8dee361c0b5d327 Mon Sep 17 00:00:00 2001 From: Max Fiedler Date: Sun, 16 Feb 2025 12:56:59 +0100 Subject: [PATCH] proper iface handling --- wpe | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/wpe b/wpe index b20b58f..d52e365 100755 --- a/wpe +++ b/wpe @@ -40,13 +40,19 @@ while true; do done echo "[+] Preparing $iface for hostapd-wpe..." -if ! nmcli device set "$iface" managed no; then - echo "[!] Failed to set $iface unmanaged. Exiting." - exit 1 -fi +nmcli device set "$iface" managed no +ip link set "$iface" down +ip link set "$iface" up # Check for hostapd-wpe.conf in the current directory if [[ -f "hostapd-wpe.conf" ]]; then + if grep -q '^interface=' hostapd-wpe.conf; then + sed -i "s/^interface=.*/interface=$iface/" hostapd-wpe.conf + echo "[+] Updated existing interface definition in hostapd-wpe.conf." + else + echo "interface=$iface" >> hostapd-wpe.conf + echo "[+] Added missing interface definition to hostapd-wpe.conf." + fi echo "[+] Found hostapd-wpe.conf in the current directory. Using it." config_file="hostapd-wpe.conf" else