commit 3460580ce288a7fa9c5c0b34ad49ff4601455dcd parent 9dce88aee91254bc34cd4b942823a87684f971a7 Author: oblique <psyberbits@gmail.com> Date: Sat, 14 Feb 2015 16:58:58 +0200 Detect if --driver=rtl871xdrv is needed Diffstat:
M | create_ap | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/create_ap b/create_ap @@ -142,6 +142,11 @@ get_adapter_info() { iw phy $PHY info } +get_adapter_kernel_module() { + MODULE=$(readlink -f "/sys/class/net/$1/device/driver/module") + echo ${MODULE##*/} +} + can_be_sta_and_ap() { # iwconfig does not provide this information, assume false [[ $USE_IWCONFIG -eq 1 ]] && return 1 @@ -738,6 +743,18 @@ if ! can_be_sta_and_ap ${WIFI_IFACE}; then fi fi +if [[ $(get_adapter_kernel_module ${WIFI_IFACE}) =~ ^(8192[cd][ue]|8723a[sue])$ ]]; then + if ! strings $(which hostapd) | grep -m1 rtl871xdrv > /dev/null 2>&1; then + echo "ERROR: You need to patch your hostapd with rtl871xdrv patches." >&2 + exit 1 + fi + + if [[ $DRIVER != "rtl871xdrv" ]]; then + echo "WARN: Your adapter needs rtl871xdrv, enabling --driver=rtl871xdrv" >&2 + DRIVER=rtl871xdrv + fi +fi + if [[ "$SHARE_METHOD" != "nat" && "$SHARE_METHOD" != "bridge" && "$SHARE_METHOD" != "none" ]]; then echo "ERROR: Wrong Internet sharing method" >&2 echo