Skip to content

Commit 398846f

Browse files
RDKB-59404: OpenWRT: Add iot vap in InterfaceMap and scripts (rdkcentral#559)
Reason for change: Add support for iot vap in InterfaceMap, wifi_interface_up.sh and wifi_interface_down.sh scripts. Risks: None Priority: P1 Co-authored-by: Narendra Varma Dandu <narendandu@gmail.com>
1 parent 7ab1d1f commit 398846f

3 files changed

Lines changed: 82 additions & 10 deletions

File tree

config/openwrt/banana-pi/InterfaceMap.json

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,22 @@
3131
"InterfaceName": "wifi1.1",
3232
"Bridge": "br-lan",
3333
"vlanId": 0,
34-
"vapIndex": 15,
35-
"vapName": "mesh_sta_5g"
34+
"vapIndex": 13,
35+
"vapName": "mesh_backhaul_5g"
3636
},
3737
{
3838
"InterfaceName": "wifi1.2",
3939
"Bridge": "br-lan",
4040
"vlanId": 0,
41-
"vapIndex": 13,
42-
"vapName": "mesh_backhaul_5g"
41+
"vapIndex": 3,
42+
"vapName": "iot_ssid_5g"
43+
},
44+
{
45+
"InterfaceName": "wifi1.3",
46+
"Bridge": "br-lan",
47+
"vlanId": 0,
48+
"vapIndex": 15,
49+
"vapName": "mesh_sta_5g"
4350
}
4451
]
4552
},
@@ -53,6 +60,20 @@
5360
"vlanId": 0,
5461
"vapIndex": 0,
5562
"vapName": "private_ssid_2g"
63+
},
64+
{
65+
"InterfaceName": "wifi0.1",
66+
"Bridge": "br-lan",
67+
"vlanId": 0,
68+
"vapIndex": 12,
69+
"vapName": "mesh_backhaul_2g"
70+
},
71+
{
72+
"InterfaceName": "wifi0.2",
73+
"Bridge": "br-lan",
74+
"vlanId": 0,
75+
"vapIndex": 2,
76+
"vapName": "iot_ssid_2g"
5677
}
5778
]
5879
}

config/openwrt/banana-pi/wifi_interface_down.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,24 @@
22

33
echo "Bringing down all wifi interfaces and deleting it"
44
ifconfig wifi0 down
5+
ifconfig wifi0.1 down
6+
ifconfig wifi0.2 down
57
ifconfig wifi1 down
68
ifconfig wifi1.1 down
79
ifconfig wifi1.2 down
10+
ifconfig wifi1.3 down
811
ifconfig wifi2 down
12+
#ifconfig wifi2.1 down
13+
#ifconfig wifi2.2 down
914

1015
#delete the interfaces
1116
iw dev wifi0 del
17+
iw dev wifi0.1 del
18+
iw dev wifi0.2 del
1219
iw dev wifi1 del
1320
iw dev wifi1.1 del
1421
iw dev wifi1.2 del
22+
iw dev wifi1.3 del
1523
iw dev wifi2 del
24+
#iw dev wifi2.1 del
25+
#iw dev wifi2.2 del

config/openwrt/banana-pi/wifi_interface_up.sh

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
/etc/init.d/wpad stop
44

55
iw phy phy0 interface add wifi0 type __ap
6+
iw phy phy0 interface add wifi0.1 type __ap
7+
iw phy phy0 interface add wifi0.2 type __ap
68
iw phy phy0 interface add wifi1 type __ap
79
iw phy phy0 interface add wifi1.1 type __ap
810
iw phy phy0 interface add wifi1.2 type __ap
11+
iw phy phy0 interface add wifi1.3 type __ap
912
iw phy phy0 interface add wifi2 type __ap
13+
#iw phy phy0 interface add wifi2.1 type __ap
14+
#iw phy phy0 interface add wifi2.2 type __ap
1015

1116
#Derive the initial wifi mac address from eth0 or erouter0 address
1217
#as they are unique for each Banana PI
@@ -28,51 +33,87 @@ else
2833
fi
2934

