diff --git a/create_ap b/create_ap index da6c5aa..bf5460a 100755 --- a/create_ap +++ b/create_ap @@ -82,6 +82,11 @@ version_cmp() { USE_IWCONFIG=0 +is_interface() { + [[ -z "$1" ]] && return 1 + ip link show $1 > /dev/null 2>&1 +} + is_wifi_interface() { which iw > /dev/null 2>&1 && iw dev $1 info > /dev/null 2>&1 && return 0 if which iwconfig > /dev/null 2>&1 && iwconfig $1 > /dev/null 2>&1; then @@ -579,6 +584,11 @@ else fi fi +if [[ "$SHARE_METHOD" != "none" ]] && ! is_interface $INTERNET_IFACE; then + echo "ERROR: '${INTERNET_IFACE}' is not an interface" >&2 + exit 1 +fi + if [[ "$SHARE_METHOD" == "bridge" ]]; then OLD_BRIDGE_IPTABLES=$(cat /proc/sys/net/bridge/bridge-nf-call-iptables)