#include <isc/lang.h>
#include <isc/net.h>
#include <isc/types.h>
Go to the source code of this file.
Data Structures | |
struct | isc_netaddr |
Defines | |
#define | ISC_NETADDR_H 1 |
#define | ISC_NETADDR_FORMATSIZE sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX%SSSSSSSSSS") |
Minimum size of array to pass to isc_netaddr_format(). | |
Functions | |
isc_boolean_t | isc_netaddr_equal (const isc_netaddr_t *a, const isc_netaddr_t *b) |
Compare network addresses 'a' and 'b'. Return ISC_TRUE if they are equal, ISC_FALSE if not. | |
isc_boolean_t | isc_netaddr_eqprefix (const isc_netaddr_t *a, const isc_netaddr_t *b, unsigned int prefixlen) |
Compare the 'prefixlen' most significant bits of the network addresses 'a' and 'b'. If 'b''s scope is zero then 'a''s scope is ignored. Return ISC_TRUE if they are equal, ISC_FALSE if not. | |
isc_result_t | isc_netaddr_masktoprefixlen (const isc_netaddr_t *s, unsigned int *lenp) |
Convert a netmask in 's' into a prefix length in '*lenp'. The mask should consist of zero or more '1' bits in the most most significant part of the address, followed by '0' bits. If this is not the case, ISC_R_MASKNONCONTIG is returned. | |
isc_result_t | isc_netaddr_totext (const isc_netaddr_t *netaddr, isc_buffer_t *target) |
Append a text representation of 'sockaddr' to the buffer 'target'. The text is NOT null terminated. Handles IPv4 and IPv6 addresses. | |
void | isc_netaddr_format (const isc_netaddr_t *na, char *array, unsigned int size) |
Format a human-readable representation of the network address '*na' into the character array 'array', which is of size 'size'. The resulting string is guaranteed to be null-terminated. | |
void | isc_netaddr_fromsockaddr (isc_netaddr_t *netaddr, const isc_sockaddr_t *source) |
void | isc_netaddr_fromin (isc_netaddr_t *netaddr, const struct in_addr *ina) |
void | isc_netaddr_fromin6 (isc_netaddr_t *netaddr, const struct in6_addr *ina6) |
isc_result_t | isc_netaddr_frompath (isc_netaddr_t *netaddr, const char *path) |
void | isc_netaddr_setzone (isc_netaddr_t *netaddr, isc_uint32_t zone) |
isc_uint32_t | isc_netaddr_getzone (const isc_netaddr_t *netaddr) |
void | isc_netaddr_any (isc_netaddr_t *netaddr) |
Return the IPv4 wildcard address. | |
void | isc_netaddr_any6 (isc_netaddr_t *netaddr) |
Return the IPv6 wildcard address. | |
isc_boolean_t | isc_netaddr_ismulticast (isc_netaddr_t *na) |
Returns ISC_TRUE if the address is a multicast address. | |
isc_boolean_t | isc_netaddr_isexperimental (isc_netaddr_t *na) |
Returns ISC_TRUE if the address is a experimental (CLASS E) address. | |
isc_boolean_t | isc_netaddr_islinklocal (isc_netaddr_t *na) |
Returns ISC_TRUE if the address is a link local address. | |
isc_boolean_t | isc_netaddr_issitelocal (isc_netaddr_t *na) |
Returns ISC_TRUE if the address is a site local address. | |
void | isc_netaddr_fromv4mapped (isc_netaddr_t *t, const isc_netaddr_t *s) |
Convert an IPv6 v4mapped address into an IPv4 address. | |
isc_result_t | isc_netaddr_prefixok (const isc_netaddr_t *na, unsigned int prefixlen) |
Definition in file netaddr.h.
#define ISC_NETADDR_FORMATSIZE sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX%SSSSSSSSSS") |
Minimum size of array to pass to isc_netaddr_format().
Definition at line 98 of file netaddr.h.
Referenced by cfg_acl_fromconfig2(), cfg_print_sockaddr(), check_dns64(), check_servers(), dns_sdlzssumatch(), dns_ssu_external_match(), dump_entry(), getaddresses(), is_answeraddress_allowed(), isblackholed(), log_query(), ns_lwresd_parseeresolvconf(), possibly_mark(), set_nameserver(), soa_query(), and udp_recv().
isc_boolean_t isc_netaddr_equal | ( | const isc_netaddr_t * | a, | |
const isc_netaddr_t * | b | |||
) |
Compare network addresses 'a' and 'b'. Return ISC_TRUE if they are equal, ISC_FALSE if not.
Definition at line 36 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, ISC_FALSE, ISC_TRUE, REQUIRE, isc_netaddr::type, and isc_netaddr::zone.
Referenced by check_servers(), dns_zone_notifyreceive(), do_scan(), and zmgr_start_xfrin_ifquota().
isc_boolean_t isc_netaddr_eqprefix | ( | const isc_netaddr_t * | a, | |
const isc_netaddr_t * | b, | |||
unsigned int | prefixlen | |||
) |
Compare the 'prefixlen' most significant bits of the network addresses 'a' and 'b'. If 'b''s scope is zero then 'a''s scope is ignored. Return ISC_TRUE if they are equal, ISC_FALSE if not.
Definition at line 69 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, INSIST, ISC_FALSE, ISC_TRUE, REQUIRE, isc_netaddr::type, and isc_netaddr::zone.
Referenced by dns_peerlist_peerbyaddr(), and isc_sockaddr_eqaddrprefix().
isc_result_t isc_netaddr_masktoprefixlen | ( | const isc_netaddr_t * | s, | |
unsigned int * | lenp | |||
) |
Convert a netmask in 's' into a prefix length in '*lenp'. The mask should consist of zero or more '1' bits in the most most significant part of the address, followed by '0' bits. If this is not the case, ISC_R_MASKNONCONTIG is returned.
Returns:
Definition at line 249 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, ISC_R_MASKNONCONTIG, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, and isc_netaddr::type.
Referenced by ns_lwresd_parseeresolvconf(), and setup_locals().
isc_result_t isc_netaddr_totext | ( | const isc_netaddr_t * | netaddr, | |
isc_buffer_t * | target | |||
) |
Append a text representation of 'sockaddr' to the buffer 'target'. The text is NOT null terminated. Handles IPv4 and IPv6 addresses.
Returns:
Definition at line 127 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, INSIST, isc_buffer_availablelength, isc_buffer_putmem, ISC_R_FAILURE, ISC_R_NOSPACE, ISC_R_SUCCESS, r, REQUIRE, isc_netaddr::type, and isc_netaddr::zone.
Referenced by cfg_print_rawaddr(), dns_sdlzallowzonexfr(), isc_netaddr_format(), isc_sockaddr_totext(), make_log_buf(), and ns_lwresd_parseeresolvconf().
void isc_netaddr_format | ( | const isc_netaddr_t * | na, | |
char * | array, | |||
unsigned int | size | |||
) |
Format a human-readable representation of the network address '*na' into the character array 'array', which is of size 'size'. The resulting string is guaranteed to be null-terminated.
Definition at line 182 of file netaddr.c.
References isc_netaddr::family, isc_buffer_availablelength, isc_buffer_init, isc_buffer_putuint8, ISC_MSG_UNKNOWNADDR, isc_msgcat_get(), ISC_MSGSET_NETADDR, isc_netaddr_totext(), ISC_R_NOSPACE, and ISC_R_SUCCESS.
Referenced by cfg_acl_fromconfig2(), cfg_print_sockaddr(), check_dns64(), check_servers(), dns_sdlzssumatch(), dns_ssu_external_match(), dump_entry(), getaddresses(), internal_current4(), is_answeraddress_allowed(), isblackholed(), log_query(), ns_lwresd_parseeresolvconf(), possibly_mark(), set_nameserver(), soa_query(), and udp_recv().
void isc_netaddr_fromsockaddr | ( | isc_netaddr_t * | netaddr, | |
const isc_sockaddr_t * | source | |||
) |
Definition at line 335 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, INSIST, isc_sockaddr::sa, isc_sockaddr::sin, isc_sockaddr::sin6, sockaddr_in6::sin6_addr, sockaddr_in6::sin6_scope_id, isc_netaddr::type, isc_sockaddr::type, and isc_netaddr::zone.
Referenced by address_ok(), cfg_print_sockaddr(), check_dns64(), check_zoneconf(), client_newconn(), client_ok(), client_request(), client_send(), client_sendpkg(), configure_staticstub_serveraddrs(), configure_view(), dns64_aaaaok(), dns_rrl(), dns_sdlzallowzonexfr(), dns_zone_notifyreceive(), dump_entry(), fctx_query(), getaddresses(), got_transfer_quota(), isblackholed(), isc_sockaddr_eqaddrprefix(), isc_sockaddr_isexperimental(), isc_sockaddr_islinklocal(), isc_sockaddr_ismulticast(), isc_sockaddr_issitelocal(), isc_sockaddr_totext(), lwaddr_lwresaddr_fromsockaddr(), notify_isself(), notify_send_toaddr(), ns_client_checkacl(), ns_client_checkaclsilent(), ns_client_isself(), ns_lwresd_parseeresolvconf(), ns_query(), ns_xfr_start(), possibly_mark(), print_querysource(), query_dns64(), resquery_send(), rpz_rewrite(), set_nameserver(), setup_query_sortlist(), soa_query(), sort_addresses(), udp_recv(), update_action(), and zmgr_start_xfrin_ifquota().
void isc_netaddr_fromin | ( | isc_netaddr_t * | netaddr, | |
const struct in_addr * | ina | |||
) |
Definition at line 289 of file netaddr.c.
References isc_netaddr::family, isc_netaddr::in, and isc_netaddr::type.
Referenced by ATF_TC_BODY(), dns_dns64_aaaafroma(), do_scan(), is_answeraddress_allowed(), lwaddr_netaddr_fromlwresaddr(), rdata_tonetaddr(), rpz_rewrite_ip_rrset(), and token_addr().
void isc_netaddr_fromin6 | ( | isc_netaddr_t * | netaddr, | |
const struct in6_addr * | ina6 | |||
) |
Definition at line 296 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in6, and isc_netaddr::type.
Referenced by add_listenelt(), bind9_getaddresses(), client_request(), dns_dns64_aaaaok(), do_scan(), is_answeraddress_allowed(), lwaddr_netaddr_fromlwresaddr(), rdata_tonetaddr(), rpz_rewrite_ip_rrset(), and token_addr().
isc_result_t isc_netaddr_frompath | ( | isc_netaddr_t * | netaddr, | |
const char * | path | |||
) |
Definition at line 303 of file netaddr.c.
References isc_netaddr::family, ISC_R_NOSPACE, ISC_R_NOTIMPLEMENTED, ISC_R_SUCCESS, isc_netaddr::type, UNUSED, and isc_netaddr::zone.
void isc_netaddr_setzone | ( | isc_netaddr_t * | netaddr, | |
isc_uint32_t | zone | |||
) |
Definition at line 322 of file netaddr.c.
References AF_INET6, isc_netaddr::family, REQUIRE, and isc_netaddr::zone.
Referenced by bind9_getaddresses(), client_request(), do_scan(), get_addr(), and token_addr().
isc_uint32_t isc_netaddr_getzone | ( | const isc_netaddr_t * | netaddr | ) |
Definition at line 330 of file netaddr.c.
References isc_netaddr::zone.
Referenced by check_zoneconf(), configure_staticstub_serveraddrs(), and isc_sockaddr_fromnetaddr().
void isc_netaddr_any | ( | isc_netaddr_t * | netaddr | ) |
Return the IPv4 wildcard address.
Definition at line 363 of file netaddr.c.
References isc_netaddr::family, isc_netaddr::in, and isc_netaddr::type.
Referenced by do_scan(), parse_querysource(), and token_addr().
void isc_netaddr_any6 | ( | isc_netaddr_t * | netaddr | ) |
Return the IPv6 wildcard address.
Definition at line 370 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in6, in6addr_any, and isc_netaddr::type.
Referenced by do_scan(), parse_querysource(), and token_addr().
isc_boolean_t isc_netaddr_ismulticast | ( | isc_netaddr_t * | na | ) |
Returns ISC_TRUE if the address is a multicast address.
Definition at line 377 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, IN6_IS_ADDR_MULTICAST, ISC_FALSE, ISC_IPADDR_ISMULTICAST, ISC_TF, and isc_netaddr::type.
Referenced by isc_sockaddr_ismulticast().
isc_boolean_t isc_netaddr_isexperimental | ( | isc_netaddr_t * | na | ) |
Returns ISC_TRUE if the address is a experimental (CLASS E) address.
Definition at line 389 of file netaddr.c.
References isc_netaddr::family, isc_netaddr::in, ISC_FALSE, ISC_IPADDR_ISEXPERIMENTAL, ISC_TF, and isc_netaddr::type.
Referenced by isc_sockaddr_isexperimental().
isc_boolean_t isc_netaddr_islinklocal | ( | isc_netaddr_t * | na | ) |
Returns ISC_TRUE if the address is a link local address.
Definition at line 399 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in6, IN6_IS_ADDR_LINKLOCAL, ISC_FALSE, ISC_TF, and isc_netaddr::type.
Referenced by isc_sockaddr_islinklocal().
isc_boolean_t isc_netaddr_issitelocal | ( | isc_netaddr_t * | na | ) |
Returns ISC_TRUE if the address is a site local address.
Definition at line 411 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in6, IN6_IS_ADDR_SITELOCAL, ISC_FALSE, ISC_TF, and isc_netaddr::type.
Referenced by isc_sockaddr_issitelocal().
void isc_netaddr_fromv4mapped | ( | isc_netaddr_t * | t, | |
const isc_netaddr_t * | s | |||
) |
Convert an IPv6 v4mapped address into an IPv4 address.
Definition at line 423 of file netaddr.c.
References AF_INET6, DE_CONST, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, IN6_IS_ADDR_V4MAPPED, REQUIRE, and isc_netaddr::type.
Referenced by dns_acl_match2(), and dns_zone_notifyreceive().
isc_result_t isc_netaddr_prefixok | ( | const isc_netaddr_t * | na, | |
unsigned int | prefixlen | |||
) |
Definition at line 214 of file netaddr.c.
References AF_INET6, isc_netaddr::family, isc_netaddr::in, isc_netaddr::in6, INSIST, ISC_R_FAILURE, ISC_R_NOTIMPLEMENTED, ISC_R_RANGE, ISC_R_SUCCESS, isc_netaddr::type, and zeros.
Referenced by check_servers(), and dns_dns64_create().