ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/server.c
(Generate patch)

Comparing:
ircd-hybrid/src/s_serv.c (file contents), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-7.2/src/s_serv.c (file contents), Revision 948 by michael, Tue Jul 21 17:34:06 2009 UTC

# Line 50 | Line 50
50   #include "s_conf.h"
51   #include "s_serv.h"
52   #include "s_log.h"
53 #include "s_stats.h"
53   #include "s_user.h"
54   #include "send.h"
55   #include "memory.h"
# Line 58 | Line 57
57  
58   #define MIN_CONN_FREQ 300
59  
61 struct Client *uplink  = NULL;
62
63
60   static dlink_list cap_list = { NULL, NULL, 0 };
65 static unsigned long freeMask;
61   static void server_burst(struct Client *);
62   static int fork_server(struct Client *);
63   static void burst_all(struct Client *);
69 static void cjoin_all(struct Client *);
64   static void send_tb(struct Client *client_p, struct Channel *chptr);
65  
66   static CNCB serv_connect_callback;
67  
68   static void start_io(struct Client *);
69   static void burst_members(struct Client *, struct Channel *);
76 static void burst_ll_members(struct Client *, struct Channel *);
77 static void add_lazylinkchannel(struct Client *, struct Channel *);
70  
71   static SlinkRplHnd slink_error;
72   static SlinkRplHnd slink_zipstats;
# Line 135 | Line 127 | slink_zipstats(unsigned int rpl, unsigne
127                 struct Client *server_p)
128   {
129    struct ZipStats zipstats;
130 <  unsigned long in = 0, in_wire = 0, out = 0, out_wire = 0;
130 >  uint64_t in = 0, in_wire = 0, out = 0, out_wire = 0;
131    int i = 0;
132  
133    assert(rpl == SLINKRPL_ZIPSTATS);
# Line 195 | Line 187 | slink_zipstats(unsigned int rpl, unsigne
187    else
188      zipstats.out_ratio = 0;
189  
190 <  memcpy(&server_p->localClient->zipstats, &zipstats, sizeof (struct ZipStats));
190 >  memcpy(&server_p->localClient->zipstats, &zipstats, sizeof(struct ZipStats));
191   }
192  
193   void
194   collect_zipstats(void *unused)
195   {
196 <  dlink_node *ptr;
205 <  struct Client *target_p;
196 >  dlink_node *ptr = NULL;
197  
198    DLINK_FOREACH(ptr, serv_list.head)
199    {
200 <    target_p = ptr->data;
200 >    struct Client *target_p = ptr->data;
201  
202      if (IsCapable(target_p, CAP_ZIP))
203      {
# Line 227 | Line 218 | collect_zipstats(void *unused)
218   struct EncCapability *
219   check_cipher(struct Client *client_p, struct AccessItem *aconf)
220   {
221 <  struct EncCapability *epref;
221 >  struct EncCapability *epref = NULL;
222  
223    /* Use connect{} specific info if available */
224    if (aconf->cipher_preference)
225      epref = aconf->cipher_preference;
226 <  else
226 >  else if (ConfigFileEntry.default_cipher_preference)
227      epref = ConfigFileEntry.default_cipher_preference;
228  
229 <  /* If the server supports the capability in hand, return the matching
229 >  /*
230 >   * If the server supports the capability in hand, return the matching
231     * conf struct.  Otherwise, return NULL (an error).
232     */
233 <  if (IsCapableEnc(client_p, epref->cap))
234 <    return(epref);
233 >  if (epref && IsCapableEnc(client_p, epref->cap))
234 >    return epref;
235  
236 <  return(NULL);
236 >  return NULL;
237   }
238   #endif /* HAVE_LIBCRYPTO */
239  
# Line 256 | Line 248 | my_name_for_link(struct ConfItem *conf)
248  
249    aconf = (struct AccessItem *)map_to_conf(conf);
250    if (aconf->fakename != NULL)
251 <    return(aconf->fakename);
251 >    return aconf->fakename;
252    else
253 <    return(me.name);
253 >    return me.name;
254   }
255  
256   /*
# Line 457 | Line 449 | hunt_server(struct Client *client_p, str
449      if (!match(target_p->name, parv[server]))
450        parv[server] = target_p->name;
451  
460    /* Deal with lazylinks */
461    client_burst_if_needed(target_p, source_p);
462
452      /* This is a little kludgy but should work... */
453      if (IsClient(source_p) &&
454          ((MyConnect(target_p) && IsCapable(target_p, CAP_TS6)) ||
# Line 665 | Line 654 | check_server(const char *name, struct Cl
654      attach_conf(client_p, conf);
655    }
656  
657 <  server_aconf = (struct AccessItem *)map_to_conf(server_conf);
657 >  server_aconf = map_to_conf(server_conf);
658  
670  if (!IsConfLazyLink(server_aconf))
671    ClearCap(client_p, CAP_LL);
659   #ifdef HAVE_LIBZ /* otherwise, clear it unconditionally */
660    if (!IsConfCompressed(server_aconf))
661   #endif
# Line 676 | Line 663 | check_server(const char *name, struct Cl
663    if (!IsConfCryptLink(server_aconf))
664      ClearCap(client_p, CAP_ENC);
665    if (!IsConfTopicBurst(server_aconf))
666 +  {
667      ClearCap(client_p, CAP_TB);
668 +    ClearCap(client_p, CAP_TBURST);
669 +  }
670  
671    /* Don't unset CAP_HUB here even if the server isn't a hub,
672     * it only indicates if the server thinks it's lazylinks are
# Line 722 | Line 712 | check_server(const char *name, struct Cl
712   void
713   add_capability(const char *capab_name, int cap_flag, int add_to_default)
714   {
715 <  struct Capability *cap;
715 >  struct Capability *cap = MyMalloc(sizeof(*cap));
716  
727  cap = (struct Capability *)MyMalloc(sizeof(*cap));
717    DupString(cap->name, capab_name);
718    cap->cap = cap_flag;
719    dlinkAdd(cap, &cap->node, &cap_list);
720 +
721    if (add_to_default)
722      default_server_capabs |= cap_flag;
723   }
# Line 762 | Line 752 | delete_capability(const char *capab_name
752      }
753    }
754  
755 <  return(0);
755 >  return 0;
756   }
757  
758   /*
# Line 775 | Line 765 | delete_capability(const char *capab_name
765   int
766   find_capability(const char *capab)
767   {
768 <  dlink_node *ptr;
779 <  struct Capability *cap;
768 >  const dlink_node *ptr = NULL;
769  
770    DLINK_FOREACH(ptr, cap_list.head)
771    {
772 <    cap = ptr->data;
772 >    const struct Capability *cap = ptr->data;
773  
774 <    if (cap->cap != 0)
775 <    {
787 <      if (irccmp(cap->name, capab) == 0)
788 <        return(cap->cap);
789 <    }
774 >    if (cap->cap && !irccmp(cap->name, capab))
775 >      return cap->cap;
776    }
777 <  return(0);
777 >
778 >  return 0;
779   }
780  
781   /* send_capabilities()
# Line 811 | Line 798 | send_capabilities(struct Client *client_
798    int tl;
799    dlink_node *ptr;
800   #ifdef HAVE_LIBCRYPTO
801 <  struct EncCapability *epref;
801 >  const struct EncCapability *epref = NULL;
802    char *capend;
803    int sent_cipher = 0;
804   #endif
# Line 838 | Line 825 | send_capabilities(struct Client *client_
825      /* use connect{} specific info if available */
826      if (aconf->cipher_preference)
827        epref = aconf->cipher_preference;
828 <    else
828 >    else if (ConfigFileEntry.default_cipher_preference)
829        epref = ConfigFileEntry.default_cipher_preference;
830  
831 <    if ((epref->cap & enc_can_send))
831 >    if (epref && (epref->cap & enc_can_send))
832      {
833        /* Leave the space -- it is removed later. */
834        tl = ircsprintf(t, "%s ", epref->name);
# Line 853 | Line 840 | send_capabilities(struct Client *client_
840        t = capend; /* truncate string before ENC:, below */
841    }
842   #endif
843 <  *(t-1) = '\0';
843 >  *(t - 1) = '\0';
844    sendto_one(client_p, "CAPAB :%s", msgbuf);
845   }
846  
847   /* sendnick_TS()
848   *
849   * inputs       - client (server) to send nick towards
850 < *              - client to send nick for
850 > *          - client to send nick for
851   * output       - NONE
852   * side effects - NICK message is sent towards given client_p
853   */
# Line 885 | Line 872 | sendnick_TS(struct Client *client_p, str
872    if (HasID(target_p) && IsCapable(client_p, CAP_TS6))
873      sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s :%s",
874                 target_p->servptr->id,
875 <               target_p->name, target_p->hopcount + 1,
876 <               (unsigned long) target_p->tsinfo,
877 <               ubuf, target_p->username, target_p->host,
878 <           ((MyClient(target_p)&&!IsIPSpoof(target_p))?target_p->sockhost:"0"),
879 <           target_p->id, target_p->info);
875 >               target_p->name, target_p->hopcount + 1,
876 >               (unsigned long) target_p->tsinfo,
877 >               ubuf, target_p->username, target_p->host,
878 >               (MyClient(target_p) && IsIPSpoof(target_p)) ?
879 >               "0" : target_p->sockhost, target_p->id, target_p->info);
880    else
881      sendto_one(client_p, "NICK %s %d %lu %s %s %s %s :%s",
882                 target_p->name, target_p->hopcount + 1,
883                 (unsigned long) target_p->tsinfo,
884                 ubuf, target_p->username, target_p->host,
885                 target_p->servptr->name, target_p->info);
886 +
887    if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->serv->sconf)))
888      if (!EmptyString(target_p->away))
889        sendto_one(client_p, ":%s AWAY :%s", target_p->name,
# Line 903 | Line 891 | sendnick_TS(struct Client *client_p, str
891  
892   }
893  
906 /* client_burst_if_needed()
907 *
908 * inputs       - pointer to server
909 *              - pointer to client to add
910 * output       - NONE
911 * side effects - If this client is not known by this lazyleaf, send it
912 */
913 void
914 client_burst_if_needed(struct Client *client_p, struct Client *target_p)
915 {
916  if (!ServerInfo.hub)
917    return;
918  if (!MyConnect(client_p))
919    return;
920  if (!IsCapable(client_p,CAP_LL))
921    return;
922
923  if ((target_p->lazyLinkClientExists & client_p->localClient->serverMask) == 0)
924  {
925    sendnick_TS(client_p, target_p);
926    add_lazylinkclient(client_p,target_p);
927  }
928 }
929
894   /*
895   * show_capabilities - show current server capabilities
896   *
# Line 973 | Line 937 | struct Server *
937   make_server(struct Client *client_p)
938   {
939    if (client_p->serv == NULL)
976  {
940      client_p->serv = MyMalloc(sizeof(struct Server));
978    client_p->serv->dep_servers = 1;
979  }
941  
942    return client_p->serv;
943   }
# Line 1029 | Line 990 | server_estab(struct Client *client_p)
990    {
991      if (client_p != serv_list.head->data || serv_list.head->next)
992      {
993 <      ServerStats->is_ref++;
993 >      ++ServerStats.is_ref;
994        sendto_one(client_p, "ERROR :I'm a leaf not a hub");
995        exit_client(client_p, &me, "I'm a leaf");
996        return;
# Line 1056 | Line 1017 | server_estab(struct Client *client_p)
1017  
1018      /* Pass my info to the new server
1019       *
1059     * If trying to negotiate LazyLinks, pass on CAP_LL
1020       * If this is a HUB, pass on CAP_HUB
1021       * Pass on ZIP if supported
1022       * Pass on TB if supported.
1023       * - Dianora
1024       */
1025  
1026 <     send_capabilities(client_p, aconf,
1027 <       (IsConfLazyLink(aconf) ? find_capability("LL") : 0)
1028 <       | (IsConfCompressed(aconf) ? find_capability("ZIP") : 0)
1069 <       | (IsConfTopicBurst(aconf) ? find_capability("TB") : 0)
1070 <       , 0);
1026 >    send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0)
1027 >      | (IsConfCompressed(aconf) ? CAP_ZIP : 0)
1028 >      | (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), 0);
1029  
1030      /* SERVER is the last command sent before switching to ziplinks.
1031       * We set TCPNODELAY on the socket to make sure it gets sent out
# Line 1140 | Line 1098 | server_estab(struct Client *client_p)
1098    set_chcap_usage_counts(client_p);
1099  
1100    /* Some day, all these lists will be consolidated *sigh* */
1101 <  dlinkAdd(client_p, &client_p->lnode, &me.serv->servers);
1101 >  dlinkAdd(client_p, &client_p->lnode, &me.serv->server_list);
1102  
1103    m = dlinkFind(&unknown_list, client_p);
1104    assert(NULL != m);
# Line 1259 | Line 1217 | server_estab(struct Client *client_p)
1217                   IsHidden(target_p) ? "(H) " : "", target_p->info);
1218    }
1219  
1262  if ((ServerInfo.hub == 0) && MyConnect(client_p))
1263    uplink = client_p;
1264
1220    server_burst(client_p);
1221   }
1222  
# Line 1339 | Line 1294 | start_io(struct Client *server)
1294      memcpy(buf, &block->data[0], block->size);
1295      buf += block->size;
1296    }
1297 +
1298    dbuf_clear(&lserver->buf_recvq);
1299  
1300    /* pass the whole sendq to servlink */
# Line 1351 | Line 1307 | start_io(struct Client *server)
1307      memcpy(buf, &block->data[0], block->size);
1308      buf += block->size;
1309    }
1310 +
1311    dbuf_clear(&lserver->buf_sendq);
1312  
1313    /* start io */
# Line 1457 | Line 1414 | server_burst(struct Client *client_p)
1414    ** -orabidoo
1415    */
1416  
1417 <  /* On a "lazy link" hubs send nothing.
1461 <   * Leafs always have to send nicks plus channels
1462 <   */
1463 <  if (IsCapable(client_p, CAP_LL))
1464 <  {
1465 <    if (!ServerInfo.hub)
1466 <    {
1467 <      /* burst all our info */
1468 <      burst_all(client_p);
1469 <
1470 <      /* Now, ask for channel info on all our current channels */
1471 <      cjoin_all(client_p);
1472 <    }
1473 <  }
1474 <  else
1475 <  {
1476 <    burst_all(client_p);
1477 <  }
1417 >  burst_all(client_p);
1418  
1419    /* EOB stuff is now in burst_all */
1420    /* Always send a PING after connect burst is done */
# Line 1490 | Line 1430 | server_burst(struct Client *client_p)
1430   static void
1431   burst_all(struct Client *client_p)
1432   {
1433 <  struct Client *target_p;
1494 <  struct Channel *chptr;
1495 <  dlink_node *gptr;
1496 <  dlink_node *ptr;
1433 >  dlink_node *ptr = NULL;
1434  
1435 <  DLINK_FOREACH(gptr, global_channel_list.head)
1435 >  DLINK_FOREACH(ptr, global_channel_list.head)
1436    {
1437 <    chptr = gptr->data;
1437 >    struct Channel *chptr = ptr->data;
1438  
1439      if (dlink_list_length(&chptr->members) != 0)
1440      {
1441        burst_members(client_p, chptr);
1442        send_channel_modes(client_p, chptr);
1443 <      if (IsCapable(client_p, CAP_TB))
1443 >
1444 >      if (IsCapable(client_p, CAP_TBURST) ||
1445 >          IsCapable(client_p, CAP_TB))
1446          send_tb(client_p, chptr);
1447      }
1448    }
# Line 1512 | Line 1451 | burst_all(struct Client *client_p)
1451     */
1452    DLINK_FOREACH(ptr, global_client_list.head)
1453    {
1454 <    target_p = ptr->data;
1454 >    struct Client *target_p = ptr->data;
1455  
1456      if (!IsBursted(target_p) && target_p->from != client_p)
1457        sendnick_TS(client_p, target_p);
# Line 1531 | Line 1470 | burst_all(struct Client *client_p)
1470   /*
1471   * send_tb
1472   *
1473 < * inputs       - pointer to Client
1474 < *              - pointer to channel
1536 < * output       - NONE
1537 < * side effects - Called on a server burst when
1538 < *                server is CAP_TB capable
1539 < */
1540 < static void
1541 < send_tb(struct Client *client_p, struct Channel *chptr)
1542 < {
1543 <  if (chptr->topic != NULL && IsCapable(client_p, CAP_TB))
1544 <  {
1545 <    if (ConfigChannel.burst_topicwho)
1546 <    {
1547 <      sendto_one(client_p, ":%s TB %s %lu %s :%s",
1548 <                 me.name, chptr->chname,
1549 <                 (unsigned long)chptr->topic_time,
1550 <                 chptr->topic_info, chptr->topic);
1551 <    }
1552 <    else
1553 <    {
1554 <      sendto_one(client_p, ":%s TB %s %lu :%s",
1555 <                 me.name, chptr->chname,
1556 <                 (unsigned long)chptr->topic_time, chptr->topic);
1557 <    }
1558 <  }
1559 < }
1560 <
1561 < /* cjoin_all()
1562 < *
1563 < * inputs       - server to ask for channel info from
1473 > * inputs       - pointer to Client
1474 > *              - pointer to channel
1475   * output       - NONE
1476 < * side effects - CJOINS for all the leafs known channels is sent
1476 > * side effects - Called on a server burst when
1477 > *                server is CAP_TB|CAP_TBURST capable
1478   */
1479   static void
1480 < cjoin_all(struct Client *client_p)
1569 < {
1570 <  const dlink_node *gptr = NULL;
1571 <
1572 <  DLINK_FOREACH(gptr, global_channel_list.head)
1573 <  {
1574 <    const struct Channel *chptr = gptr->data;
1575 <    sendto_one(client_p, ":%s CBURST %s",
1576 <               me.name, chptr->chname);
1577 <  }
1578 < }
1579 <
1580 < /* burst_channel()
1581 < *
1582 < * inputs       - pointer to server to send sjoins to
1583 < *              - channel pointer
1584 < * output       - none
1585 < * side effects - All sjoins for channel(s) given by chptr are sent
1586 < *                for all channel members. ONLY called by hub on
1587 < *                behalf of a lazylink so client_p is always guarunteed
1588 < *                to be a LL leaf.
1589 < */
1590 < void
1591 < burst_channel(struct Client *client_p, struct Channel *chptr)
1592 < {
1593 <  burst_ll_members(client_p, chptr);
1594 <
1595 <  send_channel_modes(client_p, chptr);
1596 <  add_lazylinkchannel(client_p,chptr);
1597 <
1598 <  if (chptr->topic != NULL && chptr->topic_info != NULL)
1599 <  {
1600 <    sendto_one(client_p, ":%s TOPIC %s %s %lu :%s",
1601 <               me.name, chptr->chname, chptr->topic_info,
1602 <               (unsigned long)chptr->topic_time, chptr->topic);
1603 <  }
1604 < }
1605 <
1606 < /* add_lazlinkchannel()
1607 < *
1608 < * inputs       - pointer to directly connected leaf server
1609 < *                being introduced to this hub
1610 < *              - pointer to channel structure being introduced
1611 < * output       - NONE
1612 < * side effects - The channel pointed to by chptr is now known
1613 < *                to be on lazyleaf server given by local_server_p.
1614 < *                mark that in the bit map and add to the list
1615 < *                of channels to examine after this newly introduced
1616 < *                server is squit off.
1617 < */
1618 < static void
1619 < add_lazylinkchannel(struct Client *local_server_p, struct Channel *chptr)
1620 < {
1621 <  assert(MyConnect(local_server_p));
1622 <
1623 <  chptr->lazyLinkChannelExists |= local_server_p->localClient->serverMask;
1624 <  dlinkAdd(chptr, make_dlink_node(), &lazylink_channels);
1625 < }
1626 <
1627 < /* add_lazylinkclient()
1628 < *
1629 < * inputs       - pointer to directly connected leaf server
1630 < *                being introduced to this hub
1631 < *              - pointer to client being introduced
1632 < * output       - NONE
1633 < * side effects - The client pointed to by client_p is now known
1634 < *                to be on lazyleaf server given by local_server_p.
1635 < *                mark that in the bit map and add to the list
1636 < *                of clients to examine after this newly introduced
1637 < *                server is squit off.
1638 < */
1639 < void
1640 < add_lazylinkclient(struct Client *local_server_p, struct Client *client_p)
1641 < {
1642 <  assert(MyConnect(local_server_p));
1643 <  client_p->lazyLinkClientExists |= local_server_p->localClient->serverMask;
1644 < }
1645 <
1646 < /* remove_lazylink_flags()
1647 < *
1648 < * inputs       - pointer to server quitting
1649 < * output       - NONE
1650 < * side effects - All the channels on the lazylink channel list are examined
1651 < *                If they hold a bit corresponding to the servermask
1652 < *                attached to client_p, clear that bit. If this bitmask
1653 < *                goes to 0, then the channel is no longer known to
1654 < *                be on any lazylink server, and can be removed from the
1655 < *                link list.
1656 < *
1657 < *                Similar is done for lazylink clients
1658 < *
1659 < *                This function must be run by the HUB on any exiting
1660 < *                lazylink leaf server, while the pointer is still valid.
1661 < *                Hence must be run from client.c in exit_one_client()
1662 < *
1663 < *                The old code scanned all channels, this code only
1664 < *                scans channels/clients on the lazylink_channels
1665 < *                lazylink_clients lists.
1666 < */
1667 < void
1668 < remove_lazylink_flags(unsigned long mask)
1480 > send_tb(struct Client *client_p, struct Channel *chptr)
1481   {
1482 <  dlink_node *ptr;
1483 <  dlink_node *next_ptr;
1484 <  struct Channel *chptr;
1485 <  struct Client *target_p;
1486 <  unsigned long clear_mask;
1487 <
1488 <  if (!mask) /* On 0 mask, don't do anything */
1489 <   return;
1490 <
1491 <  clear_mask = ~mask;
1492 <  freeMask |= mask;
1493 <
1494 <  DLINK_FOREACH_SAFE(ptr, next_ptr, lazylink_channels.head)
1482 >  /*
1483 >   * We may also send an empty topic here, but only if topic_time isn't 0,
1484 >   * i.e. if we had a topic that got unset.  This is required for syncing
1485 >   * topics properly.
1486 >   *
1487 >   * Imagine the following scenario: Our downlink introduces a channel
1488 >   * to us with a TS that is equal to ours, but the channel topic on
1489 >   * their side got unset while the servers were in splitmode, which means
1490 >   * their 'topic' is newer.  They simply wanted to unset it, so we have to
1491 >   * deal with it in a more sophisticated fashion instead of just resetting
1492 >   * it to their old topic they had before.  Read m_tburst.c:ms_tburst
1493 >   * for further information   -Michael
1494 >   */
1495 >  if (chptr->topic_time != 0)
1496    {
1497 <    chptr = ptr->data;
1498 <
1499 <    chptr->lazyLinkChannelExists &= clear_mask;
1500 <
1501 <    if (chptr->lazyLinkChannelExists == 0)
1497 >    if (IsCapable(client_p, CAP_TBURST))
1498 >      sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s",
1499 >                 me.name, (unsigned long)chptr->channelts, chptr->chname,
1500 >                 (unsigned long)chptr->topic_time,
1501 >                 chptr->topic_info ? chptr->topic_info : "",
1502 >                 chptr->topic ? chptr->topic : "");
1503 >    else if (IsCapable(client_p, CAP_TB))
1504      {
1505 <      dlinkDelete(ptr, &lazylink_channels);
1506 <      free_dlink_node(ptr);
1505 >      if (ConfigChannel.burst_topicwho)
1506 >      {
1507 >        sendto_one(client_p, ":%s TB %s %lu %s :%s",
1508 >                   me.name, chptr->chname,
1509 >                   (unsigned long)chptr->topic_time,
1510 >                   chptr->topic_info, chptr->topic ? chptr->topic : "");
1511 >      }
1512 >      else
1513 >      {
1514 >        sendto_one(client_p, ":%s TB %s %lu :%s",
1515 >                   me.name, chptr->chname,
1516 >                   (unsigned long)chptr->topic_time,
1517 >                   chptr->topic ? chptr->topic : "");
1518 >      }
1519      }
1520    }
1694
1695  DLINK_FOREACH(ptr, global_client_list.head)
1696  {
1697    target_p = ptr->data;
1698    target_p->lazyLinkClientExists &= clear_mask;
1699  }
1521   }
1522  
1523   /* burst_members()
# Line 1728 | Line 1549 | burst_members(struct Client *client_p, s
1549    }
1550   }
1551  
1731 /* burst_ll_members()
1732 *
1733 * inputs       - pointer to server to send members to
1734 *              - dlink_list pointer to membership list to send
1735 * output       - NONE
1736 * side effects - This version also has to check the bitmap for lazylink
1737 */
1738 static void
1739 burst_ll_members(struct Client *client_p, struct Channel *chptr)
1740 {
1741  struct Client *target_p;
1742  struct Membership *ms;
1743  dlink_node *ptr;
1744
1745  DLINK_FOREACH(ptr, chptr->members.head)
1746  {
1747    ms       = ptr->data;
1748    target_p = ms->client_p;
1749
1750    if ((target_p->lazyLinkClientExists & client_p->localClient->serverMask) == 0)
1751    {
1752      if (target_p->from != client_p)
1753      {
1754        add_lazylinkclient(client_p,target_p);
1755        sendnick_TS(client_p, target_p);
1756      }
1757    }
1758  }
1759 }
1760
1761 /* set_autoconn()
1762 *
1763 * inputs       - struct Client pointer to oper requesting change
1764 * output       - none
1765 * side effects - set autoconnect mode
1766 */
1767 void
1768 set_autoconn(struct Client *source_p, const char *name, int newval)
1769 {
1770  struct ConfItem *conf;
1771  struct AccessItem *aconf;
1772
1773  if (name != NULL)
1774  {
1775    conf = find_exact_name_conf(SERVER_TYPE, name, NULL, NULL);
1776    if (conf != NULL)
1777    {
1778      aconf = (struct AccessItem *)map_to_conf(conf);
1779      if (newval)
1780        SetConfAllowAutoConn(aconf);
1781      else
1782        ClearConfAllowAutoConn(aconf);
1783
1784      sendto_realops_flags(UMODE_ALL, L_ALL,
1785                           "%s has changed AUTOCONN for %s to %i",
1786                           source_p->name, name, newval);
1787      sendto_one(source_p,
1788                 ":%s NOTICE %s :AUTOCONN for %s is now set to %i",
1789                 me.name, source_p->name, name, newval);
1790    }
1791    else
1792    {
1793      sendto_one(source_p, ":%s NOTICE %s :Can't find %s",
1794                 me.name, source_p->name, name);
1795    }
1796  }
1797  else
1798  {
1799    sendto_one(source_p, ":%s NOTICE %s :Please specify a server name!",
1800               me.name, source_p->name);
1801  }
1802 }
1803
1804 void
1805 initServerMask(void)
1806 {
1807  freeMask = 0xFFFFFFFFUL;
1808 }
1809
1810 /* nextFreeMask()
1811 *
1812 * inputs       - NONE
1813 * output       - unsigned long next unused mask for use in LL
1814 * side effects -
1815 */
1816 unsigned long
1817 nextFreeMask(void)
1818 {
1819  int i;
1820  unsigned long mask = 1;
1821
1822  for (i = 0; i < 32; i++)
1823  {
1824    if (mask & freeMask)
1825    {
1826      freeMask &= ~mask;
1827      return(mask);
1828    }
1829
1830    mask <<= 1;
1831  }
1832
1833  return(0L); /* watch this special case ... */
1834 }
1835
1552   /* New server connection code
1553   * Based upon the stuff floating about in s_bsd.c
1554   *   -- adrian
# Line 2132 | Line 1848 | serv_connect_callback(fde_t *fd, int sta
1848  
1849    /* Pass my info to the new server
1850     *
2135   * If trying to negotiate LazyLinks, pass on CAP_LL
1851     * If this is a HUB, pass on CAP_HUB
1852     * Pass on ZIP if supported
1853     * Pass on TB if supported.
1854     * - Dianora
1855     */
1856 <  send_capabilities(client_p, aconf,
1857 <                    (IsConfLazyLink(aconf) ? find_capability("LL") : 0)
1858 <                    | (IsConfCompressed(aconf) ? find_capability("ZIP") : 0)
2144 <                    | (IsConfTopicBurst(aconf) ? find_capability("TB") : 0)
2145 <                    , 0);
1856 >  send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0)
1857 >                    | (IsConfCompressed(aconf) ? CAP_ZIP : 0)
1858 >                    | (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), 0);
1859  
1860    sendto_one(client_p, "SERVER %s 1 :%s%s",
1861               my_name_for_link(conf),
# Line 2250 | Line 1963 | cryptlink_init(struct Client *client_p,
1963      return;
1964    }
1965  
1966 <  send_capabilities(client_p, aconf,
1967 <                    (IsConfLazyLink(aconf) ? find_capability("LL") : 0)
1968 <                    | (IsConfCompressed(aconf) ? find_capability("ZIP") : 0)
1969 <                    | (IsConfTopicBurst(aconf) ? find_capability("TB") : 0)
1970 <                    , CAP_ENC_MASK);
1966 >  send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0)
1967 >                    | (IsConfCompressed(aconf) ? CAP_ZIP : 0)
1968 >                    | (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), CAP_ENC_MASK);
1969 >
1970 >  if (me.id[0])
1971 >    sendto_one(client_p, "PASS . TS %d %s", TS_CURRENT, me.id);
1972  
1973    sendto_one(client_p, "CRYPTLINK SERV %s %s :%s%s",
1974               my_name_for_link(conf), key_to_send,

Comparing:
ircd-hybrid/src/s_serv.c (property svn:keywords), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-7.2/src/s_serv.c (property svn:keywords), Revision 948 by michael, Tue Jul 21 17:34:06 2009 UTC

# Line 1 | Line 1
1 < Revision
1 > Id Revision

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)