ircd: server connection configuration

Fix the server connection configuration so that it can simultaneously
handle a hostname/IPv4/IPv6 for connecting and a hostname/IPv4/IPv6
for binding. Maintains backwards compatibility for matching a hostname
with a mask.

Multiple host/vhost entries can be specified and the last value for
each address family is stored. Hostnames that resolve automatically
overwrite the IP address.

Server connections can now be made to either IPv4 or IPv6 at random
as well as preferring a specific address family.
This commit is contained in:
Simon Arlott 2016-04-24 17:05:05 +01:00
parent 65f43a4fc4
commit d4214e9445
No known key found for this signature in database
GPG key ID: C8975F2043CA5D24
9 changed files with 248 additions and 121 deletions

View file

@ -282,14 +282,10 @@ struct server_info
char *description;
char *network_name;
int hub;
struct sockaddr_in ip;
struct rb_sockaddr_storage bind4;
int default_max_clients;
#ifdef RB_IPV6
struct sockaddr_in6 ip6;
#endif
int specific_ipv4_vhost;
#ifdef RB_IPV6
int specific_ipv6_vhost;
struct rb_sockaddr_storage bind6;
#endif
char *ssl_private_key;
char *ssl_ca_cert;

View file

@ -178,7 +178,13 @@ extern const char *get_oper_privs(int flags);
struct server_conf
{
char *name;
char *host;
char *connect_host;
struct rb_sockaddr_storage connect4;
uint16_t dns_query_connect4;
#ifdef RB_IPV6
struct rb_sockaddr_storage connect6;
uint16_t dns_query_connect6;
#endif
char *passwd;
char *spasswd;
char *certfp;
@ -188,17 +194,20 @@ struct server_conf
time_t hold;
int aftype;
struct rb_sockaddr_storage my_ipnum;
char *bind_host;
struct rb_sockaddr_storage bind4;
uint16_t dns_query_bind4;
#ifdef RB_IPV6
struct rb_sockaddr_storage bind6;
uint16_t dns_query_bind6;
#endif
char *class_name;
struct Class *class;
rb_dlink_node node;
uint16_t dns_query;
};
#define SERVER_ILLEGAL 0x0001
#define SERVER_VHOSTED 0x0002
#define SERVER_ENCRYPTED 0x0004
#define SERVER_COMPRESSED 0x0008
#define SERVER_TB 0x0010
@ -206,7 +215,6 @@ struct server_conf
#define SERVER_SSL 0x0040
#define ServerConfIllegal(x) ((x)->flags & SERVER_ILLEGAL)
#define ServerConfVhosted(x) ((x)->flags & SERVER_VHOSTED)
#define ServerConfEncrypted(x) ((x)->flags & SERVER_ENCRYPTED)
#define ServerConfCompressed(x) ((x)->flags & SERVER_COMPRESSED)
#define ServerConfTb(x) ((x)->flags & SERVER_TB)