Add '6' to server options when compiled with IPv6 support (and related
authorMichael Poole <mdpoole@troilus.org>
Mon, 7 Mar 2005 21:12:39 +0000 (21:12 +0000)
committerMichael Poole <mdpoole@troilus.org>
Mon, 7 Mar 2005 21:12:39 +0000 (21:12 +0000)
configury changes that seem to be necessary).  Fix Port block docs.
Fix IP mask parsing (and mis-parsing) for Client blocks.  Count
failure to create an ident lookup socket in the statistics.

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1325 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
configure
configure.in
doc/example.conf
ircd/ircd_parser.y
ircd/match.c
ircd/s_auth.c
ircd/s_debug.c

index 834ecad610df81c853ad6a3fc1aad55b19575faa..5211f562640b8ead1552857c4ac09eb136fe9bc8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2005-03-07  Michael Poole <mdpoole@troilus.org>
+
+       * configure.in: Consistently use a constant in AC_DEFINE().
+
+       * configure: Regenerate.
+
+       * doc/example.conf (Port): Add comment about the mask option.
+       (Port): Fix the vhosted Port example.
+
+       * ircd/ircd_parser.y (clientblock): Correctly initialize the IP
+       address and addrbits for a Client block with no IP mask.
+
+       * ircd/match.c (ipmask_parse): Accept * as a zero-bit mask.
+
+       * ircd/s_auth.c (start_auth_query): Count socket allocation
+       failure as a failed auth check, as .11 does.
+
+       * ircd/s_debug.c (debug_serveropts): Add '6' to server options
+       when compiled with IPv6 support.
+
 2005-02-23  Michael Poole <mdpoole@troilus.org>
 
        * doc/example.conf: Explain apass_opmode privilege, pointing out
index 16b44b5d57c05dd5c993218c2e610633d11e8f6a..0a0480fa42dee9bb662e5a55f5bb00b2391b12fb 100755 (executable)
--- a/configure
+++ b/configure
@@ -9300,7 +9300,7 @@ echo "${ECHO_T}$unet_cv_enable_poll" >&6
 if test x"$unet_cv_enable_poll" = xyes; then
 
 cat >>confdefs.h <<\_ACEOF
-#define USE_POLL
+#define USE_POLL 1
 _ACEOF
 
     ENGINE_C=engine_poll.c
@@ -9329,7 +9329,7 @@ echo "${ECHO_T}$unet_cv_enable_debug" >&6
 if test x"$unet_cv_enable_debug" = xyes; then
 
 cat >>confdefs.h <<\_ACEOF
-#define DEBUGMODE
+#define DEBUGMODE 1
 _ACEOF
 
 fi
@@ -9380,7 +9380,7 @@ echo "${ECHO_T}$ac_cv_use_ipv6" >&6
 if test x"$ac_cv_use_ipv6" != "xno" ; then
 
 cat >>confdefs.h <<\_ACEOF
-#define IPV6
+#define IPV6 1
 _ACEOF
 
 fi
@@ -9405,7 +9405,7 @@ echo "${ECHO_T}$unet_cv_enable_asserts" >&6
 if test x"$unet_cv_enable_asserts" = xno; then
 
 cat >>confdefs.h <<\_ACEOF
-#define NDEBUG
+#define NDEBUG 1
 _ACEOF
 
 fi
@@ -9514,7 +9514,7 @@ echo "${ECHO_T}$unet_cv_enable_inlines" >&6
 if test x"$unet_cv_enable_inlines" = xyes; then
 
 cat >>confdefs.h <<\_ACEOF
-#define FORCEINLINE
+#define FORCEINLINE 1
 _ACEOF
 
 fi
@@ -9544,7 +9544,7 @@ echo "${ECHO_T}$unet_cv_enable_devpoll" >&6
 if test x"$unet_cv_enable_devpoll" != xno; then
 
 cat >>confdefs.h <<\_ACEOF
-#define USE_DEVPOLL
+#define USE_DEVPOLL 1
 _ACEOF
 
     ENGINE_C="engine_devpoll.c $ENGINE_C"
@@ -9575,7 +9575,7 @@ echo "${ECHO_T}$unet_cv_enable_kqueue" >&6
 if test x"$unet_cv_enable_kqueue" != xno; then
 
 cat >>confdefs.h <<\_ACEOF
