Skip to content

Commit

Permalink
gluon-core: move from site_seed to domain_seed.
Browse files Browse the repository at this point in the history
  • Loading branch information
lemoer committed Sep 13, 2017
1 parent d652dfd commit 767be0c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/site-example/site.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
-- 32 bytes of random data, encoded in hexacimal
-- Must be the same of all nodes in one mesh domain
-- Can be generated using: echo $(hexdump -n 32 -e '1/1 "%02x"' </dev/urandom)
site_seed = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
domain_seed = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',

-- Prefixes used within the mesh.
-- prefix6 is required, prefix4 can be omitted if next_node.ip4
Expand Down
2 changes: 1 addition & 1 deletion docs/user/site.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ site_code
The code of your community. It is good practice to use the TLD of
your community here.

site_seed
domain_seed
32 bytes of random data, encoded in hexadecimal, used to seed other random
values specific to the mesh domain. It must be the same for all nodes of one
mesh, but should be different for firmwares that are not supposed to mesh with
Expand Down
2 changes: 1 addition & 1 deletion package/gluon-core/check_site.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
need_site_string 'site_code'
need_site_string 'site_name'
need_site_string_match('site_seed', '^' .. ('%x'):rep(64) .. '$')
need_domain_string_match('domain_seed', '^' .. ('%x'):rep(64) .. '$')

-- TODO: it should be checked for existance!
need_site_string 'default_domain'
Expand Down
2 changes: 1 addition & 1 deletion package/gluon-core/files/lib/netifd/proto/gluon_wired.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ proto_gluon_wired_setup() {
json_add_string tunlink "$config"
json_add_string ip6addr "$(interface_linklocal "$ifname")"
json_add_string peer6addr 'ff02::15c'
json_add_int vid "$(lua -lgluon.util -e 'print(tonumber(gluon.util.site_seed_bytes("gluon-mesh-vxlan", 3), 16))')"
json_add_int vid "$(lua -lgluon.util -e 'print(tonumber(gluon.util.domain_seed_bytes("gluon-mesh-vxlan", 3), 16))')"
json_close_object
ubus call network add_dynamic "$(json_dump)"
fi
Expand Down
4 changes: 2 additions & 2 deletions package/gluon-core/luasrc/usr/lib/lua/gluon/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function node_id()
return string.gsub(sysconfig.primary_mac, ':', '')
end

function site_seed_bytes(key, length)
function domain_seed_bytes(key, length)
local ret = ''
local v = ''
local i = 0
Expand All @@ -131,7 +131,7 @@ function site_seed_bytes(key, length)
-- cryptographic strength
while ret:len() < 2*length do
i = i + 1
v = hash.md5(v .. key .. site.site_seed():lower() .. i)
v = hash.md5(v .. key .. site.domain_seed():lower() .. i)
ret = ret .. v
end

Expand Down

0 comments on commit 767be0c

Please sign in to comment.