commit 04c5695c8ee9710dbd34153e666b0285ce63f27e parent f589df0565b6373a00018648d6f330d4d8c30be2 Author: Ahmed Mokhtar <mokhtar92@gmail.com> Date: Thu, 18 Sep 2014 01:54:27 +0300 Update create_ap Diffstat:
M | create_ap | | | 20 | ++++++++++++-------- |
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/create_ap b/create_ap @@ -196,6 +196,17 @@ get_avail_bridge() { done } +get_virt_iface_name() { + i=0 + while :; do + if [[ ! -d /sys/class/net/ap${i} ]]; then + echo ap${i} + break + fi + i=$((i+1)) + done +} + get_new_macaddr() { OLDMAC=$(get_macaddr "$1") for i in {20..255}; do @@ -654,14 +665,7 @@ CONFDIR=$(mktemp -d /tmp/create_ap.${WIFI_IFACE}.conf.XXXXXXXX) echo "Config dir: $CONFDIR" if [[ $NO_VIRT -eq 0 ]]; then - i=0 - while :; do - if [[ ! -d /sys/class/net/ap${i} ]]; then - VWIFI_IFACE=ap${i} - break - fi - i=$((i+1)) - done + VWIFI_IFACE=$(get_virt_iface_name) # in NetworkManager 0.9.10 and above we can set the interface as unmanaged without # the need of MAC address, so we set it before we create the virtual interface.