if (strcasecmp(my_bind_addr_str, MY_BIND_ALL_ADDRESSES) == 0)
{
/*
That's the case when bind-address is set to a special value ('*'),
meaning "bind to all available IP addresses". If the box supports
the IPv6 stack, that means binding to '::'. If only IPv4 is available,
bind to '0.0.0.0'.
*/
bool ipv6_available= false;
if (!getaddrinfo(ipv6_all_addresses, port_buf, &hints, &ai))
{
/*
IPv6 might be available (the system might be able to resolve an IPv6
address, but not be able to create an IPv6-socket). Try to create a
dummy IPv6-socket. Do not instrument that socket by P_S.
*/
=================================================
/**
MY_BIND_ALL_ADDRESSES defines a special value for the bind-address option,
which means that the server should listen to all available network addresses,
both IPv6 (if available) and IPv4.
Basically, this value instructs the server to make an attempt to bind the
server socket to '::' address, and rollback to '0.0.0.0' if the attempt fails.
*/
const char *MY_BIND_ALL_ADDRESSES= "*";
This is how the code looks in activate_tcp_port:
if (strcasecmp( my_bind_ addr_str, MY_BIND_ ALL_ADDRESSES) == 0)
{
/*
That's the case when bind-address is set to a special value ('*'),
meaning "bind to all available IP addresses". If the box supports
the IPv6 stack, that means binding to '::'. If only IPv4 is available,
bind to '0.0.0.0'.
*/
bool ipv6_available= false;
if (!getaddrinfo( ipv6_all_ addresses, port_buf, &hints, &ai))
{
/*
IPv6 might be available (the system might be able to resolve an IPv6
address, but not be able to create an IPv6-socket). Try to create a
dummy IPv6-socket. Do not instrument that socket by P_S.
*/
MYSQL_SOCKET s= mysql_socket_ socket( 0, AF_INET6, SOCK_STREAM, 0);
ipv6_ available= mysql_socket_ getfd(s) != INVALID_SOCKET;
mysql_ socket_ close(s) ;
}
if (ipv6_available) print_informati on("IPv6 is available.");
{
sql_
// Address info (ai) for IPv6 address is already set.
bind_ address_ str= ipv6_all_addresses; print_informati on("IPv6 is not available.");
}
else
{
sql_
// Retrieve address info (ai) for IPv4 address.
if (getaddrinfo( ipv4_all_ addresses, port_buf, &hints, &ai))
sql_perror( ER_DEFAULT( ER_IPSOCK_ ERROR)) ;
sql_print_ error(" Can't start server: cannot resolve hostname!");
unireg_ abort(1) ;
{
}
bind_ address_ str= ipv4_all_addresses; my_bind_ addr_str, port_buf, &hints, &ai)) perror( ER_DEFAULT( ER_IPSOCK_ ERROR)) ; /* purecov: tested */ print_error( "Can't start server: cannot resolve hostname!"); abort(1) ; /* purecov: tested */
}
}
else
{
if (getaddrinfo(
{
sql_
sql_
unireg_
}
bind_ address_ str= my_bind_addr_str;
}
======= ======= ======= ======= ======= ======= ======= ======= =====
It should be handled similarly in wsrep_check_ip.
======= ======= ======= ======= ======= ======= ======= ALL_ADDRESSES defines a special value for the bind-address option,
/**
MY_BIND_
which means that the server should listen to all available network addresses,
both IPv6 (if available) and IPv4.
Basically, this value instructs the server to make an attempt to bind the ALL_ADDRESSES= "*";
server socket to '::' address, and rollback to '0.0.0.0' if the attempt fails.
*/
const char *MY_BIND_
======= ======= ======= ======= ======= ======= ======= ====