ircd: introduce 'no-export' links

Links that are 'no-export' are not distributed to the rest of the IRC network (including local peers).
This provides a core primitive for 'anycasting' services (but the actual issue of synchronizing data in
a services package is left to the authors of the services package).
This commit is contained in:
William Pitcock 2016-09-16 17:18:55 -05:00
parent 4d3f8ead19
commit 087555a00f
4 changed files with 14 additions and 0 deletions

View file

@ -576,6 +576,7 @@ connect "irc.uplink.com" {
* compressed - compress traffic via ziplinks
* topicburst - burst topics between servers
* ssl - ssl/tls encrypted server connections
* no-export - marks the link as a no-export link (not exported to other links)
*/
flags = compressed, topicburst;
};

View file

@ -213,6 +213,7 @@ struct server_conf
#define SERVER_TB 0x0010
#define SERVER_AUTOCONN 0x0020
#define SERVER_SSL 0x0040
#define SERVER_NO_EXPORT 0x0080
#define ServerConfIllegal(x) ((x)->flags & SERVER_ILLEGAL)
#define ServerConfEncrypted(x) ((x)->flags & SERVER_ENCRYPTED)
@ -220,6 +221,7 @@ struct server_conf
#define ServerConfTb(x) ((x)->flags & SERVER_TB)
#define ServerConfAutoconn(x) ((x)->flags & SERVER_AUTOCONN)
#define ServerConfSSL(x) ((x)->flags & SERVER_SSL)
#define ServerConfNoExport(x) ((x)->flags & SERVER_NO_EXPORT)
extern struct server_conf *make_server_conf(void);
extern void free_server_conf(struct server_conf *);

View file

@ -365,6 +365,7 @@ static struct mode_table connect_table[] = {
{ "encrypted", SERVER_ENCRYPTED },
{ "topicburst", SERVER_TB },
{ "ssl", SERVER_SSL },
{ "no-export", SERVER_NO_EXPORT },
{ NULL, 0 },
};

View file

@ -617,6 +617,9 @@ burst_TS6(struct Client *client_p)
if(!IsPerson(target_p))
continue;
if(MyClient(target_p->from) && target_p->localClient->att_sconf != NULL && ServerConfNoExport(target_p->localClient->att_sconf))
continue;
send_umode(NULL, target_p, 0, ubuf);
if(!*ubuf)
{
@ -910,6 +913,9 @@ server_estab(struct Client *client_p)
if(target_p == client_p)
continue;
if(target_p->localClient->att_sconf != NULL && ServerConfNoExport(target_p->localClient->att_sconf))
continue;
if(has_id(target_p) && has_id(client_p))
{
sendto_one(target_p, ":%s SID %s 2 %s :%s%s",
@ -958,6 +964,10 @@ server_estab(struct Client *client_p)
if(IsMe(target_p) || target_p->from == client_p)
continue;
/* don't distribute downstream leaves of servers that are no-export */
if(MyClient(target_p->from) && target_p->from->localClient->att_sconf != NULL && ServerConfNoExport(target_p->from->localClient->att_sconf))
continue;
/* presumption, if target has an id, so does its uplink */
if(has_id(client_p) && has_id(target_p))
sendto_one(client_p, ":%s SID %s %d %s :%s%s",