gluon/package/gluon-mesh-layer3-common/luasrc/usr/lib/lua/gluon/l3.lua
Linus Lüssing b3a9221b07 gluon-l3roamd: site: make node_client_prefix6 optional+deprecated
The site.node_client_prefix6() is only used internally by the l3roamd
protocol. Therefore it is unnecessary to expose it to an administrator.

Instead, if node_client_prefix6 is unspecified in the site, generate an
IPv6 Unique Local Address prefix from the site domain_seed.

This updates the site documentation as well and marks this setting as
both optional and deprecated.

Note: If you had the node_client_prefix6 specified before and want to
use the new autogeneration from the domain_seed instead then this will
break compatibility and will need a gluon-scheduled-domain switch.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
2023-01-07 23:41:24 +01:00

21 lines
496 B
Lua

local site = require("gluon.site")
local util = require("gluon.util")
local M = {}
-- returns a prefix generated from the domain-seed
-- for l3roamd -P <node-client-prefix>
function M.node_client_prefix6()
local key = "gluon-l3roamd.node_client_prefix6"
local prefix = site.node_client_prefix6()
if not prefix then
local prefix_seed = util.domain_seed_bytes(key, 7)
prefix = ("fd" .. prefix_seed):gsub(("(%x%x%x%x)"):rep(4), "%1:%2:%3:%4" .. "::/64")
end
return prefix
end
return M