Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Sat, 3 Jun 2000 00:09:13 +0000 (00:09 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Sat, 3 Jun 2000 00:09:13 +0000 (00:09 +0000)
Log message:

This is the fix for the JUPE storm problem

Status: Tested

Testing needed:

Rigiorious testing of all code paths, to make sure I haven't
missed something important...

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@247 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/s_serv.h
ircd/m_server.c
ircd/s_serv.c

index b69bc4760e1319241e2ede48a5888758a41e723c..70c41e79da4e9fbdd219e008f3b8f92ce6512881 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2000-06-02  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/m_server.c: Resend jupe only when there is no %<lastmod>
+       parameter, or when it falls out of bounds: see comments prior to
+       call to jupe_resend(); call server_estab with struct Jupe
+       parameter, so that we place the appropriate %<lastmod> in the
+       appropriate place.
+
+       * ircd/s_serv.c (server_estab): send %<lastmod> for introduced
+       server, as well as for servers when we're sending the BURST
+
+       * include/s_serv.h: add a struct Jupe * to the arguments for
+       server_estab() so that we can send the appropriate lastmod
+       parameter
+
        * ircd/m_gline.c (ms_gline): actually, this should be the
        slightest bit more efficient...
 
 #
 # ChangeLog for ircu2.10.11
 #
-# $Id: ChangeLog,v 1.141 2000-06-02 23:09:20 kev Exp $
+# $Id: ChangeLog,v 1.142 2000-06-03 00:09:12 kev Exp $
 #
 # Insert new changes at beginning of the change list.
 #
index 189105ce59a56e9743e5345c21bc624696e20df2..387e7cfc4b46fec68478a2ba3f77c554dff07766 100644 (file)
@@ -12,7 +12,7 @@
 
 struct ConfItem;
 struct Client;
-
+struct Jupe;
 
 extern unsigned int max_connection_count;
 extern unsigned int max_client_count;
@@ -23,7 +23,8 @@ extern unsigned int max_client_count;
 extern int exit_new_server(struct Client* cptr, struct Client* sptr,
                            const char* host, time_t timestamp, const char* fmt, ...);
 extern int a_kills_b_too(struct Client *a, struct Client *b);
-extern int server_estab(struct Client *cptr, struct ConfItem *aconf);
+extern int server_estab(struct Client *cptr, struct ConfItem *aconf,
+                       struct Jupe *ajupe);
 
 
 #endif /* INCLUDED_s_serv_h */
index 7daaaa71c7f43a76c9221a37a702a22568d946e9..491b5e14b3606488513faff861e3bb8ff4ca2272 100644 (file)
@@ -768,7 +768,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 #endif
     }
 
-    ret = server_estab(cptr, aconf);
+    ret = server_estab(cptr, aconf, ajupe);
   }
   else
     ret = 0;
@@ -800,6 +800,8 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
  *    parv[6] = "YMM", where 'Y' is the server numeric and "MM" is the
  *              numeric nick mask of this server.
  *    parv[7] = 0 (not used yet, mandatory unsigned int after u2.10.06)
+ *    parv[8] = %<lastmod> - optional parameter only present if there's an
+ *             outstanding JUPE; specifies the JUPE's lastmod field
  */
 int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
@@ -822,6 +824,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   time_t           timestamp = 0;
   time_t           recv_time;
   time_t           ghost = 0;
+  time_t           lastmod = 0;
 
   if (IsUserPort(cptr))
     return exit_client_msg(cptr, cptr, &me,
@@ -836,9 +839,6 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   }
   host = parv[1];
 
-  if ((ajupe = jupe_find(host)) && JupeIsActive(ajupe))
-    jupe_resend(cptr, ajupe);
-
   /*
    * Detect protocol
    */
@@ -875,6 +875,16 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return exit_new_server(cptr, sptr, host, timestamp,
                            "Incompatible protocol: %s", parv[5]);
   }
