From 49232423cac1a9dc54d3836255c41c63f99e75d8 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 24 Apr 2021 23:17:01 +0000 Subject: [PATCH] lib: ip: verify ip is valid in 'check' --- lib/ip.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ip.nix b/lib/ip.nix index c79c502..2af3fef 100644 --- a/lib/ip.nix +++ b/lib/ip.nix @@ -65,7 +65,8 @@ rec { from = baseIp; to = zipListsWith (b: m: 255 - m + b) baseIp mask; }; - check = ip: baseIp == zipListsWith (b: m: bitAnd b m) ip mask; + check = + ip: isValidIp4 ip && baseIp == zipListsWith (b: m: bitAnd b m) ip mask; try = if baseIp == givenIp then id