Log message:
Implement a mechanism for servers to indicate to the network that they are
hubs, servers, or both. We take parv[7], an unspecified unsigned int in
previous versions, and turn it into a mode-like string--it's not actually a
mode in the /mode #channel sense, but it looks similar. This works in
conjunction with two new flags, FLAGS_HUB and FLAGS_SERVICE. There is
currently no user-visible impact of this change.
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@493
c9e4aea6-c8fd-4c43-8297-
357d70d61c8c
2001-06-08 Kevin L. Mitchell <klmitch@mit.edu>
2001-06-08 Kevin L. Mitchell <klmitch@mit.edu>
+ * ircd/s_serv.c (server_estab): send a +h flag in our SERVER
+ command if we're configured as a hub; send individual server flags
+ in SERVER commands
+
+ * ircd/s_bsd.c (completed_connection): send a +h flag in our
+ SERVER command if we're configured as a hub
+
+ * ircd/m_server.c: implement parv[7] as a mode-like string; +h
+ sets the FLAGS_HUB flag for a server; +s sets the FLAGS_SERVICE
+ flag for a server; +hs sets both flags; also modify CMD_SERVER
+ format string to send the flags
+
+ * include/client.h: define two new flags, FLAGS_HUB and
+ FLAGS_SERVICE to mark services and hubs as such; define testing
+ macros, setting macros
+
* ircd/s_user.c: remove deprecated struct Gline* argument to
register_user(); remove GLINE rebroadcast; do not send GLINE
acknowledgement parameter to NICK; do not look for GLINE
* ircd/s_user.c: remove deprecated struct Gline* argument to
register_user(); remove GLINE rebroadcast; do not send GLINE
acknowledgement parameter to NICK; do not look for GLINE
#define FLAGS_CLOSING 0x0400 /* set when closing to suppress errors */
#define FLAGS_UPING 0x0800 /* has active UDP ping request */
#define FLAGS_CHKACCESS 0x1000 /* ok to check clients access if set */
#define FLAGS_CLOSING 0x0400 /* set when closing to suppress errors */
#define FLAGS_UPING 0x0800 /* has active UDP ping request */
#define FLAGS_CHKACCESS 0x1000 /* ok to check clients access if set */
+#define FLAGS_HUB 0x2000 /* server is a hub */
+#define FLAGS_SERVICE 0x4000 /* server is a service */
#define FLAGS_LOCAL 0x00010000 /* set for local clients */
#define FLAGS_GOTID 0x00020000 /* successful ident lookup achieved */
#define FLAGS_DOID 0x00040000 /* I-lines say must use ident return */
#define FLAGS_LOCAL 0x00010000 /* set for local clients */
#define FLAGS_GOTID 0x00020000 /* successful ident lookup achieved */
#define FLAGS_DOID 0x00040000 /* I-lines say must use ident return */
#define SendDebug(x) (cli_flags(x) & FLAGS_DEBUG)
#define SendServNotice(x) (cli_flags(x) & FLAGS_SERVNOTICE)
#define SendWallops(x) (cli_flags(x) & FLAGS_WALLOP)
#define SendDebug(x) (cli_flags(x) & FLAGS_DEBUG)
#define SendServNotice(x) (cli_flags(x) & FLAGS_SERVNOTICE)
#define SendWallops(x) (cli_flags(x) & FLAGS_WALLOP)
+#define IsHub(x) (cli_flags(x) & FLAGS_HUB)
+#define IsService(x) (cli_flags(x) & FLAGS_SERVICE)
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
#define SetUPing(x) (cli_flags(x) |= FLAGS_UPING)
#define SetWallops(x) (cli_flags(x) |= FLAGS_WALLOP)
#define SetServNotice(x) (cli_flags(x) |= FLAGS_SERVNOTICE)
#define SetUPing(x) (cli_flags(x) |= FLAGS_UPING)
#define SetWallops(x) (cli_flags(x) |= FLAGS_WALLOP)
#define SetServNotice(x) (cli_flags(x) |= FLAGS_SERVNOTICE)
+#define SetHub(x) (cli_flags(x) |= FLAGS_HUB)
+#define SetService(x) (cli_flags(x) |= FLAGS_SERVICE)
#define ClearAccess(x) (cli_flags(x) &= ~FLAGS_CHKACCESS)
#define ClearBurst(x) (cli_flags(x) &= ~FLAGS_BURST)
#define ClearAccess(x) (cli_flags(x) &= ~FLAGS_CHKACCESS)
#define ClearBurst(x) (cli_flags(x) &= ~FLAGS_BURST)
* If cptr is P10:
* parv[6] = "YMM", where 'Y' is the server numeric and "MM" is the
* numeric nick mask of this server.
* If cptr is P10:
* 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[7] = +hs (h == hub, s == service)
*/
int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
*/
int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
if (!IsServer(cptr)) /* Don't allow silently connecting a server */
*parv[5] = 'J';
if (!IsServer(cptr)) /* Don't allow silently connecting a server */
*parv[5] = 'J';
+ if (*parv[7] == '+') {
+ for (ch = parv[7] + 1; *ch; ch++)
+ switch (*ch) {
+ case 'h':
+ SetHub(cptr);
+ break;
+ case 's':
+ SetService(cptr);
+ break;
+ }
+ }
+
prot = atoi(parv[5] + 1);
if (prot > atoi(MAJOR_PROTOCOL))
prot = atoi(MAJOR_PROTOCOL);
prot = atoi(parv[5] + 1);
if (prot > atoi(MAJOR_PROTOCOL))
prot = atoi(MAJOR_PROTOCOL);
continue;
if (0 == match(cli_name(&me), cli_name(acptr)))
continue;
continue;
if (0 == match(cli_name(&me), cli_name(acptr)))
continue;
- sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %s %s %s%s 0 :%s",
- cli_name(acptr), hop + 1, parv[4], parv[5], NumServCap(acptr),
- cli_info(acptr));
+ sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %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));
* If cptr is P10:
* parv[6] = "YMM", where 'Y' is the server numeric and "MM" is the
* numeric nick mask of this server.
* If cptr is P10:
* 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[7] = +hs (h == hub, s == service)
*/
int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
*/
int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
if (!IsServer(cptr)) /* Don't allow silently connecting a server */
*parv[5] = 'J';
if (!IsServer(cptr)) /* Don't allow silently connecting a server */
*parv[5] = 'J';
+ if (*parv[7] == '+') {
+ for (ch = parv[7] + 1; *ch; ch++)
+ switch (*ch) {
+ case 'h':
+ SetHub(cptr);
+ break;
+ case 's':
+ SetService(cptr);
+ break;
+ }
+ }
+
prot = atoi(parv[5] + 1);
if (prot > atoi(MAJOR_PROTOCOL))
prot = atoi(MAJOR_PROTOCOL);
prot = atoi(parv[5] + 1);
if (prot > atoi(MAJOR_PROTOCOL))
prot = atoi(MAJOR_PROTOCOL);
continue;
if (0 == match(cli_name(&me), cli_name(acptr)))
continue;
continue;
if (0 == match(cli_name(&me), cli_name(acptr)))
continue;
- sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %s %s %s%s 0 :%s",
- cli_name(acptr), hop + 1, parv[4], parv[5], NumServCap(acptr),
- cli_info(acptr));
+ sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %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));
cli_lasttime(cptr) = CurrentTime;
cli_flags(cptr) |= FLAGS_PINGSENT;
cli_lasttime(cptr) = CurrentTime;
cli_flags(cptr) |= FLAGS_PINGSENT;
- sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s :%s",
- cli_name(&me), cli_serv(&me)->timestamp, newts, MAJOR_PROTOCOL,
- NumServCap(&me), cli_info(&me));
+ sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s +%s :%s",
+ cli_name(&me), cli_serv(&me)->timestamp, newts,
+ MAJOR_PROTOCOL, NumServCap(&me),
+ feature_bool(FEAT_HUB) ? "h" : "", cli_info(&me));
return (IsDead(cptr)) ? 0 : 1;
}
return (IsDead(cptr)) ? 0 : 1;
}
/*
* Pass my info to the new server
*/
/*
* Pass my info to the new server
*/
- sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s :%s", cli_name(&me),
- cli_serv(&me)->timestamp, cli_serv(cptr)->timestamp, MAJOR_PROTOCOL,
- NumServCap(&me), *(cli_info(&me)) ? cli_info(&me) : "IRCers United");
+ sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s +%s :%s",
+ cli_name(&me), cli_serv(&me)->timestamp,
+ cli_serv(cptr)->timestamp, MAJOR_PROTOCOL, NumServCap(&me),
+ feature_bool(FEAT_HUB) ? "h" : "",
+ *(cli_info(&me)) ? cli_info(&me) : "IRCers United");
/*
* Don't charge this IP# for connecting
* XXX - if this comes from a server port, it will not have been added
/*
* Don't charge this IP# for connecting
* XXX - if this comes from a server port, it will not have been added
if (!match(cli_name(&me), cli_name(cptr)))
continue;
sendcmdto_one(&me, CMD_SERVER, acptr,
if (!match(cli_name(&me), cli_name(cptr)))
continue;
sendcmdto_one(&me, CMD_SERVER, acptr,
- "%s 2 0 %Tu J%02u %s%s 0 :%s", cli_name(cptr),
+ "%s 2 0 %Tu J%02u %s%s +%s%s :%s", cli_name(cptr),
cli_serv(cptr)->timestamp, Protocol(cptr), NumServCap(cptr),
cli_serv(cptr)->timestamp, Protocol(cptr), NumServCap(cptr),
+ IsHub(cptr) ? "h" : "", IsService(cptr) ? "s" : "",
0 != ircd_strcmp(cli_name(acptr), cli_sockhost(acptr)) &&
0 != ircd_strncmp(cli_info(acptr), "JUPE", 4));
sendcmdto_one(cli_serv(acptr)->up, CMD_SERVER, cptr,
0 != ircd_strcmp(cli_name(acptr), cli_sockhost(acptr)) &&
0 != ircd_strncmp(cli_info(acptr), "JUPE", 4));
sendcmdto_one(cli_serv(acptr)->up, CMD_SERVER, cptr,
- "%s %d 0 %Tu %s%u %s%s 0 :%s", cli_name(acptr),
+ "%s %d 0 %Tu %s%u %s%s +%s%s :%s", cli_name(acptr),
cli_hopcount(acptr) + 1, cli_serv(acptr)->timestamp,
protocol_str, Protocol(acptr), NumServCap(acptr),
cli_hopcount(acptr) + 1, cli_serv(acptr)->timestamp,
protocol_str, Protocol(acptr), NumServCap(acptr),
+ IsHub(acptr) ? "h" : "", IsService(acptr) ? "s" : "",