From 79a5fcc1c79c44d130f9b0c99a3198ff6975397a Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 28 Apr 2020 19:25:57 +0200 Subject: [PATCH 01/10] revert commit: lime-proto-batadv: get real and stop trying to push OGMs over ethernet --- .../lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua index 1b973aa7c..ef68c05ca 100644 --- a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua +++ b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua @@ -58,13 +58,13 @@ end function batadv.setup_interface(ifname, args) if not args["specific"] then if ifname:match("^wlan%d+.ap") then return end - if ifname:match("^eth") then return end end local vlanId = args[2] or "%N1" local vlanProto = args[3] or "8021ad" local nameSuffix = args[4] or "_batadv" local mtu = 1532 + if ifname:match("^eth") then mtu = 1496 end --! Unless a specific integer is passed, parse network_id (%N1) template --! and use that number to get a vlanId between 29 and 284 for batadv From c38078306fd8f69bb281f0c344f648f4e143b9de Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 28 Apr 2020 19:31:19 +0200 Subject: [PATCH 02/10] batadv proto randomize mac addresses of included interfaces --- .../files/usr/lib/lua/lime/proto/batadv.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua index ef68c05ca..cbe9efb22 100644 --- a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua +++ b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua @@ -74,8 +74,18 @@ function batadv.setup_interface(ifname, args) local owrtInterfaceName, _, owrtDeviceName = network.createVlanIface(ifname, vlanId, nameSuffix, vlanProto) + --! Avoid dmesg flooding caused by BLA with messages like "br-lan: + --! received packet on bat0 with own address as source address". + --! Randomize MAC address for each of the interfaces included in Batman-adv. + local id = utils.get_id(ifname) + local randomMac = network.primary_mac(); + randomMac[1] = id[1] + randomMac[2] = id[2] + randomMac[3] = id[3] + local uci = config.get_uci_cursor() uci:set("network", owrtDeviceName, "mtu", mtu) + uci:set("network", owrtDeviceName, "macaddr", table.concat(randomMac, ":")) uci:set("network", owrtInterfaceName, "proto", "batadv") uci:set("network", owrtInterfaceName, "mesh", "bat0") uci:save("network") From a0d008284d23f1fa599f367f274efe9716982ee4 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 28 Apr 2020 19:31:53 +0200 Subject: [PATCH 03/10] batadv proto remove dummy0 interface --- .../files/usr/lib/lua/lime/proto/batadv.lua | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua index cbe9efb22..b55008cf6 100644 --- a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua +++ b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua @@ -34,20 +34,6 @@ function batadv.configure(args) uci:save("batman-adv") lan.setup_interface("bat0", nil) - --! Avoid dmesg flooding caused by BLA. Create a dummy0 interface with - --! custom MAC, as dummy0 is created very soon on boot it is added as - --! first and then main interface to batman so BLA messages are sent - --! from that MAC avoiding generating warning like: - --! br-lan: received packet on bat0 with own address as source address - local owrtInterfaceName = network.limeIfNamePrefix.."batadv_dummy_if" - local dummyMac = network.primary_mac(); dummyMac[1] = "aa" - uci:set("network", owrtInterfaceName, "interface") - uci:set("network", owrtInterfaceName, "ifname", "dummy0") - uci:set("network", owrtInterfaceName, "macaddr", table.concat(dummyMac, ":")) - uci:set("network", owrtInterfaceName, "proto", "batadv") - uci:set("network", owrtInterfaceName, "mesh", "bat0") - uci:save("network") - -- enable alfred on bat0 if installed if utils.is_installed("alfred") then uci:set("alfred", "alfred", "batmanif", "bat0") From a41e1c7078f0049a1752ecc238ed79353d39f019 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 28 Apr 2020 19:32:30 +0200 Subject: [PATCH 04/10] batadv proto remove kmod-dummy dependency --- packages/lime-proto-batadv/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lime-proto-batadv/Makefile b/packages/lime-proto-batadv/Makefile index 8c4ec18e1..848b49cbb 100644 --- a/packages/lime-proto-batadv/Makefile +++ b/packages/lime-proto-batadv/Makefile @@ -21,7 +21,7 @@ define Package/$(PKG_NAME) CATEGORY:=LiMe MAINTAINER:=Gioacchino Mazzurco URL:=http://libremesh.org - DEPENDS:=+lime-system +lua +libuci-lua +kmod-batman-adv +kmod-dummy + DEPENDS:=+lime-system +lua +libuci-lua +kmod-batman-adv PKGARCH:=all endef From b4d140038ee29a8239f42d9c9d87d3bf2fa36114 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 28 Apr 2020 19:40:02 +0200 Subject: [PATCH 05/10] shared-state skip exclusion of dummy0 interface --- .../shared-state/files/usr/bin/shared-state-get_candidates_neigh | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh b/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh index c566ff24a..c51cda43b 100755 --- a/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh +++ b/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh @@ -38,7 +38,6 @@ currUptime="$(get_uptime)" candidateAddresses="$( for iface in $(ls /sys/class/net/) ; do - echo ${iface} | grep -q '^dummy' && continue ls /sys/class/net/${iface}/upper_bat? &> /dev/null || continue ping6 -c 2 ff02::1%${iface} 2> /dev/null | \ From 0ef3a26dd57dcadc3689289e3730869be855ed92 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 28 Apr 2020 19:25:57 +0200 Subject: [PATCH 06/10] revert commit: lime-proto-batadv: get real and stop trying to push OGMs over ethernet --- .../lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua index 9e83d8510..481002aa7 100644 --- a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua +++ b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua @@ -78,13 +78,13 @@ end function batadv.setup_interface(ifname, args) if not args["specific"] then if ifname:match("^wlan%d+.ap") then return end - if ifname:match("^eth") then return end end local vlanId = args[2] or "%N1" local vlanProto = args[3] or "8021ad" local nameSuffix = args[4] or "_batadv" local mtu = 1532 + if ifname:match("^eth") then mtu = 1496 end --! Unless a specific integer is passed, parse network_id (%N1) template --! and use that number to get a vlanId between 29 and 284 for batadv From 4ed70e565e2e7ce92ae38d24c34ca23e480ca97f Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 28 Apr 2020 19:31:19 +0200 Subject: [PATCH 07/10] batadv proto randomize mac addresses of included interfaces --- .../files/usr/lib/lua/lime/proto/batadv.lua | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua index 481002aa7..9610c8fd1 100644 --- a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua +++ b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua @@ -54,20 +54,6 @@ function batadv.configure(args) uci:save(cfg_file) lan.setup_interface("bat0", nil) - --! Avoid dmesg flooding caused by BLA. Create a dummy0 interface with - --! custom MAC, as dummy0 is created very soon on boot it is added as - --! first and then main interface to batman so BLA messages are sent - --! from that MAC avoiding generating warning like: - --! br-lan: received packet on bat0 with own address as source address - local owrtInterfaceName = network.limeIfNamePrefix.."batadv_dummy_if" - local dummyMac = network.primary_mac(); dummyMac[1] = "aa" - uci:set("network", owrtInterfaceName, "interface") - uci:set("network", owrtInterfaceName, "ifname", "dummy0") - uci:set("network", owrtInterfaceName, "macaddr", table.concat(dummyMac, ":")) - uci:set("network", owrtInterfaceName, "proto", batadv.ifc_proto) - uci:set("network", owrtInterfaceName, batadv.type_option, "bat0") - uci:save("network") - -- enable alfred on bat0 if installed if utils.is_installed("alfred") then uci:set("alfred", "alfred", "batmanif", "bat0") @@ -94,10 +80,20 @@ function batadv.setup_interface(ifname, args) local owrtInterfaceName, _, owrtDeviceName = network.createVlanIface(ifname, vlanId, nameSuffix, vlanProto) + --! Avoid dmesg flooding caused by BLA with messages like "br-lan: + --! received packet on bat0 with own address as source address". + --! Randomize MAC address for each of the interfaces included in Batman-adv. + local id = utils.get_id(ifname) + local randomMac = network.primary_mac(); + randomMac[1] = id[1] + randomMac[2] = id[2] + randomMac[3] = id[3] + local uci = config.get_uci_cursor() uci:set("network", owrtDeviceName, "mtu", mtu) uci:set("network", owrtInterfaceName, "proto", batadv.ifc_proto) uci:set("network", owrtInterfaceName, batadv.type_option, "bat0") + uci:set("network", owrtDeviceName, "macaddr", table.concat(randomMac, ":")) uci:save("network") end From d24bc0ec19383563ef83973f3ded2b00dd7b3099 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 28 Apr 2020 19:32:30 +0200 Subject: [PATCH 08/10] batadv proto remove kmod-dummy dependency --- packages/lime-proto-batadv/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lime-proto-batadv/Makefile b/packages/lime-proto-batadv/Makefile index 8c4ec18e1..848b49cbb 100644 --- a/packages/lime-proto-batadv/Makefile +++ b/packages/lime-proto-batadv/Makefile @@ -21,7 +21,7 @@ define Package/$(PKG_NAME) CATEGORY:=LiMe MAINTAINER:=Gioacchino Mazzurco URL:=http://libremesh.org - DEPENDS:=+lime-system +lua +libuci-lua +kmod-batman-adv +kmod-dummy + DEPENDS:=+lime-system +lua +libuci-lua +kmod-batman-adv PKGARCH:=all endef From abf6294639984e5121750f129e0b588cbba8a798 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Tue, 28 Apr 2020 19:40:02 +0200 Subject: [PATCH 09/10] shared-state skip exclusion of dummy0 interface --- .../shared-state/files/usr/bin/shared-state-get_candidates_neigh | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh b/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh index c566ff24a..c51cda43b 100755 --- a/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh +++ b/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh @@ -38,7 +38,6 @@ currUptime="$(get_uptime)" candidateAddresses="$( for iface in $(ls /sys/class/net/) ; do - echo ${iface} | grep -q '^dummy' && continue ls /sys/class/net/${iface}/upper_bat? &> /dev/null || continue ping6 -c 2 ff02::1%${iface} 2> /dev/null | \ From 39f524a2ae215111382554759485b40aff53837f Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Fri, 12 Jun 2020 20:34:09 +0200 Subject: [PATCH 10/10] batman-adv vlan first byte of macaddr must end in 10 rework Ilario patch for testing --- .../files/usr/lib/lua/lime/proto/batadv.lua | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua index 9610c8fd1..c421543e7 100644 --- a/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua +++ b/packages/lime-proto-batadv/files/usr/lib/lua/lime/proto/batadv.lua @@ -70,7 +70,6 @@ function batadv.setup_interface(ifname, args) local vlanProto = args[3] or "8021ad" local nameSuffix = args[4] or "_batadv" local mtu = 1532 - if ifname:match("^eth") then mtu = 1496 end --! Unless a specific integer is passed, parse network_id (%N1) template --! and use that number to get a vlanId between 29 and 284 for batadv @@ -80,20 +79,29 @@ function batadv.setup_interface(ifname, args) local owrtInterfaceName, _, owrtDeviceName = network.createVlanIface(ifname, vlanId, nameSuffix, vlanProto) - --! Avoid dmesg flooding caused by BLA with messages like "br-lan: - --! received packet on bat0 with own address as source address". - --! Randomize MAC address for each of the interfaces included in Batman-adv. - local id = utils.get_id(ifname) - local randomMac = network.primary_mac(); - randomMac[1] = id[1] - randomMac[2] = id[2] - randomMac[3] = id[3] - local uci = config.get_uci_cursor() - uci:set("network", owrtDeviceName, "mtu", mtu) uci:set("network", owrtInterfaceName, "proto", batadv.ifc_proto) uci:set("network", owrtInterfaceName, batadv.type_option, "bat0") - uci:set("network", owrtDeviceName, "macaddr", table.concat(randomMac, ":")) + + if ifname:match("^eth") then + --! TODO: Use DSA to check if ethernet device is capable of bigger MTU + --! reducing it + mtu = 1496 + + --! Avoid dmesg flooding caused by BLA with messages like "br-lan: + --! received packet on bat0 with own address as source address". + --! Tweak MAC address for each of the interfaces used by Batman-adv + --! 00 + Locally administered unicast .. 2 bytes from interface name + --! .. 3 bytes from main interface + local id = utils.get_id(ifname) + local vMacaddr = network.primary_mac(); + vMacaddr[1] = "02" + vMacaddr[2] = id[2] + vMacaddr[3] = id[3] + uci:set("network", owrtDeviceName, "macaddr", table.concat(vMacaddr, ":")) + end + + uci:set("network", owrtDeviceName, "mtu", mtu) uci:save("network") end