3035
#Obtain the wifi0 mac address from primary_wifi_mac by converting to str format
31-
wifi0_mac=$(printf "%012x" $primary_wifi_mac | sed 's/../&:/g;s/:$//')
32-
#Increment primary_wifi_mac by 1 to get wifi1_mac
33-
mac_incr=$(($primary_wifi_mac + 1))
36+
mac_incr=$(($primary_wifi_mac + 0))
37+
wifi0_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
38+
#Increment again by 1 to get wifi0.1_mac
39+
mac_incr=$(($mac_incr + 1))
40+
wifi0_1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
41+
#Increment again by 1 to get wifi0.2_mac
42+
mac_incr=$(($mac_incr + 1))
43+
wifi0_2_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
44+
#Increment primary_wifi_mac by 0x10 (decimal 16) to get wifi1 address
45+
mac_incr=$(($primary_wifi_mac + 16))
3446
wifi1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
3547
#Increment again by 1 to get wifi1.1 address
3648
mac_incr=$(($mac_incr + 1))
3749
wifi1_1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
3850
#Increment again by 1 to get wifi1.2 address
3951
mac_incr=$(($mac_incr + 1))
4052
wifi1_2_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
41-
#Increment again by 1 to get wifi2 address
53+
#Increment again by 1 to get wifi1.3 address
4254
mac_incr=$(($mac_incr + 1))
55+
wifi1_3_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
56+
#Increment primary_wifi_mac by 0x20 (decimal 32) to get wifi2 address
57+
mac_incr=$(($primary_wifi_mac + 32))
4358
wifi2_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
59+
#Increment again by 1 to get wifi2.1 address
60+
#mac_incr=$(($mac_incr + 1))
61+
#wifi2_1_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
62+
#Increment again by 1 to get wifi2.2 address
63+
#mac_incr=$(($mac_incr + 1))
64+
#wifi2_2_mac=$(printf "%012x" $mac_incr | sed 's/../&:/g;s/:$//')
4465
#print the mac address
4566
echo $wifi0_mac
67+
echo $wifi0_1_mac
68+
echo $wifi0_2_mac
4669
echo $wifi1_mac
4770
echo $wifi1_1_mac
4871
echo $wifi1_2_mac
72+
echo $wifi1_3_mac
4973
echo $wifi2_mac
74+
#echo $wifi2_1_mac
75+
#echo $wifi2_2_mac
5076

5177
#Update the mac address using ip link command
5278
ifconfig wifi0 down
79+
ifconfig wifi0.1 down
80+
ifconfig wifi0.2 down
5381
ifconfig wifi1 down
5482
ifconfig wifi1.1 down
5583
ifconfig wifi1.2 down
84+
ifconfig wifi1.3 down
5685
ifconfig wifi2 down
86+
#ifconfig wifi2.1 down
87+
#ifconfig wifi2.2 down
5788
ip link set dev wifi0 address $wifi0_mac
89+
ip link set dev wifi0.1 address $wifi0_1_mac
90+
ip link set dev wifi0.2 address $wifi0_2_mac
5891
ip link set dev wifi1 address $wifi1_mac
5992
ip link set dev wifi1.1 address $wifi1_1_mac
6093
ip link set dev wifi1.2 address $wifi1_2_mac
94+
ip link set dev wifi1.3 address $wifi1_3_mac
6195
ip link set dev wifi2 address $wifi2_mac
96+
#ip link set dev wifi2.1 address $wifi2_1_mac
97+
#ip link set dev wifi2.2 address $wifi2_2_mac
6298
ifconfig wifi0 up
99+
ifconfig wifi0.1 up
100+
ifconfig wifi0.2 up
63101
ifconfig wifi1 up
64102
ifconfig wifi1.1 up
65103
ifconfig wifi1.2 up
104+
ifconfig wifi1.3 up
66105
ifconfig wifi2 up
106+
#ifconfig wifi2.1 up
107+
#ifconfig wifi2.2 up
67108

68109

69110
#Copy configuration file to nvram
70111
mkdir -p /nvram
71112
cp InterfaceMap.json /nvram/.
72113

73114
# Create the EasyMeshCfg.json which will have the al_mac_address
74-
# same as that of wifi_1_1_mac
75-
al_mac_addr=$wifi1_1_mac
115+
# same as that of sta wifi_1_3_mac
116+
al_mac_addr=$wifi1_3_mac
76117
colocated_mode=0
77118
backhaul_ssid="mesh_backhaul"
78119
backhaul_keypassphrase="test-backhaul"

0 commit comments

Comments
 (0)