Add support for IPv6
Both the listeners and servers now support IPv6 addresses. The namedserverfilter does not yet use the new structures and needs to be fixed in a following commit.
This commit is contained in:
@ -197,7 +197,7 @@ typedef struct dcb
|
||||
int flags; /**< DCB flags */
|
||||
char *remote; /**< Address of remote end */
|
||||
char *user; /**< User name for connection */
|
||||
struct sockaddr_in ipv4; /**< remote end IPv4 address */
|
||||
struct sockaddr_storage ip; /**< remote IPv4/IPv6 address */
|
||||
char *protoname; /**< Name of the protocol */
|
||||
void *protocol; /**< The protocol specific state */
|
||||
size_t protocol_packet_length; /**< How long the protocol specific packet is */
|
||||
@ -240,7 +240,7 @@ typedef struct dcb
|
||||
} DCB;
|
||||
|
||||
#define DCB_INIT {.dcb_chk_top = CHK_NUM_DCB, \
|
||||
.evq = DCBEVENTQ_INIT, .ipv4 = {0}, .func = {0}, .authfunc = {0}, \
|
||||
.evq = DCBEVENTQ_INIT, .ip = {0}, .func = {0}, .authfunc = {0}, \
|
||||
.stats = {0}, .memdata = DCBMM_INIT, \
|
||||
.fd = DCBFD_CLOSED, .stats = DCBSTATS_INIT, .ssl_state = SSL_HANDSHAKE_UNKNOWN, \
|
||||
.state = DCB_STATE_ALLOC, .dcb_chk_tail = CHK_NUM_DCB, \
|
||||
@ -343,6 +343,14 @@ void dcb_process_idle_sessions(int thr);
|
||||
*/
|
||||
bool dcb_foreach(bool (*func)(DCB *, void *), void *data);
|
||||
|
||||
/**
|
||||
* @brief Return the port number this DCB is connected to
|
||||
*
|
||||
* @param dcb DCB to inspect
|
||||
* @return Port number the DCB is connected to or -1 if information is not available
|
||||
*/
|
||||
int dcb_get_port(const DCB *dcb);
|
||||
|
||||
/**
|
||||
* DCB flags values
|
||||
*/
|
||||
|
@ -38,10 +38,28 @@ MXS_BEGIN_DECLS
|
||||
bool utils_init(); /*< Call this first before using any other function */
|
||||
void utils_end();
|
||||
|
||||
int setnonblocking(int fd);
|
||||
int parse_bindconfig(const char *, struct sockaddr_in *);
|
||||
int setipaddress(struct in_addr *, char *);
|
||||
/**
|
||||
* Parse the bind configuration data.
|
||||
*
|
||||
* The configuration is passed as string in the `address|port` format.
|
||||
*
|
||||
* @param config The bind address and port separated by a '|'
|
||||
* @param addr The sockaddr_in6 in which the data is written
|
||||
* @return 1 on success, 0 on failure
|
||||
*/
|
||||
int parse_bindconfig(const char *, struct sockaddr_in6 *, int *);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Create a network socket and a socket configuration
|
||||
*
|
||||
* @param dest Pointer to a struct sockaddr_storage where the configuration is stored
|
||||
* @param host The target host for which the socket is created
|
||||
*
|
||||
* @return The opened socket or -1 on failure
|
||||
*/int create_network_socket(struct sockaddr_storage *, char *);
|
||||
|
||||
int setnonblocking(int fd);
|
||||
char *gw_strend(register const char *s);
|
||||
static char gw_randomchar();
|
||||
int gw_generate_random_str(char *output, int len);
|
||||
|
Reference in New Issue
Block a user