From 07b1b244d60aea19795cc3d206910d63bdddbdba Mon Sep 17 00:00:00 2001 From: vishalnayak Date: Wed, 21 Sep 2016 20:29:33 -0400 Subject: [PATCH] Use net.IPv4zero to check for zero address --- helper/cidrutil/cidr.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helper/cidrutil/cidr.go b/helper/cidrutil/cidr.go index 7b3dfbcf1..d5ab477f0 100644 --- a/helper/cidrutil/cidr.go +++ b/helper/cidrutil/cidr.go @@ -130,7 +130,7 @@ func Subset(cidr1, cidr2 string) (bool, error) { } maskLen1, _ := net1.Mask.Size() - if ip1.To4().String() != "0.0.0.0" && maskLen1 == 0 { + if ip1.To4().Equal(net.IPv4zero) && maskLen1 == 0 { return false, fmt.Errorf("CIDR to be checked against is not in its canonical form") } @@ -140,7 +140,7 @@ func Subset(cidr1, cidr2 string) (bool, error) { } maskLen2, _ := net2.Mask.Size() - if ip2.To4().String() != "0.0.0.0" && maskLen2 == 0 { + if ip2.To4().Equal(net.IPv4zero) && maskLen2 == 0 { return false, fmt.Errorf("CIDR that needs to be checked is not in its canonical form") }