create_ap

create a nat-ed wifi ap
git clone git://git.2f30.org/create_ap
Log | Files | Refs | README | LICENSE

commit 3f492587586b9f13f6f3f82d88f64beaf6c779df
parent 64790ff5f2a5ce83006aa967c637e27826812784
Author: oblique <psyberbits@gmail.com>
Date:   Thu, 28 Aug 2014 01:18:35 +0300

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

Diffstat:
Mcreate_ap | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/create_ap b/create_ap @@ -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)