-#define USE_KQUEUE
+#define USE_KQUEUE 1
 _ACEOF
 
     ENGINE_C="engine_kqueue.c $ENGINE_C"
@@ -9652,7 +9652,7 @@ echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 
 cat >>confdefs.h <<\_ACEOF
-#define EPOLL_NEED_BODY
+#define EPOLL_NEED_BODY 1
 _ACEOF
 
 fi
@@ -9660,7 +9660,7 @@ rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 
 cat >>confdefs.h <<\_ACEOF
-#define USE_EPOLL
+#define USE_EPOLL 1
 _ACEOF
 
     ENGINE_C="engine_epoll.c $ENGINE_C"
index 8af70805fcb2abd472579d699ef3aaeb81e5e71d..d5e9b07daba542f0f813e3c35dfea305f657dc6b 100644 (file)
@@ -249,7 +249,7 @@ fi
 AC_MSG_RESULT([$unet_cv_enable_poll])
 
 if test x"$unet_cv_enable_poll" = xyes; then
-    AC_DEFINE([USE_POLL], , [Specify whether or not to use poll()])
+    AC_DEFINE([USE_POLL], 1, [Specify whether or not to use poll()])
     ENGINE_C=engine_poll.c
 else
     ENGINE_C=engine_select.c
@@ -266,7 +266,7 @@ AC_ARG_ENABLE([debug],
 AC_MSG_RESULT([$unet_cv_enable_debug])
 
 if test x"$unet_cv_enable_debug" = xyes; then
-    AC_DEFINE([DEBUGMODE], , [Enable debugging code])
+    AC_DEFINE([DEBUGMODE], 1, [Enable debugging code])
 fi
 
 dnl Now look for --enable-leak-detect
@@ -292,7 +292,7 @@ AC_ARG_WITH([ipv6],
     [ac_cv_use_ipv6=$unet_have_sockaddr_in6])
 AC_CACHE_CHECK([whether to use IPv6], [ac_cv_use_ipv6], [ac_cv_use_ipv6=no])
 if test x"$ac_cv_use_ipv6" != "xno" ; then
-    AC_DEFINE([IPV6], , [Enable IPv6 support])
+    AC_DEFINE([IPV6], 1, [Enable IPv6 support])
 fi
 
 dnl And now for --disable-asserts
@@ -305,7 +305,7 @@ AC_ARG_ENABLE([asserts],
 AC_MSG_RESULT([$unet_cv_enable_asserts])
 
 if test x"$unet_cv_enable_asserts" = xno; then
-    AC_DEFINE([NDEBUG], , [Disable assertions])
+    AC_DEFINE([NDEBUG], 1, [Disable assertions])
 fi
 
 dnl Check for --enable-symbols
@@ -370,7 +370,7 @@ AC_ARG_ENABLE([inlines],
 AC_MSG_RESULT([$unet_cv_enable_inlines])
 
 if test x"$unet_cv_enable_inlines" = xyes; then
-    AC_DEFINE([FORCEINLINE], , [Force inlining for a few critical functions])
+    AC_DEFINE([FORCEINLINE], 1, [Force inlining for a few critical functions])
 fi
 
 dnl --disable-devpoll check...
@@ -388,7 +388,7 @@ fi
 AC_MSG_RESULT([$unet_cv_enable_devpoll])
 
 if test x"$unet_cv_enable_devpoll" != xno; then
-    AC_DEFINE([USE_DEVPOLL], , [Define to enable the /dev/poll engine])
+    AC_DEFINE([USE_DEVPOLL], 1, [Define to enable the /dev/poll engine])
     ENGINE_C="engine_devpoll.c $ENGINE_C"
 fi
 
@@ -407,7 +407,7 @@ fi
 AC_MSG_RESULT([$unet_cv_enable_kqueue])
 
 if test x"$unet_cv_enable_kqueue" != xno; then
-    AC_DEFINE([USE_KQUEUE], , [Define to enable the kqueue engine])
+    AC_DEFINE([USE_KQUEUE], 1, [Define to enable the kqueue engine])
     ENGINE_C="engine_kqueue.c $ENGINE_C"
 fi
 
@@ -432,8 +432,8 @@ if test x"$unet_cv_enable_epoll" != xno; then
     AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [epoll_create(10);])],
         [AC_MSG_RESULT([yes])],
         [AC_MSG_RESULT([no])
-         AC_DEFINE([EPOLL_NEED_BODY],,[Define to implement epoll system calls])])
-    AC_DEFINE([USE_EPOLL], , [Define to enable the epoll engine])
+         AC_DEFINE([EPOLL_NEED_BODY], 1, [Define to implement epoll system calls])])
+    AC_DEFINE([USE_EPOLL], 1, [Define to enable the epoll engine])
     ENGINE_C="engine_epoll.c $ENGINE_C"
 fi
 
