#!/usr/bin/lua

local site = require 'gluon.site'
local util = require 'gluon.util'
local uci = require('simple-uci').cursor()


-- fix up potentially duplicate MAC addresses (for meshing)
if not site.mesh.vxlan(true) then
	uci:set('network', 'wan', 'macaddr', util.generate_mac(0))
end
if uci:get('network', 'mesh_other') then
	uci:set('network', 'mesh_other', 'macaddr', util.generate_mac(4))
end
uci:save('network')
