ipsec_sameaddr(3)

ipsec_sameaddr3

Do comparisons for addresses, subnets, sa ids and address families

Usage

#include <freeswan.h>

int sameaddr(const ip_address *a, const ip_address *b);
int addrcmp(const ip_address *a, const ip_address *b);
int samesubnet(const ip_subnet *a, const ip_subnet *b);
int addrinsubnet(const ip_address *a, const ip_subnet *s);
int subnetinsubnet(const ip_subnet *a, const ip_subnet *b);
int subnetishost(const ip_subnet *s);
int samesaid(const ip_said *a, const ip_said *b);
int sameaddrtype(const ip_address *a, const ip_address *b);
int samesubnettype(const ip_subnet *a, const ip_subnet *b);

Overview

These functions do various comparisons and tests on the ip_address type and ip_subnet types.

Sameaddr returns non-zero if addresses a and b are identical, and 0 otherwise. Addresses of different families are never identical.

Addrcmp returns -1, 0, or 1 respectively if address a is less than, equal to, or greater than b. If they are not of the same address family, they are never equal; the ordering reported in this case is arbitrary (and probably not useful) but consistent.

Samesubnet returns non-zero if subnets a and b are identical, and 0 otherwise. Subnets of different address families are never identical.

Addrinsubnet returns non-zero if address a is within subnet s and 0 otherwise. An address is never within a subnet of a different address family.

Subnetinsubnet returns non-zero if subnet a is a subset of subnet b and 0 otherwise. A subnet is deemed to be a subset of itself. A subnet is never a subset of another subnet if their address families differ.

Subnetishost returns non-zero if subnet s is in fact only a single host, and 0 otherwise.

Samesaid returns non-zero if SA IDs a and b are identical, and 0 otherwise.

Sameaddrtype returns non-zero if addresses a and b are of the same address family, and 0 otherwise.

Samesubnettype returns non-zero if subnets a and b are of the same address family, and 0 otherwise.

Releases

4 releases since Debian 3.1 (Sarge); the text changed 3 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 7

History

Written for the FreeS/WAN project by Henry Spencer.

From openswan 1:2.6.37-3+deb7u1 in Debian 7 (Wheezy). Parsed by carta from the page's man source.