Skip to content
Snippets Groups Projects
Unverified Commit fb85d96d authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-next-node: don't require next_node.ip6

The next-node interface may be useful with IPv4 only or even just a MAC
address. This prepares merging gluon-next-node into gluon-batman-adv-core.
parent fcf3abd9
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,6 @@ if need_string_match('next_node.ip4', '^%d+.%d+.%d+.%d+$', false) then ...@@ -2,6 +2,6 @@ if need_string_match('next_node.ip4', '^%d+.%d+.%d+.%d+$', false) then
need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$') need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$')
end end
need_string_match('next_node.ip6', '^[%x:]+$') need_string_match('next_node.ip6', '^[%x:]+$', false)
need_string_match('next_node.mac', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$') need_string_match('next_node.mac', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$')
...@@ -16,7 +16,9 @@ if next_node.ip4 then ...@@ -16,7 +16,9 @@ if next_node.ip4 then
rule('OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-source ' .. next_node.ip4 .. ' -j DROP') rule('OUTPUT --logical-out br-client -o bat0 -p IPv4 --ip-source ' .. next_node.ip4 .. ' -j DROP')
end end
rule('FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-destination ' .. next_node.ip6 .. ' -j DROP') if next_node.ip6 then
rule('OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-destination ' .. next_node.ip6 .. ' -j DROP') rule('FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-destination ' .. next_node.ip6 .. ' -j DROP')
rule('FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-source ' .. next_node.ip6 .. ' -j DROP') rule('OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-destination ' .. next_node.ip6 .. ' -j DROP')
rule('OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-source ' .. next_node.ip6 .. ' -j DROP') rule('FORWARD --logical-out br-client -o bat0 -p IPv6 --ip6-source ' .. next_node.ip6 .. ' -j DROP')
rule('OUTPUT --logical-out br-client -o bat0 -p IPv6 --ip6-source ' .. next_node.ip6 .. ' -j DROP')
end
...@@ -17,13 +17,17 @@ c:section('network', 'device', 'local_node_dev', ...@@ -17,13 +17,17 @@ c:section('network', 'device', 'local_node_dev',
} }
) )
local ip4, netmask local ip4, netmask, ip6
if site.next_node.ip4 then if site.next_node.ip4 then
ip4 = site.next_node.ip4 ip4 = site.next_node.ip4
netmask = ip.IPv4(site.prefix4):mask():string() netmask = ip.IPv4(site.prefix4):mask():string()
end end
if site.next_node.ip6 then
ip6 = site.next_node.ip6 .. '/128'
end
c:delete('network', 'local_node') c:delete('network', 'local_node')
c:section('network', 'interface', 'local_node', c:section('network', 'interface', 'local_node',
{ {
...@@ -31,7 +35,7 @@ c:section('network', 'interface', 'local_node', ...@@ -31,7 +35,7 @@ c:section('network', 'interface', 'local_node',
proto = 'static', proto = 'static',
ipaddr = ip4, ipaddr = ip4,
netmask = netmask, netmask = netmask,
ip6addr = site.next_node.ip6 .. '/128', ip6addr = ip6,
} }
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment