lib: ip: verify ip is valid in 'check'

This commit is contained in:
Bruno BELANYI 2021-04-24 23:17:01 +00:00
parent 0112dd87ac
commit 49232423ca
1 changed files with 2 additions and 1 deletions

View File

@ -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