+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
#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 */
cli_lasttime(&me) = cli_since(&me) = cli_firsttime(&me) = CurrentTime;
hAddClient(&me);
+#ifdef IPV6
+ SetIPv6(&me);
+#endif
write_pidfile();
init_counters();
}
}
+/** 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.
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),
connectblock: CONNECT
{
- maxlinks = 65535;
flags = CONF_AUTOCONNECT;
} '{' connectitems '}' ';'
{
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);
}
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
host = NULL;
username = NULL;
c_class = NULL;
+ maxlinks = 0;
ip = NULL;
pass = NULL;
port = 0;