Check if the user passed a valid interface
This commit is contained in:
parent
3fe8513d9a
commit
f66819c145
10
create_ap
10
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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user