RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
cat onewifi_pre_start.sh #!/bin/sh sleep 5 #To update al_mac_addr in EasyMeshCfg.json to avoid onewifi restarting during fresh boot-up #wan_mac="$(cat /sys/class/ieee80211/phy0/macaddress)" old_al_mac_addr=`cat /nvram/EasymeshCfg.json | grep AL_MAC_ADDR | cut -d '"' -f4` #if [ "$old_al_mac_addr" == "00:00:00:00:00:00" ]; then # sed -i "s/$old_al_mac_addr/$wan_mac/g" /nvram/EasymeshCfg.json #fi ip link set dev brlan0 down brlan_mac=`ifconfig brlan0 | grep HWaddr | cut -d " " -f9` mac_addr=$(echo $brlan_mac | tr -d ':') mac_increment=$((0x$mac_addr + 1)) brlan_inc_mac=$(printf "%012x" $mac_increment | sed 's/../&:/g;s/:$//') ip link set dev brlan0 address a2:f0:d1:69:f5:ae #ip link set dev brlan0 address $brlan_inc_mac sleep 1 ip link set dev brlan0 up #sed -i "s/$old_al_mac_addr/$brlan_inc_mac/g" /nvram/EasymeshCfg.json iw phy phy0 interface add wifi0 type __ap iw phy phy0 interface add wifi1 type __ap iw phy phy0 interface add wifi1.1 type __ap iw phy phy0 interface add wifi2 type __ap #iw phy phy0 interface add wifi2.1 type __ap #Obtain the wifi0 mac address wifi0_mac="$(cat /sys/class/ieee80211/phy0/macaddress)" #Strip the : and increment mac by 1 to get wifi1 macaddress mac=$(echo $wifi0_mac | tr -d ':') mac_incr=$((0x$mac + 2)) wifi1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//') mac_incr=$(($mac_incr + 2)) wifi1_1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//') #Increment again by 1 to get wifi2 address mac_incr=$(($mac_incr + 2)) wifi2_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//') mac_incr=$(($mac_incr + 2)) wifi2_1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//') #print the mac address echo $wifi0_mac echo $wifi1_mac echo $wifi2_mac #Update the mac address using ip link command ifconfig wifi0 down ifconfig wifi1 down ifconfig wifi1.1 down ifconfig wifi2 down ifconfig wifi2.1 down ip link set dev wifi0 address $wifi0_mac ip link set dev wifi1 address $wifi1_mac ip link set dev wifi1.1 address $wifi1_1_mac ip link set dev wifi2 address $wifi2_mac ip link set dev wifi2.1 address $wifi2_1_mac ifconfig wifi0 up ifconfig wifi1 up ifconfig wifi1.1 up ifconfig wifi2 up ifconfig wifi2.1 up exit 0 |
remove wifidb - rm /opt/secure/wifi/*
To restart onewifi - systemctl restart onewifi
To run ctrl - systemctl start em_ctrl
...
ctrl observations : All default private vaps are should be UP and Running with EasyMesh default ssids(eg, private_ssid)
...
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/sh
sleep 10
iw phy phy0 interface add wifi0 type __ap
iw phy phy0 interface add wifi1 type __ap
iw phy phy0 interface add wifi2 type __ap
iw phy phy0 interface add wifi3 type __ap
#Obtain the wifi0 mac address
wifi0_mac="$(cat /sys/class/ieee80211/phy0/macaddress)"
#Strip the : and increment mac by 1 to get wifi1 macaddress
mac=$(echo $wifi0_mac | tr -d ':')
mac_incr=$((0x$mac + 1))
wifi1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
#Increment again by 1 to get wifi2 address
mac_incr=$(($mac_incr + 1))
wifi2_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
mac_incr=$(($mac_incr + 1))
wifi3_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
mac_incr=$(($mac_incr + 1))
wifi4_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
mac_incr=$(($mac_incr + 1))
wifi5_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
mac_incr=$(($mac_incr + 1))
wifi6_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
mac_incr=$(($mac_incr + 1))
wifi7_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
#print the mac address
echo $wifi0_mac
echo $wifi1_mac
echo $wifi2_mac
echo $wifi3_mac
echo $wifi4_mac
#Update the mac address using ip link command
ifconfig wifi0 down
ifconfig wifi1 down
ifconfig wifi2 down
ifconfig wifi3 down
ifconfig wifi4 down
ifconfig wifi5 down
ifconfig wifi6 down
ifconfig wifi7 down
ip link set dev wifi0 address $wifi0_mac
ip link set dev wifi1 address $wifi3_mac
ip link set dev wifi2 address $wifi2_mac
ip link set dev wifi3 address $wifi3_mac
ip link set dev wifi4 address $wifi4_mac
ifconfig wifi0 up
ifconfig wifi1 up
ifconfig wifi2 up
ifconfig wifi3 up
ifconfig wifi4 up
exit 0 |
...
Prerequisites - One Time Process
1. In /nvram
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
cat EasymeshCfg.json
{
"AL_MAC_ADDR": "00:0c:43:26:60:1b",
"Colocated_mode": 0,
"Backhaul_SSID": "mesh_backhaul",
"Backhaul_KeyPassphrase": "test-backhaul",
"sta_4addr_mode_enabled": true
}
cat InterfaceMap.json
{
"PhyList": [
{
"Index": 0,
"RadioList": [
{
"Index": 2,
"RadioName": "wifi2",
"InterfaceList": [
{
"InterfaceName": "wifi2",
"Bridge": "brlan0",
"vlanId": 0,
"vapIndex": 4,
"vapName": "private_ssid_6g"
}
]
},
{
"Index": 1,
"RadioName": "wifi1",
"InterfaceList": [
{
"InterfaceName": "wifi1.1",
"Bridge": "brlan0",
"vlanId": 0,
"vapIndex": 3,
"vapName": "mesh_sta_5g"
},
{
"InterfaceName": "wifi1",
"Bridge": "brlan0",
"vlanId": 0,
"vapIndex": 2,
"vapName": "private_ssid_5g"
}
|
...
title | InterfaceMap.json |
---|---|
collapse | true |
...
] |
...
|
...
|
...
}, { "Index": |
...
0, "RadioName": " |
...
wifi0", "InterfaceList": [ { "InterfaceName": " |
...
wifi0.1", "Bridge": "brlan0", "vlanId": 0, "vapIndex": 1, "vapName": " |
...
mesh_ |
...
backhaul_ |
...
2g" }, { |
...
"InterfaceName": "wifi0", |
...
"Bridge": "brlan0", |
...
"vlanId": 0, " |
...
vapIndex": 0, " |
...
vapName": " |
...
private_ssid_2g" |
...
} |
...
] } |
...
] } ] } |
onewifi_pre_script.sh with below data,
/usr/ccsp/wifi
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#!/bin/sh sleep 5 #To update al_mac_addr in EasyMeshCfg.json to avoid onewifi restarting during fresh |
...
boot-up
#wan_mac="$(cat /sys/class/ieee80211/phy0/macaddress)"
#old_al_mac_addr=`cat /nvram/EasymeshCfg.json | grep AL_MAC_ADDR | cut -d '"' -f4`
#if [ "$old_al_mac_addr" == "00:00:00:00:00:00" ]; then
# sed -i "s/$old_al_mac_addr/$wan_mac/g" /nvram/EasymeshCfg.json
#fi
iw phy phy0 interface add wifi0 type __ap
iw phy phy0 interface add wifi0.1 type __ap
iw phy phy0 interface add wifi1 type __ap
iw phy phy0 interface add wifi2 type __ap
iw phy phy0 interface add wifi1.1 type __ap
#iw phy phy0 interface add wifi2.1 type __ap
#Obtain the wifi0 mac address
wifi_mac="$(cat /sys/class/ieee80211/phy0/macaddress)"
#Strip the : and increment mac by 1 to get wifi1 macaddress
mac=$(echo $wifi_mac | tr -d ':')
mac_incr=$((0x$mac + 8))
wifi0_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
#Increment again by 1 to get wifi2 address
mac_incr=$(($mac_incr + 1))
wifi0_1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
#Increment again by 1 to get wifi2 address
mac_incr=$(($mac_incr + 1))
wifi1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
mac_incr=$(($mac_incr + 1))
wifi1_1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
mac_incr=$(($mac_incr + 1))
wifi2_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
#print the mac address
echo $wifi0_mac
echo $wifi1_mac
echo $wifi2_mac
#Update the mac address using ip link command
ifconfig wifi0 down
ifconfig wifi0.1 down
ifconfig wifi1 down
ifconfig wifi1.1 down
ifconfig wifi2 down
ip link set dev wifi0 address $wifi0_mac
ip link set dev wifi0.1 address $wifi0_1_mac
ip link set dev wifi1 address $wifi1_mac
ip link set dev wifi1.1 address $wifi1_1_mac
ip link set dev wifi2 address $wifi2_mac
ifconfig wifi0 up
ifconfig wifi1 up
ifconfig wifi1.1 up
ifconfig wifi2 up
exit 0 |
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
/usr/ccsp/EasyMesh#./onewifi_em_agent |
...