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.
This commit is contained in:
parent
fcf3abd9c4
commit
fb85d96d5e
@ -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
|
|||||||
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',
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
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',
|
|||||||
proto = 'static',
|
proto = 'static',
|
||||||
ipaddr = ip4,
|
ipaddr = ip4,
|
||||||
netmask = netmask,
|
netmask = netmask,
|
||||||
ip6addr = site.next_node.ip6 .. '/128',
|
ip6addr = ip6,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user