+  if (parc > 9 && *parv[8] == '%')
+    lastmod = atoi(parv[8] + 1);
+  /* If there's a jupe that matches, and it's a global jupe, and the
+   * introducer didn't indicate it knew of the jupe or has an older
+   * version of the jupe, and the connection isn't in a BURST, resynch
+   * the jupe.
+   */
+  if ((ajupe = jupe_find(host)) && !JupeIsLocal(ajupe) &&
+      JupeLastMod(ajupe) > lastmod && !IsBurstOrBurstAck(cptr))
+    jupe_resend(cptr, ajupe);
   /*
    * Check for "FRENCH " infection ;-) (actually this should
    * be replaced with routine to check the hostname syntax in
@@ -1435,7 +1445,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 #endif
     }
 
-    ret = server_estab(cptr, aconf);
+    ret = server_estab(cptr, aconf, ajupe);
   }
   else
     ret = 0;
@@ -2099,7 +2109,7 @@ int m_server(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 #endif
     }
 
-    ret = server_estab(cptr, aconf);
+    ret = server_estab(cptr, aconf); /* XXX DEAD */
   }
   else
     ret = 0;
index 96958ed4d9787950d6fff779281ce20ea1714909..93e8793f3b0381fcdd0f11891de68eb59fd11399 100644 (file)
@@ -111,7 +111,8 @@ int a_kills_b_too(struct Client *a, struct Client *b)
  * May only be called after a SERVER was received from cptr,
  * and thus make_server was called, and serv->prot set. --Run
  */
-int server_estab(struct Client *cptr, struct ConfItem *aconf)
+int server_estab(struct Client *cptr, struct ConfItem *aconf,
+                struct Jupe *ajupe)
 {
   struct Client* acptr = 0;
   const char*    inpath;
@@ -192,9 +193,16 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf)
       continue;
     if (!match(me.name, cptr->name))
       continue;
-    sendcmdto_one(&me, CMD_SERVER, acptr, "%s 2 0 %Tu J%02u %s%s 0 :%s",
-                 cptr->name, cptr->serv->timestamp, Protocol(cptr),
-                 NumServCap(cptr), cptr->info);
+    if (ajupe)
+      sendcmdto_one(&me, CMD_SERVER, acptr,
+                   "%s 2 0 %Tu J%02u %s%s 0 %%%Tu :%s", cptr->name,
+                   cptr->serv->timestamp, Protocol(cptr), NumServCap(cptr),
+                   JupeLastMod(ajupe), cptr->info);
+    else
+      sendcmdto_one(&me, CMD_SERVER, acptr,
+                   "%s 2 0 %Tu J%02u %s%s 0 :%s", cptr->name,
+                   cptr->serv->timestamp, Protocol(cptr), NumServCap(cptr),
+                   cptr->info);
   }
 
   /*
@@ -229,10 +237,18 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf)
       split = (MyConnect(acptr) && 
                0 != ircd_strcmp(acptr->name, acptr->sockhost) &&
                0 != ircd_strncmp(acptr->info, "JUPE", 4));
-      sendcmdto_one(acptr->serv->up, CMD_SERVER, cptr, "%s %d 0 %Tu %s%u "
-                   "%s%s 0 :%s", acptr->name, acptr->hopcount + 1,
-                   acptr->serv->timestamp, protocol_str, Protocol(acptr),
-                   NumServCap(acptr), acptr->info);
+      if ((ajupe = jupe_find(acptr->name)))
+       sendcmdto_one(acptr->serv->up, CMD_SERVER, cptr,
+                     "%s %d 0 %Tu %s%u %s%s 0 %%%Tu :%s", acptr->name,
+                     acptr->hopcount + 1, acptr->serv->timestamp,
+                     protocol_str, Protocol(acptr), NumServCap(acptr),
+                     JupeLastMod(ajupe), acptr->info);
+      else
+       sendcmdto_one(acptr->serv->up, CMD_SERVER, cptr,
+                     "%s %d 0 %Tu %s%u %s%s 0 :%s", acptr->name,
+                     acptr->hopcount + 1, acptr->serv->timestamp,
+                     protocol_str, Protocol(acptr), NumServCap(acptr),
+                     acptr->info);
     }
   }