create_ap

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

commit 33ed352b5c4e912b3e69399fd86f1d67a8373031
parent c04cce072c13484e956909f22ce9ea2c3d497878
Author: oblique <psyberbits@gmail.com>
Date:   Tue,  9 Jun 2015 22:16:11 +0300

Show virtual interface in `--list-running'

Diffstat:
Mcreate_ap | 19+++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/create_ap b/create_ap @@ -766,7 +766,7 @@ list_running_conf() { local x mutex_lock for x in /tmp/create_ap.*; do - if [[ -f $x/pid && -d /proc/$(cat $x/pid) ]]; then + if [[ -f $x/pid && -f $x/wifi_iface && -d /proc/$(cat $x/pid) ]]; then echo $x fi done @@ -774,12 +774,18 @@ list_running_conf() { } list_running() { - local IFACE x + local IFACE wifi_iface x mutex_lock for x in $(list_running_conf); do IFACE=${x#*.} IFACE=${IFACE%%.*} - echo $(cat $x/pid) $IFACE + wifi_iface=$(cat $x/wifi_iface) + + if [[ $IFACE == $wifi_iface ]]; then + echo $(cat $x/pid) $IFACE + else + echo $(cat $x/pid) $IFACE '('$(cat $x/wifi_iface)')' + fi done mutex_unlock } @@ -892,7 +898,7 @@ send_stop() { fi # send stop signal to specific interface - for x in $(list_running | grep -E " ${1}\$" | cut -f1 -d' '); do + for x in $(list_running | grep -E " \(?${1}( |\)?\$)" | cut -f1 -d' '); do kill -USR1 $x done mutex_unlock @@ -1435,6 +1441,11 @@ else OLD_MACADDR=$(get_macaddr ${WIFI_IFACE}) fi +mutex_lock +echo $WIFI_IFACE > $CONFDIR/wifi_iface +chmod 444 $CONFDIR/wifi_iface +mutex_unlock + can_transmit_to_channel ${WIFI_IFACE} ${CHANNEL} || die "Your adapter can not transmit to channel ${CHANNEL}, frequency band ${FREQ_BAND}GHz." if networkmanager_is_running && ! networkmanager_iface_is_unmanaged ${WIFI_IFACE}; then