From: Michael Poole Date: Mon, 7 Mar 2005 21:12:39 +0000 (+0000) Subject: Add '6' to server options when compiled with IPv6 support (and related X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=54a8a6da6b3ca14e8dbd5b5a64c4675bfbc99c3c Add '6' to server options when compiled with IPv6 support (and related 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 --- diff --git a/ChangeLog b/ChangeLog index 834ecad..5211f56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2005-03-07 Michael Poole + + * 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 * doc/example.conf: Explain apass_opmode privilege, pointing out diff --git a/configure b/configure index 16b44b5..0a0480f 100755 --- 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" diff --git a/configure.in b/configure.in index 8af7080..d5e9b07 100644 --- a/configure.in +++ b/configure.in @@ -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 ], [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 diff --git a/doc/example.conf b/doc/example.conf index 6506096..8538096 100644 --- a/doc/example.conf +++ b/doc/example.conf @@ -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; }; diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index 2bba816..2937d92 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -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"); diff --git a/ircd/match.c b/ircd/match.c index 7651151..b1d0f74 100644 --- a/ircd/match.c +++ b/ircd/match.c @@ -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; diff --git a/ircd/s_auth.c b/ircd/s_auth.c index ad95e1f..ca385b5 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -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)); diff --git a/ircd/s_debug.c b/ircd/s_debug.c index 15ea2f5..4a202bf 100644 --- a/ircd/s_debug.c +++ b/ircd/s_debug.c @@ -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';