diff --git a/README.md b/README.md index 0a44d96..20f303e 100644 --- a/README.md +++ b/README.md @@ -319,6 +319,7 @@ Options: > These changes to system will not be restored by script's cleanup: > 1. `/proc/sys/net/ipv4/ip_forward = 1` and `/proc/sys/net/ipv6/conf/all/forwarding = 1`, needed by NAT Internet sharing. > 2. dnsmasq in Apparmor complain mode +> 3. The wifi device which is used to create hotspot is `rfkill unblock`ed ## Dependencies diff --git a/lnxrouter b/lnxrouter index 9f2498a..e6ed7b5 100644 --- a/lnxrouter +++ b/lnxrouter @@ -499,7 +499,7 @@ get_phy_device() { # only for wifi interface } get_adapter_info() { # only for wifi interface - local PHY + #local PHY PHY=$(get_phy_device "$1") [[ $? -ne 0 ]] && return 1 iw phy $PHY info @@ -1685,6 +1685,14 @@ if [[ -n "$NEW_MACADDR" ]]; then ip link set dev ${SUBNET_IFACE} address ${NEW_MACADDR} || die "Failed setting new MAC address" fi + +if [[ $WIFI_IFACE ]]; then + if which rfkill > /dev/null 2>&1 ; then + PHY=$(get_phy_device ${SUBNET_IFACE}) + [[ -n $PHY ]] && rfkill unblock $(rfkill | grep $PHY | awk '{print $1}') >/dev/null 2>&1 + fi +fi + ip link set up dev ${SUBNET_IFACE} || die "Failed bringing ${SUBNET_IFACE} up" if [[ $WIFI_IFACE ]]; then