IPSEC_GOODMASKSection: C Library Functions (3)
Updated: 13 Oct 1998
Index Return to Main Contents
NAMEipsec goodmask - is this Internet subnet mask a valid one?
ipsec masktobits - convert Internet subnet mask to bit count
ipsec bitstomask - convert bit count to Internet subnet mask
DESCRIPTIONGoodmask 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.
SEE ALSOinet(3), ipsec_atosubnet(3)
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.
This document was created by man2html, using the manual pages.
Time: 04:38:15 GMT, May 22, 2000