mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-07 08:07:42 +00:00
wgengine/router: simplify func normalizeCIDR using netaddr method
This commit is contained in:
parent
38629b62fc
commit
96a488e37e
@ -1020,9 +1020,7 @@ func tsChain(chain string) string {
|
|||||||
// normalizeCIDR returns cidr as an ip/mask string, with the host bits
|
// normalizeCIDR returns cidr as an ip/mask string, with the host bits
|
||||||
// of the IP address zeroed out.
|
// of the IP address zeroed out.
|
||||||
func normalizeCIDR(cidr netaddr.IPPrefix) string {
|
func normalizeCIDR(cidr netaddr.IPPrefix) string {
|
||||||
ncidr := cidr.IPNet()
|
return cidr.Masked().String()
|
||||||
nip := ncidr.IP.Mask(ncidr.Mask)
|
|
||||||
return fmt.Sprintf("%s/%d", nip, cidr.Bits)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanup(logf logger.Logf, interfaceName string) {
|
func cleanup(logf logger.Logf, interfaceName string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user