From 0fe9459587b95490660d7b2aa89260e6cca483dd Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Sat, 11 Sep 2021 22:53:41 +0200
Subject: [PATCH] Improve he-dns script to exclude IPv6 ULAs when determining
 address

---
 modules/he-dns.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/he-dns.nix b/modules/he-dns.nix
index d88139b..527626c 100644
--- a/modules/he-dns.nix
+++ b/modules/he-dns.nix
@@ -73,7 +73,7 @@ let
   '';
   ddnsV6Script = domainCfg: flags: ''
     # take the first global (should be routable) primary (to filter out privacy extension addresses) ipv6 address
-    myip="$(${pkgs.iproute2}/bin/ip -json -6 address show scope global primary | ${pkgs.jq}/bin/jq --raw-output '.[0].addr_info | map(.local | strings) | .[0]')"
+    myip="$(${pkgs.iproute2}/bin/ip -json -6 address show scope global primary | ${pkgs.jq}/bin/jq --raw-output '.[0].addr_info | map(.local | strings | select(startswith("fc") or startswith("fd") | not)) | .[0]')"
     # ensure we have a valid v6 address
     if ${pkgs.iproute2}/bin/ip route get "$myip" >/dev/null &>/dev/null
     then
-- 
GitLab