From 96a488e37ecc8cf0d57b8009eab4ed270617eb18 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 17 Feb 2021 21:35:33 -0800 Subject: [PATCH] wgengine/router: simplify func normalizeCIDR using netaddr method --- wgengine/router/router_linux.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wgengine/router/router_linux.go b/wgengine/router/router_linux.go index c3724d77f..ec6359e11 100644 --- a/wgengine/router/router_linux.go +++ b/wgengine/router/router_linux.go @@ -1020,9 +1020,7 @@ func tsChain(chain string) string { // normalizeCIDR returns cidr as an ip/mask string, with the host bits // of the IP address zeroed out. func normalizeCIDR(cidr netaddr.IPPrefix) string { - ncidr := cidr.IPNet() - nip := ncidr.IP.Mask(ncidr.Mask) - return fmt.Sprintf("%s/%d", nip, cidr.Bits) + return cidr.Masked().String() } func cleanup(logf logger.Logf, interfaceName string) {