diff --git a/src/pkg/net/ip.go b/src/pkg/net/ip.go index 0ad27faebb5..61dc3be909c 100644 --- a/src/pkg/net/ip.go +++ b/src/pkg/net/ip.go @@ -65,8 +65,9 @@ func IPv4Mask(a, b, c, d byte) IPMask { return p } -// CIDRMask returns an IPMask of size bits with the first n bits -// set to to 1. nil is returned if the mask is impossible. +// CIDRMask returns an IPMask consisting of `ones' 1 bits +// followed by 0s up to a total length of `bits' bits. +// For a mask of this form, CIDRMask is the inverse of IPMask.Size. func CIDRMask(ones, bits int) IPMask { if bits != 8*IPv4len && bits != 8*IPv6len { return nil