ipsec_goodmask (3) - Linux Man Pages
ipsec_goodmask: check if Internet subnet mask is valid, convert Internet subnet mask to bit count, convert bit count to Internet subnet mask
NAMEipsec_goodmask, ipsec_masktobits, ipsec_bitstomask - check if Internet subnet mask is valid, convert Internet subnet mask to bit count, convert bit count to Internet subnet mask
DESCRIPTIONThese functions are obsolete; see ipsec_masktocount(3) for a partial replacement.
Goodmask reports whether the subnet mask is a valid one, i.e. consists of a (possibly empty) sequence of 1s followed by a (possibly empty) sequence of 0s. Masktobits takes a (valid) subnet mask and returns the number of 1 bits in it. Bitstomask reverses this, returning the subnet mask corresponding to bit count n.
DIAGNOSTICSMasktobits returns -1 for an invalid mask. Bitstomask returns an all-zeros mask for a negative or out-of-range n.
HISTORYWritten for the FreeS/WAN project by Henry Spencer.
BUGSThe error-reporting convention of bitstomask is less than ideal; zero is sometimes a legitimate mask.