Skip to content
Permalink
Browse files

wifi seems ok and stable

  • Loading branch information...
YuanChenmang committed Mar 21, 2017
1 parent dad5b38 commit bad95308cef2dbdb643b36500d3f74043a6fad67
@@ -4,7 +4,7 @@
| |/ |/ / / /_/ / /_/ / / / /_/ /
|__/|__/_/\__,_/\____/_/ \__,_/
-----------------------------------------------------
CHAOS CALMER (%C, %R) Version:0.1.6 by mango
CHAOS CALMER (%C, %R) Version:0.1.7 by mango
-----------------------------------------------------
* 1 1/2 oz Gin Shake with a glassful
* 1/4 oz Triple Sec of broken ice and pour
@@ -8,6 +8,7 @@ repeater) #repeater mode
[ -n "$3" ] && uci set wireless.sta.key=$3
uci set wireless.radio0.linkit_mode=apsta
uci set wireless.sta.network=lan
uci set wireless.sta.disabled=0
uci set dhcp.lan.ignore=1
uci set network.lan.proto='dhcp'
uci set network.lan.ifname='eth0'
@@ -18,6 +19,7 @@ repeater) #repeater mode
client) #client mode
[ -n "$2" ] && uci set wireless.sta.ssid=$2
[ -n "$3" ] && uci set wireless.sta.key=$3
uci set wireless.sta.disabled=0
uci set wireless.radio0.linkit_mode=sta
uci set wireless.sta.network=wan
uci set network.wan=interface
@@ -68,4 +70,4 @@ echo "\"widora client\" or \"widora client ssid key\""
echo "\"widora router\""
echo "\"widora pppoe\" or \"widora pppoe name key\""
echo "---------------------------------------------------"
fi
fi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,7 +5,7 @@ echo "Content-Type: application/json"
echo ""
echo "{"
iwpriv ra0 set SiteSurvey=0
sleep 1
sleep 5
iwpriv ra0 get_site_survey | grep '^[0-9]' | while read line
do
chanel=`echo $line | awk '{print $1}'`
@@ -2,14 +2,10 @@
echo "Content-Type: application/json"
echo ""
apcli=`ifconfig | grep apcli0`
while [[ -z "$apcli" ]]
do
apcli=`ifconfig | grep apcli0`
done

ip=`ifconfig apcli0 | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'`
if [ $ip ]; then
echo "{\"result\":\"success\",\"message\":\"connected with IP $ip\", \"ip\":\"$ip\"}"
else
echo "{\"result\":\"error\",\"message\":\"can not connect to $ussid\"}"
fi
fi
@@ -1,13 +1,13 @@
#!/bin/sh
echo "Content-Type: application/json"
echo ""
uci set wireless.@wifi-iface[0].ApCliEnable=0
uci set wireless.sta.disabled=1
uci commit
nr
sleep 5
wifi
sleep 1
ip=`ifconfig apcli0 | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'`
if [ $ip ]; then
echo "{\"result\":\"error\"}"
else
echo "{\"result\":\"sucess\"}"
fi
fi
@@ -1,9 +1,9 @@
#!/bin/sh
echo "Content-Type: application/json"
echo ""
ssid=`uci get wireless.@wifi-iface[0].ssid`
ssid=`uci get wireless.ap.ssid`
if [ $ssid ]; then
echo "{\"result\":\"success\",\"ssid\":\"$ssid\"}"
else
echo "{\"result\":\"error\",\"message\":\"can not get ssid\"}"
fi
fi
@@ -21,11 +21,12 @@ elif [ -z "$1" ]; then
else
apass=$1
fi
uci set wireless.@wifi-iface[0].encryption=psk2
uci set wireless.@wifi-iface[0].key=$apass
uci set wireless.ap.encryption=psk2
uci set wireless.ap.key=$apass
uci commit
echo "{\"result\"=\"success\",\"message\"=\"operation finished\"}"
# Restart network service
/etc/init.d/network restart 1>&- 2>&-
##/etc/init.d/network restart 1>&- 2>&-
wifi 1>&- 2>&-