index 65060969a67f2a64239e7de058b58fb173e80e1d..8538096a88f5c63182795fb03ed281e147670564 100644 (file)
@@ -692,14 +692,14 @@ Port {
 Port { port = 6667; };
 Port { port = 6668; };
 Port {
+ # This only accepts clients with IPs like 192.168.*.
  mask = "192.168.*";
  port = 6666;
 };
 
-# This is a hidden client port, listening on the interface associated
-# with the IP address 168.8.21.107
+# This is a hidden client port, listening on 168.8.21.107.
 Port {
mask = "168.8.21.107";
vhost = "168.8.21.107";
  hidden = yes;
  port = 7000;
 };
index 2bba81662e85bbd27a11c82cf3f33590a4f26eb8..2937d92bd8afdb885377a2c01c7653853803f2eb 100644 (file)
@@ -652,7 +652,7 @@ clientblock: CLIENT
 '{' clientitems '}' ';'
 {
   struct irc_in_addr addr;
-  unsigned char addrbits;
+  unsigned char addrbits = 0;
 
   if (ip && !ipmask_parse(ip, &addr, &addrbits)) {
     parse_error("Invalid IP address in block");
@@ -663,7 +663,10 @@ clientblock: CLIENT
     struct ConfItem *aconf = make_conf(CONF_CLIENT);
     aconf->username = username;
     aconf->host = host;
-    memcpy(&aconf->address.addr, &addr, sizeof(aconf->address.addr));
+    if (ip)
+      memcpy(&aconf->address.addr, &addr, sizeof(aconf->address.addr));
+    else
+      memset(&aconf->address.addr, 0, sizeof(aconf->address.addr));
     aconf->addrbits = addrbits;
     aconf->name = ip;
     aconf->conn_class = c_class ? c_class : find_class("default");
index 7651151e85a35c4bec2660f14dae7ce98e26aef0..b1d0f74eb076b48bcdc519bbf4d3717f285fc21f 100644 (file)
@@ -905,6 +905,8 @@ int ipmask_parse(const char *in, struct irc_in_addr *mask, unsigned char *bits_p
     mask->in6_16[5] = 0xffff;
     memcpy(&mask->in6_16[6], &ipv4.s_addr, sizeof(ipv4.s_addr));
     bits += 96;
+  } else if (in[0] == '*' && in[1] == '\0') {
+    /* accept as a 0-bit mask */
   } else {
     if (!(p = strchr(in, '/')))
       bits = 128;
index ad95e1f019d8f2816d3225824febc3bcb456003c..ca385b5154604dc3015bb425a28386e70ceb4b4d 100644 (file)
@@ -422,8 +422,10 @@ static int start_auth_query(struct AuthRequest* auth)
   os_get_sockname(cli_fd(auth->client), &local_addr);
   local_addr.port = 0;
   fd = os_socket(&local_addr, SOCK_STREAM, "auth query");
-  if (fd < 0)
+  if (fd < 0) {
+    ++ServerStats->is_abad;
     return 0;
+  }
   if (IsUserPort(auth->client))
     sendheader(auth->client, REPORT_DO_ID);
   memcpy(&remote_addr.addr, &cli_ip(auth->client), sizeof(remote_addr.addr));
index 15ea2f547f28f8acdefb9ddd6cf1cf7f4a8334d1..4a202bfef1b0dc0de4cf2b97bfa38bc6e61881f7 100644 (file)
@@ -109,6 +109,9 @@ const char* debug_serveropts(void)
 #if defined(USE_POLL) && defined(HAVE_POLL_H)
   AddC('U');
 #endif
+#ifdef  IPV6
+  AddC('6');
+#endif
 
   serveropts[i] = '\0';