create_ap

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

commit f66819c145dbc90bb8000e81ad3a89877e1f3a42
parent 3fe8513d9aa2a456bc56d5f2fc1a4576d655c35b
Author: oblique <psyberbits@gmail.com>
Date:   Sat Sep  6 21:49:52 +0300

Check if the user passed a valid interface

Diffstat:
create_ap | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git 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)