diff options
author | Jouni Malinen <jouni.malinen@atheros.com> | 2010-07-18 14:30:26 -0700 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2010-09-09 07:17:18 -0700 |
commit | 42f0101b4d8c6641b18a4521d38e944b686d878c (patch) | |
tree | 911167433a497a421792e36a530fa00f2722ad2a /wpa_supplicant/examples | |
parent | 57faa1cee8aac15f68d8dc7c82a8c18831b9a8fb (diff) | |
download | external_wpa_supplicant_8_ti-42f0101b4d8c6641b18a4521d38e944b686d878c.zip external_wpa_supplicant_8_ti-42f0101b4d8c6641b18a4521d38e944b686d878c.tar.gz external_wpa_supplicant_8_ti-42f0101b4d8c6641b18a4521d38e944b686d878c.tar.bz2 |
P2P: wpa_cli action calls for P2P group started/removed events
Diffstat (limited to 'wpa_supplicant/examples')
-rwxr-xr-x | wpa_supplicant/examples/p2p-action.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/wpa_supplicant/examples/p2p-action.sh b/wpa_supplicant/examples/p2p-action.sh new file mode 100755 index 0000000..ee645cb --- /dev/null +++ b/wpa_supplicant/examples/p2p-action.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +IFNAME=$1 +CMD=$2 + +kill_daemon() { + NAME=$1 + PF=$2 + + if [ ! -r $PF ]; then + return + fi + + PID=`cat $PF` + if [ $PID -gt 0 ]; then + if ps $PID | grep -q $NAME; then + kill $PID + fi + fi + rm $PF +} + +if [ "$CMD" = "P2P-GROUP-STARTED" ]; then + GIFNAME=$3 + if [ "$4" = "GO" ]; then + kill_daemon dhclient /var/run/dhclient-$GIFNAME.pid + rm /var/run/dhclient.leases-$GIFNAME + kill_daemon dnsmasq /var/run/dnsmasq.pid-$GIFNAME + ifconfig $GIFNAME 192.168.42.1 up + dnsmasq -x /var/run/dnsmasq.pid-$GIFNAME \ + -i $GIFNAME \ + -F192.168.42.11,192.168.42.99 + fi + if [ "$4" = "client" ]; then + kill_daemon dhclient /var/run/dhclient-$GIFNAME.pid + rm /var/run/dhclient.leases-$GIFNAME + kill_daemon dnsmasq /var/run/dnsmasq.pid-$GIFNAME + dhclient -pf /var/run/dhclient-$GIFNAME.pid \ + -lf /var/run/dhclient.leases-$GIFNAME \ + -nw \ + $GIFNAME + fi +fi + +if [ "$CMD" = "P2P-GROUP-REMOVED" ]; then + GIFNAME=$3 + if [ "$4" = "GO" ]; then + kill_daemon dnsmasq /var/run/dnsmasq.pid-$GIFNAME + ifconfig $GIFNAME 0.0.0.0 + fi + if [ "$4" = "client" ]; then + kill_daemon dhclient /var/run/dhclient-$GIFNAME.pid + rm /var/run/dhclient.leases-$GIFNAME + ifconfig $GIFNAME 0.0.0.0 + fi +fi |