From: Kevin L. Mitchell Date: Sat, 9 Jun 2001 01:34:17 +0000 (+0000) Subject: Author: Kev X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=c96ae51b55396171423b5477642627494c0ecd73 Author: Kev 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 --- diff --git a/ChangeLog b/ChangeLog index 3ce7234..0cf881c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2001-06-08 Kevin L. Mitchell + * 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 diff --git a/include/client.h b/include/client.h index 21b8b35..3af00dd 100644 --- a/include/client.h +++ b/include/client.h @@ -356,6 +356,8 @@ struct Client { #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 */ @@ -400,6 +402,8 @@ struct Client { #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)) @@ -418,6 +422,8 @@ struct Client { #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) diff --git a/ircd/m_server.c b/ircd/m_server.c index 6743284..0ddd244 100644 --- a/ircd/m_server.c +++ b/ircd/m_server.c @@ -128,7 +128,7 @@ * 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[]) { @@ -180,6 +180,18 @@ 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 (*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); @@ -680,9 +692,10 @@ int mr_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 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)); } return 0; } @@ -765,7 +778,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * 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[]) { @@ -809,6 +822,18 @@ 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 (*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); @@ -1300,9 +1325,10 @@ 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 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)); } return 0; } diff --git a/ircd/s_bsd.c b/ircd/s_bsd.c index 9d15648..ed5bc83 100644 --- a/ircd/s_bsd.c +++ b/ircd/s_bsd.c @@ -460,9 +460,10 @@ static int completed_connection(struct Client* cptr) 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; } diff --git a/ircd/s_serv.c b/ircd/s_serv.c index c6eac61..5b8cb84 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -113,9 +113,11 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf) /* * 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 @@ -176,8 +178,9 @@ 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 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), + IsHub(cptr) ? "h" : "", IsService(cptr) ? "s" : "", cli_info(cptr)); } @@ -214,9 +217,10 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf) 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), + IsHub(acptr) ? "h" : "", IsService(acptr) ? "s" : "", cli_info(acptr)); } }