Get rid of hub_mask/leaf_mask

This commit is contained in:
Ed Kellett 2020-11-14 18:00:20 +00:00
parent e5e814b3db
commit 6485005214
15 changed files with 1 additions and 251 deletions

View file

@ -311,7 +311,6 @@ connect "irc.uplink.com" {
send_password = "password";
accept_password = "anotherpassword";
port = 6666;
hub_mask = "*";
class = "server";
flags = compressed, topicburst;
@ -323,7 +322,6 @@ connect "ssl.uplink.com" {
send_password = "password";
accept_password = "anotherpassword";
port = 9999;
hub_mask = "*";
class = "server";
flags = ssl, topicburst;
};
@ -586,7 +584,6 @@ general {
use_propagated_bans = yes;
stats_e_disabled = no;
stats_c_oper_only = no;
stats_h_oper_only = no;
stats_y_oper_only = no;
stats_o_oper_only = yes;
stats_P_oper_only = no;

View file

@ -574,16 +574,6 @@ connect "irc.uplink.com" {
/* port: the port to connect to this server on */
port = 6666;
/* hub mask: the mask of servers that this server may hub. Multiple
* entries are permitted
*/
hub_mask = "*";
/* leaf mask: the mask of servers this server may not hub. Multiple
* entries are permitted. Useful for forbidding EU -> US -> EU routes.
*/
#leaf_mask = "*.uk";
/* class: the class this server is in */
class = "server";
@ -620,7 +610,6 @@ connect "ssl.uplink.com" {
send_password = "password";
accept_password = "anotherpassword";
port = 9999;
hub_mask = "*";
class = "server";
flags = ssl, topicburst;
};
@ -1189,9 +1178,6 @@ general {
/* stats c oper only: make stats c (connect {}) oper only */
stats_c_oper_only = no;
/* stats h oper only: make stats h (hub_mask/leaf_mask) oper only */
stats_h_oper_only = no;
/* stats y oper only: make stats y (class {}) oper only */
stats_y_oper_only = no;

View file

@ -17,7 +17,6 @@ X B - Shows hash statistics
X E - Shows Events
X f - Shows File Descriptors
* g - Shows global K lines
^ h - Shows hub_mask/leaf_mask (Old H:/L: lines)
^ i - Shows auth blocks (Old I: lines)
^ K - Shows K lines (or matched klines)
^ k - Shows temporary K lines (or matched klines)

View file

@ -7,7 +7,6 @@ server parameter is given) for info corresponding to
LETTER
------ (^ = Can be configured to be oper only.)
^ c - Shows connect blocks
^ h - Shows hub_mask/leaf_mask (Old H:/L: lines)
^ i - Shows auth blocks (or matched auth block)
^ K - Shows K lines (or matched klines)
^ k - Shows temporary K lines (or matched klines)

View file

@ -194,7 +194,6 @@ struct config_file_entry
int stats_e_disabled;
int stats_c_oper_only;
int stats_y_oper_only;
int stats_h_oper_only;
int stats_o_oper_only;
int stats_k_oper_only;
enum stats_l_oper_only stats_l_oper_only;
@ -301,7 +300,6 @@ struct server_info
char sid[4];
char *description;
char *network_name;
int hub;
struct rb_sockaddr_storage bind4;
struct rb_sockaddr_storage bind6;
int default_max_clients;

View file

@ -44,7 +44,6 @@ struct ConfItem;
extern rb_dlink_list cluster_conf_list;
extern rb_dlink_list oper_conf_list;
extern rb_dlink_list hubleaf_conf_list;
extern rb_dlink_list server_conf_list;
extern rb_dlink_list xline_conf_list;
extern rb_dlink_list resv_conf_list;
@ -68,7 +67,7 @@ typedef struct
void add_tgchange(const char *host);
tgchange *find_tgchange(const char *host);
/* shared/cluster/hub/leaf confs */
/* cluster confs */
struct remote_conf
{
char *username;
@ -102,10 +101,6 @@ struct remote_conf
SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV | SHARED_GRANT)
#define CLUSTER_ALL (SHARED_ALL | SHARED_LOCOPS)
/* flags used in hub/leaf */
#define CONF_HUB 0x0001
#define CONF_LEAF 0x0002
struct oper_conf
{
char *name;

View file

@ -1349,38 +1349,6 @@ conf_set_connect_flags(void *data)
set_modes_from_table(&yy_server->flags, "flag", connect_table, args);
}
static void
conf_set_connect_hub_mask(void *data)
{
struct remote_conf *yy_hub;
if(EmptyString(yy_server->name))
return;
yy_hub = make_remote_conf();
yy_hub->flags = CONF_HUB;
yy_hub->host = rb_strdup(data);
yy_hub->server = rb_strdup(yy_server->name);
rb_dlinkAdd(yy_hub, &yy_hub->node, &hubleaf_conf_list);
}
static void
conf_set_connect_leaf_mask(void *data)
{
struct remote_conf *yy_leaf;
if(EmptyString(yy_server->name))
return;
yy_leaf = make_remote_conf();
yy_leaf->flags = CONF_LEAF;
yy_leaf->host = rb_strdup(data);
yy_leaf->server = rb_strdup(yy_server->name);
rb_dlinkAdd(yy_leaf, &yy_leaf->node, &hubleaf_conf_list);
}
static void
conf_set_connect_class(void *data)
{
@ -2652,8 +2620,6 @@ static struct ConfEntry conf_connect_table[] =
{ "vhost", CF_QSTRING, conf_set_connect_vhost, 0, NULL },
{ "port", CF_INT, conf_set_connect_port, 0, NULL },
{ "aftype", CF_STRING, conf_set_connect_aftype, 0, NULL },
{ "hub_mask", CF_QSTRING, conf_set_connect_hub_mask, 0, NULL },
{ "leaf_mask", CF_QSTRING, conf_set_connect_leaf_mask, 0, NULL },
{ "class", CF_QSTRING, conf_set_connect_class, 0, NULL },
{ "\0", 0, NULL, 0, NULL }
};
@ -2727,7 +2693,6 @@ static struct ConfEntry conf_general_table[] =
{ "short_motd", CF_YESNO, NULL, 0, &ConfigFileEntry.short_motd },
{ "stats_c_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_c_oper_only },
{ "stats_e_disabled", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_e_disabled },
{ "stats_h_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_h_oper_only },
{ "stats_o_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_o_oper_only },
{ "stats_P_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_P_oper_only },
{ "stats_y_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_y_oper_only },

View file

@ -743,7 +743,6 @@ set_default_conf(void)
ConfigFileEntry.stats_P_oper_only = false;
ConfigFileEntry.stats_c_oper_only = false;
ConfigFileEntry.stats_y_oper_only = false;
ConfigFileEntry.stats_h_oper_only = false;
ConfigFileEntry.map_oper_only = true;
ConfigFileEntry.operspy_admin_only = false;
ConfigFileEntry.pace_wait = 10;

View file

@ -48,7 +48,6 @@
rb_dlink_list cluster_conf_list;
rb_dlink_list oper_conf_list;
rb_dlink_list hubleaf_conf_list;
rb_dlink_list server_conf_list;
rb_dlink_list xline_conf_list;
rb_dlink_list resv_conf_list; /* nicks only! */
@ -87,12 +86,6 @@ clear_s_newconf(void)
free_remote_conf(ptr->data);
}
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, hubleaf_conf_list.head)
{
rb_dlinkDelete(ptr, &hubleaf_conf_list);
free_remote_conf(ptr->data);
}
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, oper_conf_list.head)
{
free_oper_conf(ptr->data);

View file

@ -341,12 +341,8 @@ ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
/* same size as in s_misc.c */
const char *name;
struct Client *target_p;
struct remote_conf *hub_p;
hook_data_client hdata;
int hop;
int hlined = 0;
int llined = 0;
rb_dlink_node *ptr;
char squitreason[160];
name = parv[1];
@ -412,82 +408,6 @@ ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
* server links...
*/
/*
* See if the newly found server is behind a guaranteed
* leaf. If so, close the link.
*
*/
RB_DLINK_FOREACH(ptr, hubleaf_conf_list.head)
{
hub_p = ptr->data;
if(match(hub_p->server, client_p->name) && match(hub_p->host, name))
{
if(hub_p->flags & CONF_HUB)
hlined++;
else
llined++;
}
}
/* Ok, this way this works is
*
* A server can have a CONF_HUB allowing it to introduce servers
* behind it.
*
* connect {
* name = "irc.bighub.net";
* hub_mask="*";
* ...
*
* That would allow "irc.bighub.net" to introduce anything it wanted..
*
* However
*
* connect {
* name = "irc.somehub.fi";
* hub_mask="*";
* leaf_mask="*.edu";
*...
* Would allow this server in finland to hub anything but
* .edu's
*/
/* Ok, check client_p can hub the new server */
if(!hlined)
{
/* OOOPs nope can't HUB */
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "Non-Hub link %s introduced %s.",
client_p->name, name);
ilog(L_SERVER, "Non-Hub link %s introduced %s.",
client_p->name, name);
snprintf(squitreason, sizeof squitreason,
"No matching hub_mask for %s",
name);
exit_client(NULL, client_p, &me, squitreason);
return;
}
/* Check for the new server being leafed behind this HUB */
if(llined)
{
/* OOOPs nope can't HUB this leaf */
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Link %s introduced leafed server %s.",
client_p->name, name);
ilog(L_SERVER, "Link %s introduced leafed server %s.",
client_p->name, name);
snprintf(squitreason, sizeof squitreason,
"Matching leaf_mask for %s",
name);
exit_client(NULL, client_p, &me, squitreason);
return;
}
if(strlen(name) > HOSTLEN)
{
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
@ -539,11 +459,7 @@ static void
ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *target_p;
struct remote_conf *hub_p;
hook_data_client hdata;
rb_dlink_node *ptr;
int hlined = 0;
int llined = 0;
char squitreason[160];
/* collision on the name? */
@ -605,55 +521,6 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
return;
}
/* for the directly connected server:
* H: allows it to introduce a server matching that mask
* L: disallows it introducing a server matching that mask
*/
RB_DLINK_FOREACH(ptr, hubleaf_conf_list.head)
{
hub_p = ptr->data;
if(match(hub_p->server, client_p->name) && match(hub_p->host, parv[1]))
{
if(hub_p->flags & CONF_HUB)
hlined++;
else
llined++;
}
}
/* no matching hub_mask */
if(!hlined)
{
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Non-Hub link %s introduced %s.",
client_p->name, parv[1]);
ilog(L_SERVER, "Non-Hub link %s introduced %s.",
client_p->name, parv[1]);
snprintf(squitreason, sizeof squitreason,
"No matching hub_mask for %s",
parv[1]);
exit_client(NULL, client_p, &me, squitreason);
return;
}
/* matching leaf_mask */
if(llined)
{
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Link %s introduced leafed server %s.",
client_p->name, parv[1]);
ilog(L_SERVER, "Link %s introduced leafed server %s.",
client_p->name, parv[1]);
snprintf(squitreason, sizeof squitreason,
"Matching leaf_mask for %s",
parv[1]);
exit_client(NULL, client_p, &me, squitreason);
return;
}
/* ok, alls good */
target_p = make_client(client_p);
make_server(target_p);

View file

@ -406,11 +406,6 @@ static struct InfoStruct info_table[] = {
"STATS C output is only shown to operators",
INFO_INTBOOL_YN(&ConfigFileEntry.stats_c_oper_only),
},
{
"stats_h_oper_only",
"STATS H output is only shown to operators",
INFO_INTBOOL_YN(&ConfigFileEntry.stats_h_oper_only),
},
{
"stats_i_oper_only",
"STATS I output is only shown to operators",

View file

@ -104,7 +104,6 @@ static void stats_deny(struct Client *);
static void stats_exempt(struct Client *);
static void stats_events(struct Client *);
static void stats_prop_klines(struct Client *);
static void stats_hubleaf(struct Client *);
static void stats_auth(struct Client *);
static void stats_tklines(struct Client *);
static void stats_klines(struct Client *);
@ -159,8 +158,6 @@ static struct stats_cmd stats_cmd_table[256] = {
['f'] = HANDLER_NORM(stats_comm, true, NULL),
['F'] = HANDLER_NORM(stats_comm, true, NULL),
['g'] = HANDLER_NORM(stats_prop_klines, false, "oper:general"),
['h'] = HANDLER_NORM(stats_hubleaf, false, NULL),
['H'] = HANDLER_NORM(stats_hubleaf, false, NULL),
['i'] = HANDLER_NORM(stats_auth, false, NULL),
['I'] = HANDLER_NORM(stats_auth, false, NULL),
['k'] = HANDLER_NORM(stats_tklines, false, NULL),
@ -528,37 +525,6 @@ stats_prop_klines(struct Client *source_p)
}
}
static void
stats_hubleaf(struct Client *source_p)
{
struct remote_conf *hub_p;
rb_dlink_node *ptr;
if((ConfigFileEntry.stats_h_oper_only ||
(ConfigServerHide.flatten_links && !IsExemptShide(source_p))) &&
!IsOperGeneral(source_p))
{
sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str (ERR_NOPRIVILEGES));
return;
}
RB_DLINK_FOREACH(ptr, hubleaf_conf_list.head)
{
hub_p = ptr->data;
if(hub_p->flags & CONF_HUB)
sendto_one_numeric(source_p, RPL_STATSHLINE,
form_str(RPL_STATSHLINE),
hub_p->host, hub_p->server);
else
sendto_one_numeric(source_p, RPL_STATSLLINE,
form_str(RPL_STATSLLINE),
hub_p->host, hub_p->server);
}
}
static void
stats_auth (struct Client *source_p)
{

View file

@ -13,7 +13,6 @@ serverinfo {
sid = "1TT";
description = "Testsuite";
network_name = "Testsuite";
hub = yes;
vhost = "127.0.0.1";
};
@ -53,7 +52,6 @@ connect "testsuite2." {
port = 7602;
send_password = "testsuite";
accept_password = "testsuite";
hub_mask = "*";
class = "server";
flags = topicburst;
};
@ -63,7 +61,6 @@ connect "testsuite3." {
port = 7603;
send_password = "testsuite";
accept_password = "testsuite";
hub_mask = "*";
class = "server";
flags = topicburst;
};

View file

@ -13,7 +13,6 @@ serverinfo {
sid = "2TT";
description = "Testsuite";
network_name = "Testsuite";
hub = yes;
vhost = "127.0.0.1";
};
@ -53,7 +52,6 @@ connect "testsuite1." {
port = 7601;
send_password = "testsuite";
accept_password = "testsuite";
hub_mask = "*";
class = "server";
flags = topicburst;
};
@ -63,7 +61,6 @@ connect "testsuite3." {
port = 7603;
send_password = "testsuite";
accept_password = "testsuite";
hub_mask = "*";
class = "server";
flags = topicburst;
};

View file

@ -13,7 +13,6 @@ serverinfo {
sid = "3TT";
description = "Testsuite";
network_name = "Testsuite";
hub = yes;
vhost = "127.0.0.1";
};
@ -53,7 +52,6 @@ connect "testsuite1." {
port = 7601;
send_password = "testsuite";
accept_password = "testsuite";
hub_mask = "*";
class = "server";
flags = topicburst;
};
@ -63,7 +61,6 @@ connect "testsuite2." {
port = 7602;
send_password = "testsuite";
accept_password = "testsuite";
hub_mask = "*";
class = "server";
flags = topicburst;
};