-
Notifications
You must be signed in to change notification settings - Fork 98
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
Support Babeld without VLAN on ethernet interfaces inside br-lan #600
Changes from 5 commits
3d23da3
80caad6
3420b51
bc78e61
fbe0bc8
1e34f93
4b98f6d
070ddce
ed74e98
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ define Package/$(PKG_NAME) | |
URL:=http://libremesh.org | ||
DEPENDS:=+dnsmasq-dhcpv6 @(!PACKAGE_dnsmasq) +ebtables +libuci-lua \ | ||
+lime-system +lua +kmod-ebtables +kmod-macvlan \ | ||
+shared-state +shared-state-dnsmasq_leases | ||
+shared-state +shared-state-dnsmasq_leases +kmod-ebtables-ipv6 | ||
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. Didn't you fixed this in another PR? here it seems unrelated 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. That kernel module is needed both by anygw (see #599) and Babeld in case of no VLAN and presence of Batman. 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. Gosh, now I noticed that this file was actually not pertaining to this PR, sorry. |
||
PKGARCH:=all | ||
endef | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ define Package/$(PKG_NAME) | |
CATEGORY:=LiMe | ||
MAINTAINER:=Gioacchino Mazzurco <[email protected]> | ||
URL:=https://libremesh.org | ||
DEPENDS:=+babeld +lime-system | ||
DEPENDS:=+babeld +lime-system +PACKAGE_lime-proto-batadv:kmod-ebtables-ipv6 | ||
PKGARCH:=all | ||
endef | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,17 +103,54 @@ function babeld.setup_interface(ifname, args) | |
local vlanProto = args[3] or "8021ad" | ||
local nameSuffix = args[4] or "_babeld" | ||
|
||
local addIPtoIf = true | ||
|
||
--! If Babeld is without VLAN (vlanId is 0) it cannot run directly | ||
--! on ethernet interfaces which are inside of a bridge (e.g. eth0 or eth0.1) | ||
--! because they cannot have an IPv6 Link-Local, so Babeld has to run on | ||
--! the bridge interface br-lan | ||
--! If Babeld's Hello packets run over Batman-adv (whose bat0 is also | ||
--! included in br-lan), the links will have a wrong quality metric, | ||
--! so these hello on bat0 have to be filtered | ||
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. It is not that they have a wrong quality metric, it's that babeld will see all nodes as direct neighbours through batman 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. mh... Isn't this the same? But ok, I'll change the text :) 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. no it is not the same |
||
if tonumber(vlanId) == 0 then | ||
local hasBatman = false | ||
local babeldOverBatman = config.get_bool("network", "babeld_over_batman") | ||
local hasLan = false | ||
for _,protoArgs in pairs(config.get("network", "protocols")) do | ||
local proto = utils.split(protoArgs, network.protoParamsSeparator)[1] | ||
if(proto == "lan") then hasLan = true | ||
elseif(proto == "batadv") then hasBatman = true end | ||
end | ||
|
||
if hasLan and ifname:match("^eth%d") then | ||
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. What happens with wan port? Or port manually configured with ground routing? 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. Also consider to move this to configure method as it don't seems to need to be run for each interface, run it once seems enough 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.
Woops... With this PR, WAN port is not anymore used by Babeld.
table.
Ports configured with specific configuration are not treated by the whole section.
Sounds good! 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.
Wait, the ebtables rule can be in the configuration part, but the 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.
It all depends on what kind of configuration they got, if they have babled specified as proto they get there too 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.
Networking is a complex problem, every apparently dumb change usually have unexpectedly complex implications to handle 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.
I was wrong, interfaces with specific configuration are treated by this section.
The answer to my question was: no, interfaces configured via ground routing should not be touched by this fix and they will never be included in br-lan.
Interfaces managed by ground routing will never have VLAN ID 0, right? If this is correct, they will never trigger the fix and the problem is solved. Otherwise, how can I check if the interface is also configured for ground routing? |
||
ifname = "br-lan" | ||
addIPtoIf = false | ||
if hasBatman and not babeldOverBatman then | ||
ifname = "br-lan" | ||
fs.mkdir("/etc/firewall.lime.d") | ||
fs.writefile("/etc/firewall.lime.d/21-babeld-not-over-bat0-ebtables", | ||
"ebtables -t nat -A POSTROUTING -o bat0 -p ipv6".. | ||
" --ip6-proto udp --ip6-sport 6696 --ip6-dport 6696 -j DROP\n") | ||
else | ||
fs.remove("/etc/firewall.lime.d/21-babeld-not-over-bat0-ebtables") | ||
end | ||
end | ||
end | ||
|
||
local owrtInterfaceName, linuxVlanIfName, owrtDeviceName = | ||
network.createVlanIface(ifname, vlanId, nameSuffix, vlanProto) | ||
|
||
local ipv4, _ = network.primary_address() | ||
|
||
local uci = config.get_uci_cursor() | ||
|
||
uci:set("network", owrtInterfaceName, "proto", "static") | ||
uci:set("network", owrtInterfaceName, "ipaddr", ipv4:host():string()) | ||
uci:set("network", owrtInterfaceName, "netmask", "255.255.255.255") | ||
uci:save("network") | ||
if addIPtoIf then | ||
local ipv4, _ = network.primary_address() | ||
|
||
uci:set("network", owrtInterfaceName, "ifname", "@"..owrtDeviceName) | ||
uci:set("network", owrtInterfaceName, "proto", "static") | ||
uci:set("network", owrtInterfaceName, "ipaddr", ipv4:host():string()) | ||
uci:set("network", owrtInterfaceName, "netmask", "255.255.255.255") | ||
uci:save("network") | ||
end | ||
|
||
uci:set("babeld", owrtInterfaceName, "interface") | ||
uci:set("babeld", owrtInterfaceName, "ifname", linuxVlanIfName) | ||
|
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.
@ilario When someone would want to change from
false
totrue
? If there is not known useful use case I prefer not to add more options.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.
I agree with you, and I'll remove this.
I added this originally just because the same was present for BMX6 over Batman-adv