meshcomms: Add lan in interface list

This commit is contained in:
vdutta 2019-11-01 17:03:48 +05:30
parent 97853638bf
commit c0bef6ce70
2 changed files with 17 additions and 11 deletions

View file

@ -1,5 +1,6 @@
config meshcomms 'global'
option basemacint 'wan'
list interfaces 'lan'
list interfaces 'wan'
option mapall true
option debug false

View file

@ -10,25 +10,30 @@ validate_global_section()
{
uci_validate_section meshcomms meshcomms "${1}" \
'basemacint:string:wan' \
'interfaces:string' \
'interfaces:string:lan' \
'mapall:bool:true' \
'debug:bool:true' \
'port:port:8888'
}
get_l3_interface() {
local l3
get_device_name() {
local device
# Get wan L3 interface
json_load "$(ubus -t 2 call network.interface.${1} status)"
json_get_var l3 l3_device
echo ${l3}
ubus list |grep -iq network.interface.${1}
if [ "$?" -eq 0 ]; then
json_load "$(ubus -t 2 call network.interface.${1} status)"
json_get_var device device
echo ${device}
fi
}
get_interface_mac() {
local l3 basemac
l3=$(get_l3_interface ${1})
json_load "$(ubus -t 2 call network.device status "{\"name\":\"${l3}\"}")"
json_get_var basemac macaddr
l3=$(get_device_name ${1})
if [ -n ${l3} ]; then
json_load "$(ubus -t 2 call network.device status "{\"name\":\"${l3}\"}")"
json_get_var basemac macaddr
fi
echo ${basemac}
}
@ -52,7 +57,7 @@ configure_meshcomms()
for f in ${interfaces}
do
local l3=$(get_l3_interface $f)
local l3=$(get_device_name $f)
intf="${intf} ${l3}"
done
intf=$(echo $intf|sed 's/ /,/g')
@ -73,7 +78,7 @@ configure_meshcomms()
}
configure_network() {
ebtables -L FORWARD |grep -iq "01:80:c2:00:00:13 -j DROP"
ebtables -L FORWARD|grep -iqE "1:80:C2:(0)+:(0)+:13.*-j.*DROP"
if [ "$?" -ne 0 ]; then
echo "Applying drop rule to drop pkts forwared by kernel to 1905.1 multicast mac"
ebtables -A FORWARD -d 01:80:c2:00:00:13 -j DROP