Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2004-12-14 03:01:08 UTC
Modified files:
ChangeLog doc/example.conf ircd/ircd_lexer.l ircd/ircd_parser.y
ircd/ircd_res.c
Log message:
Allow the resolver source address to be specified in the configuration.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.513 ircu2.10/ChangeLog:1.514
--- ircu2.10/ChangeLog:1.513 Mon Dec 13 16:21:41 2004
+++ ircu2.10/ChangeLog Mon Dec 13 19:00:37 2004
@@ -1,5 +1,18 @@
2004-12-13 Michael Poole <[EMAIL PROTECTED]>
+ * 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 <[EMAIL PROTECTED]>
+
* doc/example.conf: Update configuration to move Client block
comment after sample Class blocks, and update entries in it.
Index: ircu2.10/doc/example.conf
diff -u ircu2.10/doc/example.conf:1.37 ircu2.10/doc/example.conf:1.38
--- ircu2.10/doc/example.conf:1.37 Mon Dec 13 16:21:53 2004
+++ ircu2.10/doc/example.conf Mon Dec 13 19:00:56 2004
@@ -53,17 +53,20 @@
# 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.
Index: ircu2.10/ircd/ircd_lexer.l
diff -u ircu2.10/ircd/ircd_lexer.l:1.13 ircu2.10/ircd/ircd_lexer.l:1.14
--- ircu2.10/ircd/ircd_lexer.l:1.13 Mon Dec 13 16:21:53 2004
+++ ircu2.10/ircd/ircd_lexer.l Mon Dec 13 19:00:57 2004
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
- * $Id: ircd_lexer.l,v 1.13 2004/12/14 00:21:53 entrope Exp $
+ * $Id: ircd_lexer.l,v 1.14 2004/12/14 03:00:57 entrope Exp $
*/
%{
@@ -76,6 +76,7 @@
TOKEN(OPER),
TOKEN(LOCAL),
TOKEN(VHOST),
+ TOKEN(RESOLVER),
TOKEN(MASK),
TOKEN(HIDDEN),
TOKEN(MOTD),
Index: ircu2.10/ircd/ircd_parser.y
diff -u ircu2.10/ircd/ircd_parser.y:1.31 ircu2.10/ircd/ircd_parser.y:1.32
--- ircu2.10/ircd/ircd_parser.y:1.31 Mon Dec 13 16:21:53 2004
+++ ircu2.10/ircd/ircd_parser.y Mon Dec 13 19:00:57 2004
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
- * $Id: ircd_parser.y,v 1.31 2004/12/14 00:21:53 entrope Exp $
+ * $Id: ircd_parser.y,v 1.32 2004/12/14 03:00:57 entrope Exp $
*/
%{
@@ -65,6 +65,7 @@
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 :/... */
@@ -135,6 +136,7 @@
%token NO
%token OPER
%token VHOST
+%token RESOLVER
%token HIDDEN
%token MOTD
%token JUPE
@@ -271,7 +273,7 @@
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)
@@ -302,6 +304,11 @@
ircd_aton(&VirtualHost.addr, $3);
};
+generalresolver: RESOLVER '=' QSTRING ';'
+{
+ ircd_aton(&ResolverAddr.addr, $3);
+};
+
adminblock: ADMIN '{' adminitems '}'
{
if (localConf.location1 == NULL)
Index: ircu2.10/ircd/ircd_res.c
diff -u ircu2.10/ircd/ircd_res.c:1.10 ircu2.10/ircd/ircd_res.c:1.11
--- ircu2.10/ircd/ircd_res.c:1.10 Mon Dec 13 16:21:53 2004
+++ ircu2.10/ircd/ircd_res.c Mon Dec 13 19:00:57 2004
@@ -18,7 +18,7 @@
*/
/** @file
* @brief IRC resolver functions.
- * @version $Id: ircd_res.c,v 1.10 2004/12/14 00:21:53 entrope Exp $
+ * @version $Id: ircd_res.c,v 1.11 2004/12/14 03:00:57 entrope Exp $
*/
#include "client.h"
@@ -140,6 +140,8 @@
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.
@@ -171,8 +173,10 @@
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;
----------------------- End of diff -----------------------