ipsec_goodmask (3) - Linux Manuals
ipsec_goodmask: check if Internet subnet mask is valid, convert Internet subnet mask to bit count, convert bit count to Internet subnet mask
Command to display ipsec_goodmask
manual in Linux: $ man 3 ipsec_goodmask
NAME
ipsec_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
SYNOPSIS
#include <libreswan.h>
int goodmask(struct in_addr mask);
int masktobits(struct in_addr mask);
struct in_addr bitstomask(int n);
DESCRIPTION
These 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.
All masks are in network byte order.
DIAGNOSTICS
Masktobits
returns
-1
for an invalid mask.
Bitstomask
returns an all-zeros mask for a negative or out-of-range
n.
HISTORY
Written for the FreeS/WAN project by Henry Spencer.
BUGS
The error-reporting convention of
bitstomask
is less than ideal;
zero is sometimes a legitimate mask.
Pages related to ipsec_goodmask
- ipsec_anyaddr (3) - get and test for addresses of type "any", "unspecified" and loopback
- ipsec_atoaddr (3) - convert Internet addresses and Subnet masks to and from ASCII
- ipsec_atoasr (3) - convert ASCII to Internet address, subnet, or range, convert Internet address range to ASCII
- ipsec_atoul (3) - convert unsigned-long numbers to and from ASCII
- ipsec_initaddr (3) - initialize an ip_address, get address type of an ip_address, get length of address within an ip_address, get copy of address within an ip_address, get pointer to address within an ip_address
- ipsec_initsubnet (3) - initialize an ip_subnet, initialize a singleton ip_subnet, get address type of an ip_subnet, convert subnet mask to bit count, get base address of an ip_subnet, get subnet mask of an ip_subnet
- ipsec_portof (3) - get port field of an ip_address, set port field of an ip_address, get pointer to internal sockaddr of an ip_address, get length of internal sockaddr of an ip_address
- ipsec_rangetosubnet (3) - convert address range to subnet
- ipsec_sameaddr (3) - do comparisons for addresses, subnets, SA IDs and address families
- ipsec_subnetof (3) - given Internet address and subnet mask return subnet number, host part, broadcast address