-
-
Notifications
You must be signed in to change notification settings - Fork 114
Testing Batman-adv on ethernet #703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
79a5fcc
c380783
a0d0082
a41e1c7
b4d1400
0ef3a26
4ed70e5
d24bc0e
abf6294
39f524a
3182477
2b7f6c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
|
@@ -58,13 +44,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 | ||
|
|
@@ -74,8 +60,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, ":")) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This used to break linux 802.1{ad,q} at least when bridges and vlans operates on same hard interface, if the mac of the vlan is different from the one on the hard interface (what you are doing here) the packets get sucked by the bridge and never get to the vlan interface. I haven't tested this recently but this happened at least until last libremesh stable release. |
||
| uci:set("network", owrtInterfaceName, "proto", "batadv") | ||
| uci:set("network", owrtInterfaceName, "mesh", "bat0") | ||
| uci:save("network") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some bits of first byte of the mac have special meanings, so it cannot be totally random. Also at first glance I think we can just change the firs two bytes with something fixed making sure multicast bit is 0 and locally administered bit is 1 https://en.wikipedia.org/wiki/MAC_address#/media/File:MAC-48_Address.svg