+2004-12-13 Michael Poole <mdpoole@troilus.org>
+
+ * doc/example.conf: Update General block comment to mention
+ new RESOLVER option and to explain IPv6 support.
+
+ * ircd/ircd_lexer.l: Recognize RESOLVER token.
+
+ * ircd/ircd_parser.y: Declare RESOLVER token and use it in an
+ alternative for generalitem.
+
+ * ircd/ircd_res.c: Define global ResolverAddr variable. If it is
+ valid, use it instead of VirtualHost in restart_resolver().
+
2004-12-13 Michael Poole <mdpoole@troilus.org>
* doc/example.conf: Update configuration to move Client block
# General {
# name = "servername";
# vhost = "virtualhost";
+# resolver = "ipaddress";
# description = "description";
# numeric = numericnumber;
# };
#
-# <virtual host> must contain either a * or a valid IPv4 address in
-# dotted quad notation. (127.0.0.1) The address MUST be the address
-# of a physical interface on the host. This address is used for outgoing
-# connections only, see Port{} for listener virtual hosting.
-# If in doubt put a * or the IP of your primary interface here.
-# The server must be compiled with virtual hosting turned on to get this
-# to work correctly.
+# If present, <virtual host> must contain a valid address in dotted
+# quad or IPv6 numeric notation (127.0.0.1 or ::1). The address MUST
+# be the address of a physical interface on the host. This address is
+# used for outgoing connections if the Connect{} block does not
+# override it. See Port{} for listener virtual hosting. If in doubt,
+# leave it out.
+#
+# You may need to specify the resolver address if your compile
+# defaults to using IPv6 but your resolvers are all IPv4 hosts.
#
# Note that <server numeric> has to be unique on the network your server
# is running on, must be between 0 and 4095, and is not updated on a rehash.
TOKEN(OPER),
TOKEN(LOCAL),
TOKEN(VHOST),
+ TOKEN(RESOLVER),
TOKEN(MASK),
TOKEN(HIDDEN),
TOKEN(MOTD),
extern struct ServerConf* serverConfList;
extern struct s_map* GlobalServiceMapList;
extern struct qline* GlobalQuarantineList;
+ extern struct irc_sockaddr ResolverAddr;
int yylex(void);
/* Now all the globals we need :/... */
%token NO
%token OPER
%token VHOST
+%token RESOLVER
%token HIDDEN
%token MOTD
%token JUPE
parse_error("Your General block must contain a numeric (between 1 and 4095).");
} ';' ;
generalitems: generalitem generalitems | generalitem;
-generalitem: generalnumeric | generalname | generalvhost | generaldesc | error;
+generalitem: generalnumeric | generalname | generalvhost | generalresolver | generaldesc | error;
generalnumeric: NUMERIC '=' NUMBER ';'
{
if (localConf.numeric == 0)
ircd_aton(&VirtualHost.addr, $3);
};
+generalresolver: RESOLVER '=' QSTRING ';'
+{
+ ircd_aton(&ResolverAddr.addr, $3);
+};
+
adminblock: ADMIN '{' adminitems '}'
{
if (localConf.location1 == NULL)
extern int irc_nscount;
extern char irc_domain[HOSTLEN];
+struct irc_sockaddr ResolverAddr;
+
/** Check whether \a inp is a nameserver we use.
* @param[in] inp Nameserver address.
* @return Non-zero if we trust \a inp; zero if not.
if (!s_active(&res_socket))
{
+ struct irc_sockaddr *local;
int fd;
- fd = os_socket(&VirtualHost, SOCK_DGRAM, "Resolver UDP socket");
+ local = irc_in_addr_valid(&ResolverAddr) ? &ResolverAddr : &VirtualHost;
+ fd = os_socket(local, SOCK_DGRAM, "Resolver UDP socket");
if (fd < 0) return;
if (!socket_add(&res_socket, res_readreply, NULL, SS_DATAGRAM,
SOCK_EVENT_READABLE, fd)) return;