Revision: 1907
          
http://undernet-ircu.svn.sourceforge.net/undernet-ircu/?rev=1907&view=rev
Author:   entrope
Date:     2009-02-09 04:11:04 +0000 (Mon, 09 Feb 2009)

Log Message:
-----------
Author: Michael Poole <[email protected]>
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.

Modified Paths:
--------------
    ircu2/branches/u2_10_12_branch/ChangeLog
    ircu2/branches/u2_10_12_branch/include/client.h
    ircu2/branches/u2_10_12_branch/ircd/ircd.c
    ircu2/branches/u2_10_12_branch/ircd/ircd_features.c
    ircu2/branches/u2_10_12_branch/ircd/ircd_parser.y

Modified: ircu2/branches/u2_10_12_branch/ChangeLog
===================================================================
--- ircu2/branches/u2_10_12_branch/ChangeLog    2009-02-09 03:39:42 UTC (rev 
1906)
+++ ircu2/branches/u2_10_12_branch/ChangeLog    2009-02-09 04:11:04 UTC (rev 
1907)
@@ -1,5 +1,18 @@
 2009-02-08  Michael Poole <[email protected]>
 
+       * 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 <[email protected]>
+
        * ircd/channel.c (clean_channelname): Delete this function; it is
        no longer used, and had the same length-off-by-one bug.
 

Modified: ircu2/branches/u2_10_12_branch/include/client.h
===================================================================
--- ircu2/branches/u2_10_12_branch/include/client.h     2009-02-09 03:39:42 UTC 
(rev 1906)
+++ ircu2/branches/u2_10_12_branch/include/client.h     2009-02-09 04:11:04 UTC 
(rev 1907)
@@ -660,6 +660,8 @@
 #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 */

Modified: ircu2/branches/u2_10_12_branch/ircd/ircd.c
===================================================================
--- ircu2/branches/u2_10_12_branch/ircd/ircd.c  2009-02-09 03:39:42 UTC (rev 
1906)
+++ ircu2/branches/u2_10_12_branch/ircd/ircd.c  2009-02-09 04:11:04 UTC (rev 
1907)
@@ -752,6 +752,9 @@
   cli_lasttime(&me) = cli_since(&me) = cli_firsttime(&me) = CurrentTime;
 
   hAddClient(&me);
+#ifdef IPV6
+  SetIPv6(&me);
+#endif
 
   write_pidfile();
   init_counters();

Modified: ircu2/branches/u2_10_12_branch/ircd/ircd_features.c
===================================================================
--- ircu2/branches/u2_10_12_branch/ircd/ircd_features.c 2009-02-09 03:39:42 UTC 
(rev 1906)
+++ ircu2/branches/u2_10_12_branch/ircd/ircd_features.c 2009-02-09 04:11:04 UTC 
(rev 1907)
@@ -207,6 +207,17 @@
   }
 }
 
+/** 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 @@
   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),

Modified: ircu2/branches/u2_10_12_branch/ircd/ircd_parser.y
===================================================================
--- ircu2/branches/u2_10_12_branch/ircd/ircd_parser.y   2009-02-09 03:39:42 UTC 
(rev 1906)
+++ ircu2/branches/u2_10_12_branch/ircd/ircd_parser.y   2009-02-09 04:11:04 UTC 
(rev 1907)
@@ -463,7 +463,6 @@
 
 connectblock: CONNECT
 {
- maxlinks = 65535;
  flags = CONF_AUTOCONNECT;
 } '{' connectitems '}' ';'
 {
@@ -488,7 +487,10 @@
    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 @@
  }
  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 @@
   host = NULL;
   username = NULL;
   c_class = NULL;
+  maxlinks = 0;
   ip = NULL;
   pass = NULL;
   port = 0;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to