diff --git a/meshcomms/files/meshcomms.conf b/meshcomms/files/meshcomms.conf index 7d6a3a5c4..5ecf9bf0d 100644 --- a/meshcomms/files/meshcomms.conf +++ b/meshcomms/files/meshcomms.conf @@ -1,5 +1,6 @@ config meshcomms 'global' option basemacint 'wan' + list interfaces 'lan' list interfaces 'wan' option mapall true option debug false diff --git a/meshcomms/files/meshcomms.init b/meshcomms/files/meshcomms.init index df4a51686..59cb2e911 100644 --- a/meshcomms/files/meshcomms.init +++ b/meshcomms/files/meshcomms.init @@ -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