Author: Michael Poole <mdpoole@troilus.org>
authorMichael Poole <mdpoole@troilus.org>
Mon, 9 Feb 2009 04:11:04 +0000 (04:11 +0000)
committerMichael Poole <mdpoole@troilus.org>
Mon, 9 Feb 2009 04:11:04 +0000 (04:11 +0000)
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
include/client.h
ircd/ircd.c
ircd/ircd_features.c
ircd/ircd_parser.y

index eb128f3c3dac89c13f24eebafbe946062a788b92..e4d4aa8e491d1a9d947624a167fc4bcde46ea3a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-02-08  Michael Poole <mdpoole@troilus.org>
+
+       * 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 <mdpoole@troilus.org>
 
        * ircd/channel.c (clean_channelname): Delete this function; it is
index c38e30483478c5a4302252bcc06008b98e3d9981..7110dd09e4a07e9252fdc3b837f418886c81a3e0 100644 (file)
@@ -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 */
index 0954a6157b9ff9eae9d10b546a3c0710077242c1..2a521703be67091563096cad4b0340801e93da48 100644 (file)
@@ -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();
index b54fae827c38e948f0f1162cca1eebcbed9d7622..f49539cbddf79257a6cdf7864364ebec76e2f3e0 100644 (file)
@@ -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),
index e3dd3297ea92fdf9fe9e7af1b00ebe9515425cae..a43b9446cd7619768bafb7e301ea67525065901f 100644 (file)
@@ -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;