From 7fbb742f7d849cb57b23f2a76d90950174094719 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Mon, 9 Feb 2009 04:11:04 +0000 Subject: [PATCH] Author: Michael Poole Description: Fix items from SF bug #2523774: Show +H and +6 flags in /stats v and /stats V for the local server. Fix the default value for maxhops. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1907 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 13 +++++++++++++ include/client.h | 2 ++ ircd/ircd.c | 3 +++ ircd/ircd_features.c | 13 ++++++++++++- ircd/ircd_parser.y | 9 ++++++--- 5 files changed, 36 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index eb128f3..e4d4aa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-02-08 Michael Poole + + * include/client.h (ClearHub): New macro. + + * ircd/ircd.c (main): Set IPv6 flag on &me if appropriate. + + * ircd/ircd_features.c (feature_notify_hub): New function. + (features[]): Register it for FEAT_HUB. + + * ircd/ircd_parser.y (connectblock): Do not default maxlinks to + 65535 unless "hub" is specified. + (clientblock): Reset maxlinks on cleanup. + 2009-02-08 Michael Poole * ircd/channel.c (clean_channelname): Delete this function; it is diff --git a/include/client.h b/include/client.h index c38e304..7110dd0 100644 --- a/include/client.h +++ b/include/client.h @@ -660,6 +660,8 @@ struct Client { #define ClearHiddenHost(x) ClrFlag(x, FLAG_HIDDENHOST) /** Clear the client's pending PING flag. */ #define ClearPingSent(x) ClrFlag(x, FLAG_PINGSENT) +/** Clear the client's HUB flag. */ +#define ClearHub(x) ClrFlag(x, FLAG_HUB) /* free flags */ #define FREEFLAG_SOCKET 0x0001 /**< socket needs to be freed */ diff --git a/ircd/ircd.c b/ircd/ircd.c index 0954a61..2a52170 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -752,6 +752,9 @@ int main(int argc, char **argv) { cli_lasttime(&me) = cli_since(&me) = cli_firsttime(&me) = CurrentTime; hAddClient(&me); +#ifdef IPV6 + SetIPv6(&me); +#endif write_pidfile(); init_counters(); diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c index b54fae8..f49539c 100644 --- a/ircd/ircd_features.c +++ b/ircd/ircd_features.c @@ -207,6 +207,17 @@ feature_log_get(struct Client* from, const char* const* fields, int count) } } +/** Update whether #me is a hub or not. + */ +static void +feature_notify_hub(void) +{ + if (feature_bool(FEAT_HUB)) + SetHub(&me); + else + ClearHub(&me); +} + /** Sets a feature to the given value. * @param[in] from Client trying to set parameters. * @param[in] fields Array of parameters to set. @@ -298,7 +309,7 @@ static struct FeatureDesc { F_S(PROVIDER, FEAT_NULL, 0, 0), F_B(KILL_IPMISMATCH, FEAT_OPER, 0, 0), F_B(IDLE_FROM_MSG, 0, 1, 0), - F_B(HUB, 0, 0, 0), + F_B(HUB, 0, 0, feature_notify_hub), F_B(WALLOPS_OPER_ONLY, 0, 0, 0), F_B(NODNS, 0, 0, 0), F_N(RANDOM_SEED, FEAT_NODISP, random_seed_set, 0, 0, 0, 0, 0, 0), diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index e3dd329..a43b944 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -463,7 +463,6 @@ classusermode: USERMODE '=' QSTRING ';' connectblock: CONNECT { - maxlinks = 65535; flags = CONF_AUTOCONNECT; } '{' connectitems '}' ';' { @@ -488,7 +487,10 @@ connectblock: CONNECT aconf->conn_class = c_class; aconf->address.port = port; aconf->host = host; - aconf->maximum = maxlinks; + /* If the user specified a hub allowance, but not maximum links, + * allow an effectively unlimited number of hops. + */ + aconf->maximum = (hub_limit != NULL && maxlinks == 0) ? 65535 : maxlinks; aconf->hub_limit = hub_limit; aconf->flags = flags; lookup_confhost(aconf); @@ -502,7 +504,7 @@ connectblock: CONNECT } name = pass = host = origin = hub_limit = NULL; c_class = NULL; - port = flags = 0; + port = flags = maxlinks = 0; }; connectitems: connectitem connectitems | connectitem; connectitem: connectname | connectpass | connectclass | connecthost @@ -830,6 +832,7 @@ clientblock: CLIENT host = NULL; username = NULL; c_class = NULL; + maxlinks = 0; ip = NULL; pass = NULL; port = 0; -- 2.20.1