CLEANUP: Remove DOMAINNAME-based local client tracking
authorRemco Rijnders <remmy@serenity-irc.net>
Sat, 7 Mar 2026 17:17:36 +0000 (12:17 -0500)
committerRemco Rijnders <remmy@serenity-irc.net>
Sat, 7 Mar 2026 17:17:36 +0000 (12:17 -0500)
The ircd tracked "local clients" by matching connected users'
sockhost against *DOMAINNAME, a relic from when IRC servers ran
at universities and tracking same-host users was meaningful.
This is no longer a relevant metric.

Removes:
- lu_lulocal variable and all DOMAINNAME mask matching in
  check_lusers(), m_lusers(), and exit_one_client()
- local_count field from current_load_struct and load_entry
- DOMAINNAME define from config.h and setup.h
- The "DOMAINNAME clients" row from userload stats output

Keeps:
- lu_lu / m_client (MyConnect clients = clients connected to this
  server) which is the standard IRC "local users" for LUSERS
- All global user counters and max tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
include/common.h
include/config.h
include/setup.h
include/userload.h
src/ircd.c
src/s_misc.c
src/s_serv.c
src/userload.c

index 4aba4931460fcf791d180dfc7e5edf3634f01a3f..d43fc0fba886e115608ebb3cb2349af13df69dd5 100644 (file)
@@ -127,8 +127,8 @@ extern int mode_snick() ;
 extern char *malloc_options;
 #endif
 
-extern int lu_noninv, lu_inv, lu_serv, lu_oper, 
-           lu_unknown, lu_channel, lu_lu, lu_lulocal, lu_lserv, 
+extern int lu_noninv, lu_inv, lu_serv, lu_oper,
+           lu_unknown, lu_channel, lu_lu, lu_lserv,
            lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu;
            
 
index 4b19c5352ca3552a51893442d68f8b9fcea7c9b4..0b88caa8dbbec9a58f4dc6b61df6afc55b222318 100644 (file)
  */
 #define USERSTATMAX    120
 
-/*
- * NOTE: It is important to set this to the correct "domain" for your server.
- * Define this for the correct "domain" that your server is in.  This
- * is important for certain stats.  -mlv
- */
-#ifndef DOMAINNAME
-#define DOMAINNAME "serenity-irc.net"
-#endif
-
 /*
  * Define this if you wish to output a *file* to a K lined client rather
  * than the K line comment (the comment field is treated as a filename)
index 3867d50937b222a8e03b2a2ca375d9bf3c1c977f..88813d4cdafd3e633ae2b201270008c1f4a0ad25 100644 (file)
@@ -29,5 +29,4 @@
 #define CONTACT_URL "http://www.serenity-irc.net/connect.html"
 #define SERVICES_NAME "Services.Serenity-IRC.Net"
 #define KLINE_ADDRESS "remmy@serenity-irc.net"
-#define DOMAINNAME "glenmoor"
 #define ZIP_LINKS      1
index 127c32d5e11f22ac490bab1e7532644bed73fc92..ab91819d1a729df4958c71933219ce1982c17a34 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 struct current_load_struct {
-  u_short client_count, local_count, conn_count;
+  u_short client_count, conn_count;
   u_long  entries;
 };  
 
@@ -36,7 +36,7 @@ extern struct current_load_struct current_load_data;
 
 struct load_entry {
   struct  load_entry *prev;
-  u_short client_count, local_count, conn_count;
+  u_short client_count, conn_count;
 #ifdef DEBUGMODE
   u_short cpu_usage;
 #endif
index bf61686464632043aa4622de9ad70728f64d1658..fc9dbf9d53206256e2f68b3a24f1aafbf660c345 100644 (file)
@@ -77,7 +77,7 @@ time_t lastlucheck = 0;
 time_t lastbwcheck = 0;        /* next time to do the bandwidtch check */
 
 int lu_noninv, lu_inv, lu_serv, lu_oper, lu_unknown, lu_channel, lu_lu,
