inet6_is_srcaddr Subroutine
Purpose
Verifies that a given local address meets address selection preferences.
Library
Library (libc.a)
Syntax
# include <netinet/in.h>
int inet6_is_srcaddr(struct sockaddr_in6 *srcaddr, uint32_t flags);
Description
inet6_is_src_addr verifies that a local address corresponds to the set of address selection preference flags specified in flags.
The values of address selection preference flags are:
- IPV6_PREFER_SRC_HOME: prefer addresses reachable from a Home source address
- IPV6_PREFER_SRC_COA: prefer addresses reachable from a Care-of source address
- IPV6_PREFER_SRC_TMP: prefer addresses reachable from a temporary address
- IPV6_PREFER_SRC_PUBLIC: the prefer addresses reachable from a public source address
- IPV6_PREFER_SRC_CGA: the prefer addresses reachable from a Cryptographically Generated Address (CGA) source address
- IPV6_PREFER_SRC_NONCGA: the prefer addresses reachable from a non-CGA source address.
- To check if srcaddr is a Care-of address, flags must be set to IPV6_PREFER_SRC_COA.
- To check if srcaddr is a CGA and a public address, flags must be set to IPV6_PREFER_SRC_CGA | IPV6_PREFER_SRC_PUBLIC.
Parameters
Item | Description |
---|---|
srcaddr | Points to a sockaddr_in6 structure containing the source address to check |
flags | Specifies the address selection preferences. |
Return Values
- The subroutine returns 1 when the given address corresponds to a local address and satisfies the address selection preferences.
- The subroutine returns -1 if the given address is not a local address or if flags does not specify one of the valid address selection flag value
- The subroutine returns 0 if the given address is a local address but does not satisfies the address selection preferences