Query: ipsec_rangetosubnet
OS: centos
Section: 3
Links: centos man pages all man pages
Forums: unix linux community forum categories
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
IPSEC_RANGETOSUBNET(3) 8 Sept 2000 IPSEC_RANGETOSUBNET(3)NAMEipsec_rangetosubnet - convert address range to subnetSYNOPSIS#include <freeswan.h> const char *rangetosubnet(const ip_address * start, const ip_address * stop, ip_subnet * dst);DESCRIPTIONRangetosubnet accepts two IP addresses which define an address range, from start to stop inclusive, and converts this to a subnet if possible. The addresses must both be IPv4 or both be IPv6, and the address family of the resulting subnet is the same. Rangetosubnet returns NULL for success and a pointer to a string-literal error message for failure; see DIAGNOSTICS.SEE ALSOipsec_initsubnet(3), ipsec_ttosubnet(3)DIAGNOSTICSFatal errors in rangetosubnet are: mixed address families; unknown address family; start and stop do not define a subnet.HISTORYWritten for the FreeS/WAN project by Henry Spencer.BUGSThe restriction of error reports to literal strings (so that callers don't need to worry about freeing them or copying them) does limit the precision of error reporting. The error-reporting convention lends itself to slightly obscure code, because many readers will not think of NULL as signifying success. A good way to make it clearer is to write something like: const char *error; error = rangetosubnet( /* ... */ ); if (error != NULL) { /* something went wrong */ 8 Sept 2000 11/14/2008 IPSEC_RANGETOSUBNET(3)