rangetosubnet3
Convert address range to subnet
Usage
#include <freeswan.h>
const char *rangetosubnet(const ip_address *start, const ip_address *stop, ip_subnet *dst);
Overview
Rangetosubnet 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.
Diagnostics
Fatal errors in rangetosubnet are: mixed address families; unknown address family; start and stop do not define a subnet.