Propagate +6 flag across network. Show correct error when outbound connections fail.
authorMichael Poole <mdpoole@troilus.org>
Sat, 26 Mar 2005 05:43:49 +0000 (05:43 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sat, 26 Mar 2005 05:43:49 +0000 (05:43 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1341 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/m_server.c
ircd/s_bsd.c
ircd/s_serv.c

index 359006c46bffe382e902cd29374c5f127d00eaf2..8f960c3d0904308ec83d0314f3be97d420d73bb1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-03-25  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/m_server.c (set_server_flags): New function.  Unlike the
+       old code, this recognizes the IPv6 flag.  (Spotted by Reed.)
+       (mr_server): Use the new function.
+       (ms_server): Likewise.  Also don't show "Net junction:" message if
+       any closer server is still bursting (also spotted by Reed).
+       Finally, forward the +6 flag to other servers.
+
+       * ircd/s_serv.c (server_estab): Forward the +6 flag here, too.
+
+       * ircd/s_bsd.c (client_sock_callback): Re-set cli_error() after it
+       may be cleared by completed_connection().
+
 2005-03-23  Michael Poole <mdpoole@troilus.org>
 
        * ircd/m_burst.c (ms_burst): Remove limit and keys when a channel
index c3169d082ae7c404014d507358937392de1bd210..64e2fc11d0f054ce6fba91f16cedc886dd66310e 100644 (file)
@@ -479,6 +479,20 @@ check_start_timestamp(struct Client *cptr, time_t timestamp, time_t start_timest
   }
 }
 
+/** Interpret a server's flags.
+ *
+ * @param[in] cptr New server structure.
+ * @param[in] flags String listing server's P10 flags.
+ */
+void set_server_flags(struct Client *cptr, const char *flags)
+{
+    while (*flags) switch (*flags++) {
+    case 'h': SetHub(cptr); break;
+    case 's': SetService(cptr); break;
+    case '6': SetIPv6(cptr); break;
+    }
+}
+
 /** Handle a SERVER message from an unregistered connection.
  *
  * \a parv has the following elements:
@@ -499,7 +513,6 @@ check_start_timestamp(struct Client *cptr, time_t timestamp, time_t start_timest
  */
 int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
-  char*            ch;
   char*            host;
   struct ConfItem* aconf;
   struct Jupe*     ajupe;
@@ -617,17 +630,8 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   /* Attach any necessary UWorld config items. */
   attach_confs_byhost(cptr, host, CONF_UWORLD);
 
-  if (*parv[7] == '+') {
-    for (ch = parv[7] + 1; *ch; ch++)
-      switch (*ch) {
-      case 'h':
-        SetHub(cptr);
-       break;
-      case 's':
-       SetService(cptr);
-       break;
-      }
-  }
+  if (*parv[7] == '+')
+    set_server_flags(cptr, parv[7] + 1);
 
   recv_time = TStime();
   check_start_timestamp(cptr, timestamp, start_timestamp, recv_time);
@@ -666,7 +670,6 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
  */
 int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
-  char*            ch;
   int              i;
   char*            host;
   struct Client*   acptr;
@@ -741,17 +744,8 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   /* Attach any necessary UWorld config items. */
   attach_confs_byhost(cptr, host, CONF_UWORLD);
 
-  if (*parv[7] == '+') {
-    for (ch = parv[7] + 1; *ch; ch++)
-      switch (*ch) {
-      case 'h':
-        SetHub(acptr);
-       break;
-      case 's':
-       SetService(acptr);
-       break;
-      }
-  }
+  if (*parv[7] == '+')
+    set_server_flags(acptr, parv[7] + 1);
 
   Count_newremoteserver(UserStats);
   if (Protocol(acptr) < 10)
@@ -761,9 +755,13 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   if (*parv[5] == 'J')
   {
     SetBurst(acptr);
-    sendto_opmask_butone(0, SNO_NETWORK, "Net junction: %s %s",
-                         cli_name(sptr), cli_name(acptr));
     SetJunction(acptr);
+    for (bcptr = cli_serv(acptr)->up; !IsMe(bcptr); bcptr = cli_serv(bcptr)->up)
+      if (IsBurstOrBurstAck(bcptr))
+          break;
+    if (IsMe(bcptr))
+      sendto_opmask_butone(0, SNO_NETWORK, "Net junction: %s %s",
+                           cli_name(sptr), cli_name(acptr));
   }
   /*
    * Old sendto_serv_but_one() call removed because we now need to send
@@ -776,10 +774,11 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       continue;
     if (0 == match(cli_name(&me), cli_name(acptr)))
       continue;
-    sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %s %s %s%s +%s%s :%s",
+    sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %s %s %s%s +%s%s%s :%s",
                   cli_name(acptr), hop + 1, parv[4], parv[5],
                   NumServCap(acptr), IsHub(acptr) ? "h" : "",
-                  IsService(acptr) ? "s" : "", cli_info(acptr));
+                  IsService(acptr) ? "s" : "", IsIPv6(acptr) ? "6" : "",
+                  cli_info(acptr));
   }
   return 0;
 }
index 67edbbb352299e882548c5cc1a8a5d4985b93f9f..63a0228517e68d5f3c18a87fe4f2c9062b8d9312 100644 (file)
@@ -900,6 +900,11 @@ static void client_sock_callback(struct Event* ev)
     cli_error(cptr) = ev_data(ev);
     if (s_state(&(con_socket(con))) == SS_CONNECTING) {
       completed_connection(cptr);
+      /* for some reason, the os_get_sockerr() in completed_connect()
+       * can return 0 even when ev_data(ev) indicates a real error, so
+       * re-assign the client error here.
+       */
+      cli_error(cptr) = ev_data(ev);
       break;
     }
     /*FALLTHROUGH*/
index 14ea9868076c91ad6a3b333c0af1e1425ab284bd..9e64c518b36de4cd7b7c88a533b09c10c41ae403 100644 (file)
@@ -193,10 +193,10 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf)
     if (!match(cli_name(&me), cli_name(cptr)))
       continue;
     sendcmdto_one(&me, CMD_SERVER, acptr,
-                 "%s 2 0 %Tu J%02u %s%s +%s%s :%s", cli_name(cptr),
+                 "%s 2 0 %Tu J%02u %s%s +%s%s%s :%s", cli_name(cptr),
                  cli_serv(cptr)->timestamp, Protocol(cptr), NumServCap(cptr),
                  IsHub(cptr) ? "h" : "", IsService(cptr) ? "s" : "",
-                 cli_info(cptr));
+                 IsIPv6(cptr) ? "6" : "", cli_info(cptr));
   }
 
   /* Send these as early as possible so that glined users/juped servers can
@@ -236,11 +236,11 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf)
       if (0 == match(cli_name(&me), cli_name(acptr)))
         continue;
       sendcmdto_one(cli_serv(acptr)->up, CMD_SERVER, cptr,
-                   "%s %d 0 %Tu %s%u %s%s +%s%s :%s", cli_name(acptr),
+                   "%s %d 0 %Tu %s%u %s%s +%s%s%s :%s", cli_name(acptr),
                    cli_hopcount(acptr) + 1, cli_serv(acptr)->timestamp,
                    protocol_str, Protocol(acptr), NumServCap(acptr),
                    IsHub(acptr) ? "h" : "", IsService(acptr) ? "s" : "",
-                   cli_info(acptr));
+                   IsIPv6(acptr) ? "6" : "", cli_info(acptr));
     }
   }