From 2f7fec4ddb2c2573346ebece927a8da13bfe448f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 17 Oct 2021 22:02:46 +0200 Subject: yggdrasil-wg: ... --- modules/yggdrasil-wg/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/yggdrasil-wg') diff --git a/modules/yggdrasil-wg/default.nix b/modules/yggdrasil-wg/default.nix index 86e2b98a..6e49214e 100644 --- a/modules/yggdrasil-wg/default.nix +++ b/modules/yggdrasil-wg/default.nix @@ -80,15 +80,12 @@ let linkToGreNetwork = ix: opts@{from, to, ...}: let other = if from == hostName then to else from; - hexIx = let - hexIx' = toHexString ix; - in if (stringLength hexIx' < 2) then "0${hexIx'}" else hexIx'; in nameValuePair "yggre-${other}" { matchConfig = { Name = "yggre-${other}"; }; linkConfig = { - MACAddress = "${greHostMACPrefixes.${hostName}}:${hexIx}"; + MACAddress = "${greHostMACPrefixes.${hostName}}:${toHexByte ix}"; RequiredForOnline = false; }; networkConfig = { @@ -104,6 +101,9 @@ let withoutOpts = listToAttrs (map (nv: nameValuePair nv.name (removeAttrs nv.value [optName])) (filter (x: !(x.value.${optName} or false)) (imap0 (ix: nameValuePair (toString ix)) xs))); in genList (ix: withOpts.${toString ix} or withoutOpts.${toString ix}) (length xs); mkLinks = optIx "udp2raw"; + toHexByte = n: let + hex = toHexString n; + in if (stringLength hex < 2) then "0${hex}" else hex; in { config = { assertions = [ -- cgit v1.2.3