exit 0
@@ -31,83 +31,27 @@ else
ussid=$1
upass=$2
fi
iwpriv ra0 set SiteSurvey=0
sleep 2
OUTPUT=`iwpriv ra0 get_site_survey | grep '^[0-9]'`
while read line
do
ssid=`echo $line | awk '{print $2}'`
if [ "$ssid"x = "$ussid"x ]; then
# # Set interfaces file
umode=""
uencryp=""

channel=`echo $line | awk '{print $1}'`
security=`echo $line | awk '{print $5}'`


if [ "$security"x = "WPA1PSKWPA2PSK/TKIPAES"x ]; then
umode="WPA2PSK"
uencryp="AES"
elif [ "$security"x = "WPA1PSKWPA2PSK/AES"x ]; then
umode="WPA2PSK"
uencryp="AES"
elif [ "$security"x = "WPA2PSK/TKIPAES"x ]; then
umode="WPA2PSK"
uencryp="TKIP"
elif [ "$security"x = "WPA2PSK/AES"x ]; then
umode="WPA2PSK"
uencryp="AES"
elif [ "$security"x = "WPA2PSK/TKIP"x ]; then
umode="WPA2PSK"
uencryp="TKIP"
elif [ "$security"x = "WPAPSK/TKIPAES"x ]; then
umode="WPAPSK"
uencryp="TKIP"
elif [ "$security"x = "WPAPSK/AES"x ]; then
umode="WPAPSK"
uencryp="AES"
elif [ "$security"x = "WPAPSK/TKIP"x ]; then
umode="WPAPSK"
uencryp="TKIP"
elif [ "$security"x = "WEP"x ]; then
umode="WEP"
uencryp="WEP"
fi

uci set wireless.@wifi-iface[0].ApCliSsid=$ussid
uci set wireless.@wifi-iface[0].ApCliEnable=1
uci set wireless.@wifi-iface[0].ApCliAuthMode=$umode
uci set wireless.@wifi-iface[0].ApCliEncrypType=$uencryp
uci set wireless.@wifi-iface[0].ApCliWPAPSK=$upass
uci set wireless.mt7628.channel=$channel
uci set network.wan=interface
uci set network.wan.ifname=apcli0
uci set network.wan.proto=dhcp
uci commit

lanip1=`ifconfig br-lan | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'|cut -d. -f1`
uci set wireless.sta.disabled=0
widora_mode client $ussid $upass
lanip1=`ifconfig br-lan | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'|cut -d. -f1`
lanip2=`ifconfig br-lan | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'|cut -d. -f2`
lanip3=`ifconfig br-lan | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'|cut -d. -f3`

/etc/init.d/network restart 1>&- 2>&-

apcli=`ifconfig | grep apcli0`
while [[ -z "$apcli" ]]
do
apcli=`ifconfig | grep apcli0`
done
sleep 15
sleep 5

wanip1=`ifconfig apcli0 | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'|cut -d. -f1`
wanip1=`ifconfig apcli0 | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'|cut -d. -f1`
wanip2=`ifconfig apcli0 | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'|cut -d. -f2`
wanip3=`ifconfig apcli0 | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'|cut -d. -f3`
if [ "$wanip1"x = "$lanip1"x -a "$wanip2"x = "$lanip2"x -a "$wanip3"x = "$lanip3"x ]; then
# echo WAN IP conflict to LAN IP
newlanip=$wanip1.$wanip2.`expr $wanip3 + 1`.1
uci set network.lan.ipaddr=$newlanip
ifconfig br-lan $newlanip
# echo set br-lan to $newlanip
uci commit
fi
ip=`ifconfig apcli0 | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}'`

0 comments on commit bad9530

Please sign in to comment.
You can’t perform that action at this time.