net.c File Reference

#include <config.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <isc/log.h>
#include <isc/msgs.h>
#include <isc/net.h>
#include <isc/netdb.h>
#include <isc/once.h>
#include <isc/strerror.h>
#include <isc/string.h>
#include <isc/util.h>

Go to the source code of this file.

Defines

#define ISC_SOCKADDR_LEN_T   unsigned int
#define ISC_NET_PORTRANGELOW   1024
 Definitions about UDP port range specification. This is a total mess of portability variants: some use sysctl (but the sysctl names vary), some use system-specific interfaces, some have the same interface for IPv4 and IPv6, some separate them, etc...
#define ISC_NET_PORTRANGEHIGH   65535

Functions

static isc_result_t try_proto (int domain)
static void initialize_action (void)
static void initialize (void)
isc_result_t isc_net_probeipv4 (void)
 Check if the system's kernel supports IPv4.
isc_result_t isc_net_probeipv6 (void)
 Check if the system's kernel supports IPv6.
isc_result_t isc_net_probeunix (void)
isc_result_t isc_net_probe_ipv6only (void)
 Check if the system's kernel supports the IPV6_V6ONLY socket option.
isc_result_t isc_net_probe_ipv6pktinfo (void)
static ISC_SOCKADDR_LEN_T cmsg_len (ISC_SOCKADDR_LEN_T len)
static ISC_SOCKADDR_LEN_T cmsg_space (ISC_SOCKADDR_LEN_T len)
static void try_dscp_v4 (void)
static void try_dscp_v6 (void)
static void try_dscp (void)
static void initialize_dscp (void)
unsigned int isc_net_probedscp (void)
 Probe the level of DSCP support.
isc_result_t isc_net_getudpportrange (int af, in_port_t *low, in_port_t *high)
 Returns system's default range of ephemeral UDP ports, if defined. If the range is not available or unknown, ISC_NET_PORTRANGELOW and ISC_NET_PORTRANGEHIGH will be returned.
void isc_net_disableipv4 (void)
void isc_net_disableipv6 (void)
void isc_net_enableipv4 (void)
void isc_net_enableipv6 (void)

Variables

static isc_once_t once = ISC_ONCE_INIT
static isc_once_t once_dscp = ISC_ONCE_INIT
static isc_result_t ipv4_result = ISC_R_NOTFOUND
static isc_result_t ipv6_result = ISC_R_NOTFOUND
static isc_result_t unix_result = ISC_R_NOTFOUND
static isc_result_t ipv6only_result = ISC_R_NOTFOUND
static isc_result_t ipv6pktinfo_result = ISC_R_NOTFOUND
static unsigned int dscp_result = 0


Define Documentation

#define ISC_SOCKADDR_LEN_T   unsigned int

Definition at line 46 of file net.c.

Referenced by cmsg_len(), internal_accept(), and internal_connect().

#define ISC_NET_PORTRANGELOW   1024

Definitions about UDP port range specification. This is a total mess of portability variants: some use sysctl (but the sysctl names vary), some use system-specific interfaces, some have the same interface for IPv4 and IPv6, some separate them, etc...

The last resort defaults: use all non well known port space

Definition at line 60 of file net.c.

Referenced by isc_net_getudpportrange().

#define ISC_NET_PORTRANGEHIGH   65535

Definition at line 63 of file net.c.

Referenced by isc_net_getudpportrange().


Function Documentation

static isc_result_t try_proto ( int  domain  )  [static]

Definition at line 129 of file net.c.

References isc__strerror(), isc_lctx, ISC_LOG_ERROR, isc_log_write(), ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_MSG_FAILED, isc_msgcat_get(), ISC_MSGSET_GENERAL, ISC_R_NOTFOUND, ISC_R_SUCCESS, ISC_R_UNEXPECTED, ISC_STRERRORSIZE, PF_INET6, s, and UNEXPECTED_ERROR.

Referenced by initialize_action().

static void initialize_action ( void   )  [static]

Definition at line 210 of file net.c.

References ipv4_result, ipv6_result, PF_INET6, try_proto(), and unix_result.

static void initialize ( void   )  [static]

Definition at line 225 of file net.c.

References initialize_action(), isc_once_do, ISC_R_SUCCESS, once, and RUNTIME_CHECK.

isc_result_t isc_net_probeipv4 ( void   ) 

Check if the system's kernel supports IPv4.

Returns:

Definition at line 230 of file net.c.

References initialize(), and ipv4_result.

Referenced by add_listener(), bind9_getaddresses(), do_scan(), get_view_querysource_dispatch(), listener_bind(), ns_controls_configure(), parse_command_line(), setup_libs(), and setup_system().

isc_result_t isc_net_probeipv6 ( void   ) 

