Check at the beginning if WIFI_IFACE is a WiFi interface or not

This commit is contained in:
oblique 2014-08-28 01:18:35 +03:00
parent 64790ff5f2
commit 3f49258758

View File

@ -362,6 +362,13 @@ if [[ $(id -u) -ne 0 ]]; then
exit 1
fi
WIFI_IFACE=$1
if ! iw ${WIFI_IFACE} info > /dev/null 2>&1; then
echo "ERROR: ${WIFI_IFACE} is not a WiFi interface" >&2
exit 1
fi
if [[ "$SHARE_METHOD" != "nat" && "$SHARE_METHOD" != "bridge" && "$SHARE_METHOD" != "none" ]]; then
echo "ERROR: Wrong Internet sharing method" >&2
echo
@ -369,8 +376,6 @@ if [[ "$SHARE_METHOD" != "nat" && "$SHARE_METHOD" != "bridge" && "$SHARE_METHOD"
exit 1
fi
WIFI_IFACE=$1
if [[ "$SHARE_METHOD" == "bridge" ]]; then
OLD_BRIDGE_IPTABLES=$(cat /proc/sys/net/bridge/bridge-nf-call-iptables)
BRIDGE_IFACE=$(get_avail_bridge)