From 7ae766bd8ad854c5df7433d0c696a1e3dd14ab95 Mon Sep 17 00:00:00 2001 From: niten Date: Fri, 3 Nov 2023 12:29:09 -0700 Subject: [PATCH] Print the min & max IPs --- lib/lib/ip.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/lib/ip.nix b/lib/lib/ip.nix index b5f6fd5..8d24514 100644 --- a/lib/lib/ip.nix +++ b/lib/lib/ip.nix @@ -49,9 +49,7 @@ in rec { in intToIpv4 (leftShift (rightShift fullMask insignificantBits) insignificantBits); - networkMinIp = network: - intToIpv4 - (1 + (ipv4ToInt (getNetworkBase (trace "NETWORK: ${network}" network)))); + networkMinIp = network: intToIpv4 (1 + (ipv4ToInt (getNetworkBase network))); networkMaxIp = network: intToIpv4 (rightPadBits (ipv4ToInt (getNetworkBase network)) @@ -67,8 +65,8 @@ in rec { ip-int = ipv4ToInt ip; net-min = networkMinIp network; net-max = networkMaxIp network; - in (ip-int >= (ipv4ToInt networkMinIp)) - && (ip-int <= (ipv4ToInt networkMaxIp)); + in (ip-int >= (ipv4ToInt (trace "MIN-IP: ${networkMinIp}" networkMinIp))) + && (ip-int <= (ipv4ToInt (trace "MIN-IP: ${networkMinIp}" networkMaxIp))); getNetworkMask = network: toInt (elemAt (splitString "/" network) 1);