Check if the system's kernel supports IPv6.

Returns:

Definition at line 236 of file net.c.

References initialize(), and ipv6_result.

Referenced by add_listener(), bind9_getaddresses(), do_scan(), get_view_querysource_dispatch(), isc_interfaceiter_create(), listener_bind(), load_configuration(), ns_controls_configure(), parse_command_line(), setup_libs(), and setup_system().

isc_result_t isc_net_probeunix ( void   ) 

Definition at line 242 of file net.c.

References initialize(), and unix_result.

Referenced by add_listener().

isc_result_t isc_net_probe_ipv6only ( void   ) 

Check if the system's kernel supports the IPV6_V6ONLY socket option.

Returns:

Definition at line 384 of file net.c.

References ipv6only_result, and ISC_R_NOTFOUND.

Referenced by do_scan().

isc_result_t isc_net_probe_ipv6pktinfo ( void   ) 

Definition at line 396 of file net.c.

References ipv6pktinfo_result, and ISC_R_NOTFOUND.

Referenced by do_scan().

static ISC_SOCKADDR_LEN_T cmsg_len ( ISC_SOCKADDR_LEN_T  len  )  [inline, static]

Definition at line 410 of file net.c.

References ISC_SOCKADDR_LEN_T.

Referenced by build_msghdr_send(), and cmsg_space().

static ISC_SOCKADDR_LEN_T cmsg_space ( ISC_SOCKADDR_LEN_T  len  )  [inline, static]

Definition at line 426 of file net.c.

References cmsg_len().

Referenced by build_msghdr_send().

static void try_dscp_v4 ( void   )  [static]

Definition at line 615 of file net.c.

References dscp_result, isc__strerror(), isc_lctx, ISC_LOG_DEBUG, isc_log_write(), ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_NET_DSCPPKTV4, ISC_NET_DSCPRECVV4, ISC_NET_DSCPSETV4, and ISC_STRERRORSIZE.

static void try_dscp_v6 ( void   )  [static]

Definition at line 686 of file net.c.

static void try_dscp ( void   )  [static]

Definition at line 747 of file net.c.

static void initialize_dscp ( void   )  [static]

Definition at line 753 of file net.c.

unsigned int isc_net_probedscp ( void   ) 

Probe the level of DSCP support.

Definition at line 758 of file net.c.

Referenced by ATF_TC_BODY(), and socket_create().

isc_result_t isc_net_getudpportrange ( int  af,
in_port_t *  low,
in_port_t *  high 
)

Returns system's default range of ephemeral UDP ports, if defined. If the range is not available or unknown, ISC_NET_PORTRANGELOW and ISC_NET_PORTRANGEHIGH will be returned.

Requires:

Returns:

Definition at line 839 of file net.c.

References ISC_NET_PORTRANGEHIGH, ISC_NET_PORTRANGELOW, ISC_R_FAILURE, ISC_R_SUCCESS, REQUIRE, and UNUSED.

Referenced by load_configuration().

void isc_net_disableipv4 ( void   ) 

Definition at line 882 of file net.c.

Referenced by dash_option(), parse_args(), and parse_command_line().

void isc_net_disableipv6 ( void   ) 

Definition at line 889 of file net.c.

Referenced by dash_option(), parse_args(), and parse_command_line().

void isc_net_enableipv4 ( void   ) 

Definition at line 896 of file net.c.

void isc_net_enableipv6 ( void   ) 

Definition at line 903 of file net.c.


Variable Documentation

isc_once_t once = ISC_ONCE_INIT [static]

Definition at line 118 of file net.c.

isc_once_t once_dscp = ISC_ONCE_INIT [static]

Definition at line 119 of file net.c.

isc_result_t ipv4_result = ISC_R_NOTFOUND [static]

Definition at line 121 of file net.c.

Referenced by initialize_action(), and isc_net_probeipv4().

isc_result_t ipv6_result = ISC_R_NOTFOUND [static]

Definition at line 122 of file net.c.

Referenced by initialize_action(), and isc_net_probeipv6().

isc_result_t unix_result = ISC_R_NOTFOUND [static]

Definition at line 123 of file net.c.

Referenced by initialize_action(), and isc_net_probeunix().

isc_result_t ipv6only_result = ISC_R_NOTFOUND [static]

Definition at line 124 of file net.c.

Referenced by isc_net_probe_ipv6only().

isc_result_t ipv6pktinfo_result = ISC_R_NOTFOUND [static]

Definition at line 125 of file net.c.

Referenced by isc_net_probe_ipv6pktinfo().

unsigned int dscp_result = 0 [static]

Definition at line 126 of file net.c.

Referenced by try_dscp_v4().


Generated on Tue Apr 28 17:41:19 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha