gluon-mesh-batman-adv: unify IPv4 and IPv6 local-node route behavior

Just as was done for IPv6 previously, use the new, separate table for IPv4
local-node, too.

This ensures that we will always only use the source MAC of the
local-node interface if the packet originated from us (locally
generated, not routed) and matches our local-node IPv4 or IPv6
address.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
This commit is contained in:
Linus Lüssing 2018-11-15 01:44:07 +01:00
parent 909363f5b9
commit 8c6a4d8c1a
2 changed files with 12 additions and 2 deletions

View File

@ -23,8 +23,7 @@ uci:section('network', 'device', 'local_node_dev', {
local ip4, ip6 local ip4, ip6
if next_node.ip4 then if next_node.ip4 then
local plen = site.prefix4():match('/%d+$') ip4 = next_node.ip4 .. '/32'
ip4 = next_node.ip4 .. plen
end end
if next_node.ip6 then if next_node.ip6 then

View File

@ -25,7 +25,18 @@ uci:section('network', 'interface', 'client', {
uci:delete('network', 'client_lan') uci:delete('network', 'client_lan')
uci:section('network', 'rule', 'local_node_rule', {
src = next_node.ip4 .. '/32',
lookup = 2,
})
uci:set('network', 'local_node_rule', 'in', 'loopback')
uci:delete('network', 'local_node_route') uci:delete('network', 'local_node_route')
uci:section('network', 'route', 'local_node_route', {
interface = 'local_node',
target = site.prefix4(),
table = 2,
})
uci:section('network', 'rule6', 'local_node_rule6', { uci:section('network', 'rule6', 'local_node_rule6', {
src = next_node.ip6 .. '/128', src = next_node.ip6 .. '/128',