-    lu_lulocal, lu_lserv, lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu;
+    lu_lserv, lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu;
 
 int is_hub = 0;
 
@@ -841,8 +841,6 @@ static void setup_signals ()
 }
 
 
-#define DOMAINNAMEMASK "*" DOMAINNAME
-
 void check_lusers (void)
 {
     aClient *acptr;
@@ -859,11 +857,8 @@ void check_lusers (void)
        case STAT_CLIENT:
            if (IsOper (acptr))
                lu_oper++;
-           if (MyConnect (acptr)) {
+           if (MyConnect (acptr))
                lu_lu++;
-               if (match (DOMAINNAMEMASK, acptr->sockhost) == 0)
-                   lu_lulocal++;
-           }
            if (!IsInvisible (acptr))
                lu_noninv++;
            else
@@ -878,7 +873,6 @@ void check_lusers (void)
     lu_cglobalu = lu_noninv + lu_inv;
     if (lu_clu > lu_mlu)
        lu_mlu = lu_lu;
-    lu_cglobalu = lu_noninv + lu_inv;
     if (lu_cglobalu > lu_mglobalu)
        lu_mglobalu = lu_cglobalu;
 
index 240afceac50152276de695520aa0c502011828a0..28f01acf4ad9223ce7638b36e6081fcc046d8721 100644 (file)
@@ -364,12 +364,7 @@ int exit_client (cptr, sptr, from, comment)
                          comment);
        current_load_data.conn_count--;
        if (IsPerson (sptr)) {
-           char mydom_mask[HOSTLEN + 1];
-           mydom_mask[0] = '*';
-           strncpy (&mydom_mask[1], DOMAINNAME, HOSTLEN - 1);
            current_load_data.client_count--;
-           if (match (mydom_mask, sptr->sockhost) == 0)
-               current_load_data.local_count--;
            /* Clean out list and watch structures -Donwulff */
            hash_del_notify_list (sptr);
            if (sptr->lopt) {
index 2f319da1e7a25e8fe04e0b61f254206fc5c3be62..ada7ac6a2c3672f4195c3e47bdadf7bef9f127b8 100644 (file)
@@ -1727,22 +1727,14 @@ int m_help (aClient *cptr, aClient *sptr, int parc, char *parv[])
 int m_lusers (aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
     int s_count, c_count, u_count, i_count;
-    int o_count, m_client, m_client_local, m_server;
-    char mydom_mask[HOSTLEN + 1];
+    int o_count, m_client, m_server;
     aClient *acptr;
 
-/* Not needed re change to parse.c
-   if (check_registered_user(sptr))
-   return 0;
- */
     if (parc > 2)
        if (hunt_server (cptr, sptr, ":%s LUSERS %s :%s", 2, parc, parv)
            != HUNTED_ISME)
            return 0;
 
-    mydom_mask[0] = '*';
-    strncpy (&mydom_mask[1], DOMAINNAME, HOSTLEN - 1);
-
     if (parc == 1) {
        s_count = lu_serv;
        c_count = lu_noninv;
@@ -1750,13 +1742,12 @@ int m_lusers (aClient *cptr, aClient *sptr, int parc, char *parv[])
        i_count = lu_inv;
        o_count = lu_oper;
        m_client = lu_lu;
-       m_client_local = lu_lulocal;
        m_server = lu_lserv;
        global_count = lu_cglobalu;
     }
     else {
        s_count = c_count = u_count = i_count = o_count = m_client =
-           m_client_local = m_server = 0;
+           m_server = 0;
        (void) collapse (parv[1]);
        for (acptr = client; acptr; acptr = acptr->next) {
            if (parc > 1) {
@@ -1779,11 +1770,8 @@ int m_lusers (aClient *cptr, aClient *sptr, int parc, char *parv[])
            case STAT_CLIENT:
                if (IsOper (acptr))
                    o_count++;
-               if (MyConnect (acptr)) {
+               if (MyConnect (acptr))
                    m_client++;
-                   if (match (mydom_mask, acptr->sockhost) == 0)
-                       m_client_local++;
-               }
                if (!IsInvisible (acptr))
                    c_count++;
                else
@@ -1822,7 +1810,6 @@ int m_lusers (aClient *cptr, aClient *sptr, int parc, char *parv[])
            sendto_ops ("Maximum connections: %d (%d clients)",
                        max_connection_count, max_client_count);
     }
-    current_load_data.local_count = m_client_local;
     current_load_data.client_count = m_client;
     current_load_data.conn_count = m_client + m_server;
     return 0;
index d20e7e33649d3f6c3b55f02b9cb14cf949f7ef30..7eae37f03e89d100ba2639d08a4e0cc738fe7cc0 100644 (file)
@@ -51,8 +51,7 @@ void update_load ()
     /* This seems to get polluted on startup by an exit_client()
      * before any connections have been recorded.
      */
-    if (current_load_data.local_count > MAXCONNECTIONS ||
-       current_load_data.client_count > MAXCONNECTIONS ||
+    if (current_load_data.client_count > MAXCONNECTIONS ||
        current_load_data.conn_count > MAXCONNECTIONS)
        memset (&current_load_data, 0, sizeof (struct current_load_struct));
 
@@ -81,7 +80,6 @@ void update_load ()
            ((now.tv_sec * 1000 + now.tv_usec / 1000 + 5) -
             (last.tv_sec * 1000 + last.tv_usec / 1000)) / 10;
 
-       cur_load_entry->local_count = current_load_data.local_count;
        cur_load_entry->client_count = current_load_data.client_count;
        cur_load_entry->conn_count = current_load_data.conn_count;
 #ifdef DEBUGMODE
@@ -104,18 +102,18 @@ void calc_load (aClient *sptr, char *parv)
     struct load_entry *cur_load_entry;
     struct load_entry *last = NULL;
 #ifdef DEBUGMODE
-    u_long secs = 0, adj_secs, total[4], adj[4];       /*[local,client,conn,cpu] */
+    u_long secs = 0, adj_secs, total[3], adj[3];       /*[client,conn,cpu] */
     int i;
-    u_int times[5][4]; /* [min,hour,day,Yest,YYest][local,client,conn,cpu] */
-    char what[4][HOSTLEN + 1];
-
-    memset (total, 0, 4 * sizeof (u_long));
-#else
-    u_long secs = 0, adj_secs, total[3], adj[3];       /*[local,client,conn] */
-    int i, times[5][3];        /* [min,hour,day,Yest,YYest][local,client,conn] */
+    u_int times[5][3]; /* [min,hour,day,Yest,YYest][client,conn,cpu] */
     char what[3][HOSTLEN + 1];
 
     memset (total, 0, 3 * sizeof (u_long));
+#else
+    u_long secs = 0, adj_secs, total[2], adj[2];       /*[client,conn] */
+    int i, times[5][2];        /* [min,hour,day,Yest,YYest][client,conn] */
+    char what[2][HOSTLEN + 1];
+
+    memset (total, 0, 2 * sizeof (u_long));
 #endif
 
     current_load_data.entries = 0;
@@ -125,11 +123,10 @@ void calc_load (aClient *sptr, char *parv)
     for (cur_load_entry = load_list_tail; (secs < 6000) &&
         (cur_load_entry != NULL); cur_load_entry = cur_load_entry->prev) {
        u_long time_incr = cur_load_entry->time_incr;
-       total[0] += time_incr * cur_load_entry->local_count;
-       total[1] += time_incr * cur_load_entry->client_count;
-       total[2] += time_incr * cur_load_entry->conn_count;
+       total[0] += time_incr * cur_load_entry->client_count;
+       total[1] += time_incr * cur_load_entry->conn_count;
 #ifdef DEBUGMODE
-       total[3] += cur_load_entry->cpu_usage;
+       total[2] += cur_load_entry->cpu_usage;
 #endif
        last = cur_load_entry;
        secs += cur_load_entry->time_incr;
@@ -137,186 +134,177 @@ void calc_load (aClient *sptr, char *parv)
     }
     if ((secs > 6000) && (last != NULL)) {
        adj_secs = secs - 6000;
-       adj[0] = adj_secs * last->local_count;
-       adj[1] = adj_secs * last->client_count;
-       adj[2] = adj_secs * last->conn_count;
+       adj[0] = adj_secs * last->client_count;
+       adj[1] = adj_secs * last->conn_count;
 #ifdef DEBUGMODE
-       times[0][3] =
-           total[3] -
+       times[0][2] =
+           total[2] -
            (last->cpu_usage * (double) adj_secs / last->time_incr);
     }
     else {
-       adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0;
-       times[0][3] = total[3];
+       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       times[0][2] = total[2];
     }
 #else
     }
     else
-       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       adj_secs = adj[0] = adj[1] = 0;
 #endif
-    for (i = 0; i < 3; i++) {
+    for (i = 0; i < 2; i++) {
        times[0][i] =
            ((total[i] - adj[i]) * 1000 / (secs - adj_secs) + 5) / 10;
     }
 
     secs = (secs + 5) / 10;
-    for (i = 0; i < 3; i++)
+    for (i = 0; i < 2; i++)
        total[i] = (total[i] + 5) / 10;
 
     for (; (secs < 36000) && (cur_load_entry != NULL); secs +=
         (cur_load_entry->time_incr + 5) / 10, cur_load_entry =
         cur_load_entry->prev, current_load_data.entries++) {
        u_long time_incr = (cur_load_entry->time_incr + 5) / 10;
-       total[0] += time_incr * cur_load_entry->local_count;
-       total[1] += time_incr * cur_load_entry->client_count;
-       total[2] += time_incr * cur_load_entry->conn_count;
+       total[0] += time_incr * cur_load_entry->client_count;
+       total[1] += time_incr * cur_load_entry->conn_count;
 #ifdef DEBUGMODE
-       total[3] += cur_load_entry->cpu_usage;
+       total[2] += cur_load_entry->cpu_usage;
 #endif
        last = cur_load_entry;
     }
     if ((secs > 36000) && (last != NULL)) {
        adj_secs = secs - 36000;
-       adj[0] = adj_secs * last->local_count;
-       adj[1] = adj_secs * last->client_count;
-       adj[2] = adj_secs * last->conn_count;
+       adj[0] = adj_secs * last->client_count;
+       adj[1] = adj_secs * last->conn_count;
 #ifdef DEBUGMODE
-       times[1][3] =
-           total[3] -
+       times[1][2] =
+           total[2] -
            (last->cpu_usage * (double) adj_secs / last->time_incr);
     }
     else {
-       adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0;
-       times[1][3] = total[3];
+       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       times[1][2] = total[2];
     }
 #else
     }
     else
-       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       adj_secs = adj[0] = adj[1] = 0;
 #endif
-    for (i = 0; i < 3; i++) {
+    for (i = 0; i < 2; i++) {
        times[1][i] =
            ((total[i] - adj[i]) * 100 / (secs - adj_secs) + 5) / 10;
     }
 
     secs = (secs + 5) / 10;
-    for (i = 0; i < 3; i++)
+    for (i = 0; i < 2; i++)
        total[i] = (total[i] + 5) / 10;
 
     for (; (secs < 86400) && (cur_load_entry != NULL); secs +=
         (cur_load_entry->time_incr + 50) / 100, cur_load_entry =
         cur_load_entry->prev, current_load_data.entries++) {
        u_long time_incr = (cur_load_entry->time_incr + 50) / 100;
-       total[0] += time_incr * cur_load_entry->local_count;
-       total[1] += time_incr * cur_load_entry->client_count;
-       total[2] += time_incr * cur_load_entry->conn_count;
+       total[0] += time_incr * cur_load_entry->client_count;
+       total[1] += time_incr * cur_load_entry->conn_count;
 #ifdef DEBUGMODE
-       total[3] += cur_load_entry->cpu_usage;
+       total[2] += cur_load_entry->cpu_usage;
 #endif
        last = cur_load_entry;
     }
     if ((secs > 86400) && (last != NULL)) {
        adj_secs = secs - 86400;
-       adj[0] = adj_secs * last->local_count;
-       adj[1] = adj_secs * last->client_count;
-       adj[2] = adj_secs * last->conn_count;
+       adj[0] = adj_secs * last->client_count;
+       adj[1] = adj_secs * last->conn_count;
 #ifdef DEBUGMODE
-       times[2][3] =
-           total[3] -
+       times[2][2] =
+           total[2] -
            (last->cpu_usage * (double) adj_secs / last->time_incr);
     }
     else {
-       adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0;
-       times[2][3] = total[3];
+       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       times[2][2] = total[2];
     }
 #else
     }
     else
-       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       adj_secs = adj[0] = adj[1] = 0;
 #endif
-    for (i = 0; i < 3; i++) {
+    for (i = 0; i < 2; i++) {
        times[2][i] = ((total[i] - adj[i]) * 10 / (secs - adj_secs) + 5) / 10;
     }
 
 #ifdef DEBUGMODE
-    memset (total, 0, 4 * sizeof (u_long));
-#else
     memset (total, 0, 3 * sizeof (u_long));
+#else
+    memset (total, 0, 2 * sizeof (u_long));
 #endif
 
     for (secs = 1; (secs < 86400) && (cur_load_entry != NULL); secs +=
         (cur_load_entry->time_incr + 50) / 100, cur_load_entry =
         cur_load_entry->prev, current_load_data.entries++) {
        u_long time_incr = (cur_load_entry->time_incr + 50) / 100;
-       total[0] += time_incr * cur_load_entry->local_count;
-       total[1] += time_incr * cur_load_entry->client_count;
-       total[2] += time_incr * cur_load_entry->conn_count;
+       total[0] += time_incr * cur_load_entry->client_count;
+       total[1] += time_incr * cur_load_entry->conn_count;
 #ifdef DEBUGMODE
-       total[3] += cur_load_entry->cpu_usage;
+       total[2] += cur_load_entry->cpu_usage;
 #endif
        last = cur_load_entry;
     }
     if ((secs > 86400) && (last != NULL)) {
        adj_secs = secs - 86400;
-       adj[0] = adj_secs * last->local_count;
-       adj[1] = adj_secs * last->client_count;
-       adj[2] = adj_secs * last->conn_count;
+       adj[0] = adj_secs * last->client_count;
+       adj[1] = adj_secs * last->conn_count;
 #ifdef DEBUGMODE
-       times[3][3] =
-           total[3] -
+       times[3][2] =
+           total[2] -
            (last->cpu_usage * (double) adj_secs / last->time_incr);
     }
     else {
-       adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0;
-       times[3][3] = total[3];
+       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       times[3][2] = total[2];
     }
 #else
     }
     else
-       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       adj_secs = adj[0] = adj[1] = 0;
 #endif
-    for (i = 0; i < 3; i++) {
+    for (i = 0; i < 2; i++) {
        times[3][i] = ((total[i] - adj[i]) * 10 / (secs - adj_secs) + 5) / 10;
     }
 
 #ifdef DEBUGMODE
-    memset (total, 0, 4 * sizeof (u_long));
-#else
     memset (total, 0, 3 * sizeof (u_long));
+#else
+    memset (total, 0, 2 * sizeof (u_long));
 #endif
 
     for (secs = 1; (secs < 86400) && (cur_load_entry != NULL); secs +=
         (cur_load_entry->time_incr + 50) / 100, cur_load_entry =
         cur_load_entry->prev, current_load_data.entries++) {
        u_long time_incr = (cur_load_entry->time_incr + 50) / 100;
-       total[0] += time_incr * cur_load_entry->local_count;
-       total[1] += time_incr * cur_load_entry->client_count;
-       total[2] += time_incr * cur_load_entry->conn_count;
+       total[0] += time_incr * cur_load_entry->client_count;
+       total[1] += time_incr * cur_load_entry->conn_count;
 #ifdef DEBUGMODE
-       total[3] += cur_load_entry->cpu_usage;
+       total[2] += cur_load_entry->cpu_usage;
 #endif
        last = cur_load_entry;
     }
     if ((secs > 86400) && (last != NULL)) {
        adj_secs = secs - 86400;
-       adj[0] = adj_secs * last->local_count;
-       adj[1] = adj_secs * last->client_count;
-       adj[2] = adj_secs * last->conn_count;
+       adj[0] = adj_secs * last->client_count;
+       adj[1] = adj_secs * last->conn_count;
 #ifdef DEBUGMODE
-       times[4][3] =
-           total[3] -
+       times[4][2] =
+           total[2] -
            (last->cpu_usage * (double) adj_secs / last->time_incr);
     }
     else {
-       adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0;
-       times[4][3] = total[3];
+       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       times[4][2] = total[2];
     }
 #else
     }
     else
-       adj_secs = adj[0] = adj[1] = adj[2] = 0;
+       adj_secs = adj[0] = adj[1] = 0;
 #endif
-    for (i = 0; i < 3; i++) {
+    for (i = 0; i < 2; i++) {
        times[4][i] = ((total[i] - adj[i]) * 10 / (secs - adj_secs) + 5) / 10;
     }
 
@@ -335,17 +323,15 @@ void calc_load (aClient *sptr, char *parv)
 
        cur_load_entry->prev = NULL;
     }
-    strcpy (what[0], DOMAINNAME);
-    strcat (what[0], " clients");
-    strcpy (what[1], "total clients");
-    strcpy (what[2], "total connections");
+    strcpy (what[0], "total clients");
+    strcpy (what[1], "total connections");
 #ifdef DEBUGMODE
-    strcpy (what[3], "CPU usage");
+    strcpy (what[2], "CPU usage");
 #endif
     sendto_one (sptr,
                ":%s NOTICE %s :Minute   Hour  Day  Yest.  YYest.  Userload for:",
                me.name, parv);
-    for (i = 0; i < 3; i++)
+    for (i = 0; i < 2; i++)
        sendto_one (sptr,
                    ":%s NOTICE %s :%3d.%02d  %3d.%01d  %3d   %3d     %3d   %s",
                    me.name, parv, times[0][i] / 100, times[0][i] % 100,
@@ -356,12 +342,12 @@ void calc_load (aClient *sptr, char *parv)
     sendto_one (sptr,
                ":%s NOTICE %s :%6.2f%% %5.1f%% %3d%%  %3d%%    %3d%%  %s",
                me.name, parv,
-               (double) ((double) times[0][3] / (0.6 * CLOCKS_PER_SEC)),
-               (double) ((double) times[1][3] / (36 * CLOCKS_PER_SEC)),
-               (int) ((double) times[2][3] / (864 * CLOCKS_PER_SEC)),
-               (int) ((double) times[3][3] / (864 * CLOCKS_PER_SEC)),
-               (int) ((double) times[4][3] / (864 * CLOCKS_PER_SEC)),
-               what[3]);
+               (double) ((double) times[0][2] / (0.6 * CLOCKS_PER_SEC)),
+               (double) ((double) times[1][2] / (36 * CLOCKS_PER_SEC)),
+               (int) ((double) times[2][2] / (864 * CLOCKS_PER_SEC)),
+               (int) ((double) times[3][2] / (864 * CLOCKS_PER_SEC)),
+               (int) ((double) times[4][2] / (864 * CLOCKS_PER_SEC)),
+               what[2]);
 #endif
 }