| 41 |
|
#include "s_conf.h" /* AccessItem, report_configured_links */ |
| 42 |
|
#include "s_misc.h" /* serv_info */ |
| 43 |
|
#include "s_serv.h" /* hunt_server */ |
| 44 |
– |
#include "s_stats.h" /* tstats */ |
| 44 |
|
#include "s_user.h" /* show_opers */ |
| 45 |
|
#include "event.h" /* events */ |
| 46 |
|
#include "dbuf.h" |
| 50 |
|
#include "resv.h" /* report_resv */ |
| 51 |
|
#include "whowas.h" |
| 52 |
|
#include "list.h" |
| 53 |
+ |
#include "watch.h" |
| 54 |
|
|
| 55 |
|
static void do_stats(struct Client *, int, char **); |
| 56 |
|
static void m_stats(struct Client *, struct Client *, int, char *[]); |
| 180 |
|
{ 'z', stats_memory, 1, 0, }, |
| 181 |
|
{ 'Z', stats_ziplinks, 1, 0, }, |
| 182 |
|
{ '?', stats_servlinks, 0, 0, }, |
| 183 |
< |
{ '\0', (void(*)())0, 0, 0, } |
| 183 |
> |
{ '\0', NULL, 0, 0, } |
| 184 |
|
}; |
| 185 |
|
|
| 186 |
|
const char *from, *to; |
| 379 |
|
const dlink_node *gptr = NULL; |
| 380 |
|
const dlink_node *dlink = NULL; |
| 381 |
|
|
| 382 |
< |
int local_client_conf_count = 0; /* local client conf links */ |
| 383 |
< |
int users_counted = 0; /* user structs */ |
| 382 |
> |
unsigned int local_client_conf_count = 0; /* local client conf links */ |
| 383 |
> |
unsigned int users_counted = 0; /* user structs */ |
| 384 |
|
|
| 385 |
< |
int channel_users = 0; /* XXX */ |
| 386 |
< |
int channel_invites = 0; |
| 387 |
< |
int channel_bans = 0; |
| 388 |
< |
int channel_except = 0; |
| 389 |
< |
int channel_invex = 0; |
| 390 |
< |
|
| 391 |
< |
int wwu = 0; /* whowas users */ |
| 392 |
< |
int class_count = 0; /* classes */ |
| 393 |
< |
int users_invited_count = 0; /* users invited */ |
| 394 |
< |
int aways_counted = 0; |
| 395 |
< |
int number_ips_stored; /* number of ip addresses hashed */ |
| 396 |
< |
|
| 397 |
< |
unsigned long channel_memory = 0; |
| 398 |
< |
size_t channel_ban_memory = 0; |
| 399 |
< |
size_t channel_except_memory = 0; |
| 400 |
< |
size_t channel_invex_memory = 0; |
| 385 |
> |
unsigned int channel_users = 0; /* XXX */ |
| 386 |
> |
unsigned int channel_invites = 0; |
| 387 |
> |
unsigned int channel_bans = 0; |
| 388 |
> |
unsigned int channel_except = 0; |
| 389 |
> |
unsigned int channel_invex = 0; |
| 390 |
> |
|
| 391 |
> |
unsigned int wwu = 0; /* whowas users */ |
| 392 |
> |
unsigned int class_count = 0; /* classes */ |
| 393 |
> |
unsigned int aways_counted = 0; |
| 394 |
> |
unsigned int number_ips_stored; /* number of ip addresses hashed */ |
| 395 |
> |
|
| 396 |
> |
uint64_t channel_memory = 0; |
| 397 |
> |
uint64_t channel_ban_memory = 0; |
| 398 |
> |
uint64_t channel_except_memory = 0; |
| 399 |
> |
uint64_t channel_invex_memory = 0; |
| 400 |
|
|
| 401 |
|
unsigned int safelist_count = 0; |
| 402 |
< |
size_t safelist_memory = 0; |
| 402 |
> |
uint64_t safelist_memory = 0; |
| 403 |
|
|
| 404 |
< |
unsigned long away_memory = 0; /* memory used by aways */ |
| 405 |
< |
unsigned long wwm = 0; /* whowas array memory used */ |
| 406 |
< |
unsigned long conf_memory = 0; /* memory used by conf lines */ |
| 407 |
< |
unsigned long mem_ips_stored; /* memory used by ip address hash */ |
| 408 |
< |
|
| 409 |
< |
unsigned long client_hash_table_size = 0; |
| 410 |
< |
unsigned long channel_hash_table_size = 0; |
| 411 |
< |
unsigned long resv_hash_table_size = 0; |
| 412 |
< |
unsigned long id_hash_table_size = 0; |
| 413 |
< |
unsigned long total_channel_memory = 0; |
| 414 |
< |
unsigned long totww = 0; |
| 404 |
> |
uint64_t away_memory = 0; /* memory used by aways */ |
| 405 |
> |
uint64_t wwm = 0; /* whowas array memory used */ |
| 406 |
> |
uint64_t conf_memory = 0; /* memory used by conf lines */ |
| 407 |
> |
uint64_t mem_ips_stored; /* memory used by ip address hash */ |
| 408 |
> |
|
| 409 |
> |
uint64_t client_hash_table_size = 0; |
| 410 |
> |
uint64_t channel_hash_table_size = 0; |
| 411 |
> |
uint64_t resv_hash_table_size = 0; |
| 412 |
> |
uint64_t id_hash_table_size = 0; |
| 413 |
> |
uint64_t total_channel_memory = 0; |
| 414 |
> |
uint64_t totww = 0; |
| 415 |
|
|
| 416 |
|
unsigned int local_client_count = 0; |
| 417 |
|
unsigned int remote_client_count = 0; |
| 418 |
|
|
| 419 |
< |
unsigned int local_client_memory_used = 0; |
| 420 |
< |
unsigned int remote_client_memory_used = 0; |
| 419 |
> |
uint64_t local_client_memory_used = 0; |
| 420 |
> |
uint64_t remote_client_memory_used = 0; |
| 421 |
|
|
| 422 |
< |
unsigned long total_memory = 0; |
| 422 |
> |
uint64_t total_memory = 0; |
| 423 |
|
unsigned int topic_count = 0; |
| 424 |
|
|
| 425 |
+ |
unsigned int wlh = 0; /* watchlist headers */ |
| 426 |
+ |
unsigned int wle = 0; /* watchlist entries */ |
| 427 |
+ |
uint64_t wlhm = 0; /* watchlist memory used */ |
| 428 |
+ |
|
| 429 |
|
count_whowas_memory(&wwu, &wwm); |
| 430 |
|
|
| 431 |
|
DLINK_FOREACH(gptr, global_client_list.head) |
| 436 |
|
{ |
| 437 |
|
++local_client_count; |
| 438 |
|
local_client_conf_count += dlink_list_length(&target_p->localClient->confs); |
| 439 |
+ |
wle += dlink_list_length(&target_p->localClient->watches); |
| 440 |
|
} |
| 441 |
|
else |
| 442 |
|
++remote_client_count; |
| 444 |
|
if (IsClient(target_p)) |
| 445 |
|
{ |
| 446 |
|
++users_counted; |
| 443 |
– |
users_invited_count += dlink_list_length(&target_p->invited); |
| 447 |
|
|
| 448 |
|
if (target_p->away != NULL) |
| 449 |
|
{ |
| 458 |
|
sizeof(struct Channel); |
| 459 |
|
DLINK_FOREACH(gptr, global_channel_list.head) |
| 460 |
|
{ |
| 461 |
< |
struct Ban *actualBan; |
| 462 |
< |
struct Channel *chptr = gptr->data; |
| 461 |
> |
const struct Ban *actualBan; |
| 462 |
> |
const struct Channel *chptr = gptr->data; |
| 463 |
|
|
| 464 |
|
channel_users += dlink_list_length(&chptr->members); |
| 465 |
|
channel_invites += dlink_list_length(&chptr->invites); |
| 515 |
|
safelist_memory = safelist_count * sizeof(struct ListTask); |
| 516 |
|
DLINK_FOREACH(gptr, listing_client_list.head) |
| 517 |
|
{ |
| 518 |
< |
struct Client *acptr = gptr->data; |
| 518 |
> |
const struct Client *acptr = gptr->data; |
| 519 |
|
|
| 520 |
|
DLINK_FOREACH(dlink, acptr->localClient->list_task->show_mask.head) |
| 521 |
|
safelist_memory += strlen(dlink->data); |
| 540 |
|
/* count up all classes */ |
| 541 |
|
class_count = dlink_list_length(&class_items); |
| 542 |
|
|
| 543 |
< |
sendto_one(source_p, ":%s %d %s z :Clients %u(%lu) Invites %u(%lu)", |
| 543 |
> |
watch_count_memory(&wlh, &wlhm); |
| 544 |
> |
|
| 545 |
> |
sendto_one(source_p, ":%s %d %s z :WATCH headers %u(%u) entries %d(%d)", |
| 546 |
> |
me.name, RPL_STATSDEBUG, source_p->name, wlh, wlhm, wle, |
| 547 |
> |
wle * sizeof(dlink_node)); |
| 548 |
> |
|
| 549 |
> |
sendto_one(source_p, ":%s %d %s z :Clients %u(%u)", |
| 550 |
|
me.name, RPL_STATSDEBUG, source_p->name, users_counted, |
| 551 |
< |
(unsigned long)(users_counted * sizeof(struct Client)), |
| 543 |
< |
users_invited_count, (unsigned long)(users_invited_count * sizeof(dlink_node))); |
| 551 |
> |
(users_counted * sizeof(struct Client))); |
| 552 |
|
|
| 553 |
< |
sendto_one(source_p, ":%s %d %s z :User aways %u(%d)", |
| 553 |
> |
sendto_one(source_p, ":%s %d %s z :User aways %u(%llu)", |
| 554 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 555 |
< |
aways_counted, (int)away_memory); |
| 555 |
> |
aways_counted, away_memory); |
| 556 |
|
|
| 557 |
< |
sendto_one(source_p, ":%s %d %s z :Attached confs %u(%lu)", |
| 557 |
> |
sendto_one(source_p, ":%s %d %s z :Attached confs %u(%llu)", |
| 558 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 559 |
|
local_client_conf_count, |
| 560 |
< |
(unsigned long)(local_client_conf_count * sizeof(dlink_node))); |
| 560 |
> |
(unsigned long long)(local_client_conf_count * sizeof(dlink_node))); |
| 561 |
|
|
| 562 |
|
/* XXX ConfigItemList fix */ |
| 563 |
|
#if 0 |
| 573 |
|
dlink_list_length(&nresv_items), |
| 574 |
|
dlink_list_length(&nresv_items) * sizeof(struct MatchItem)); |
| 575 |
|
|
| 576 |
< |
sendto_one(source_p, ":%s %d %s z :Classes %u(%lu)", |
| 576 |
> |
sendto_one(source_p, ":%s %d %s z :Classes %u(%llu)", |
| 577 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 578 |
< |
class_count, (unsigned long)(class_count * sizeof(struct ClassItem))); |
| 578 |
> |
class_count, (unsigned long long)(class_count * sizeof(struct ClassItem))); |
| 579 |
|
|
| 580 |
< |
sendto_one(source_p, ":%s %d %s z :Channels %lu(%lu) Topics %u(%d)", |
| 580 |
> |
sendto_one(source_p, ":%s %d %s z :Channels %lu(%llu) Topics %u(%d)", |
| 581 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 582 |
|
dlink_list_length(&global_channel_list), |
| 583 |
|
channel_memory, topic_count, topic_count * |
| 584 |
|
(TOPICLEN + 1 + USERHOST_REPLYLEN)); |
| 585 |
|
|
| 586 |
< |
sendto_one(source_p, ":%s %d %s z :Bans %u(%u)", |
| 586 |
> |
sendto_one(source_p, ":%s %d %s z :Bans %u(%llu)", |
| 587 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 588 |
|
channel_bans, channel_ban_memory); |
| 589 |
|
|
| 590 |
< |
sendto_one(source_p, ":%s %d %s z :Exceptions %u(%u)", |
| 590 |
> |
sendto_one(source_p, ":%s %d %s z :Exceptions %u(%llu)", |
| 591 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 592 |
|
channel_except, channel_except_memory); |
| 593 |
|
|
| 594 |
< |
sendto_one(source_p, ":%s %d %s z :Invex %u(%u)", |
| 594 |
> |
sendto_one(source_p, ":%s %d %s z :Invex %u(%llu)", |
| 595 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 596 |
|
channel_invex, channel_invex_memory); |
| 597 |
|
|
| 598 |
< |
sendto_one(source_p, ":%s %d %s z :Channel members %u(%lu) invite %u(%lu)", |
| 598 |
> |
sendto_one(source_p, ":%s %d %s z :Channel members %u(%llu) invites %u(%llu)", |
| 599 |
|
me.name, RPL_STATSDEBUG, source_p->name, channel_users, |
| 600 |
< |
(unsigned long)(channel_users * sizeof(struct Membership)), |
| 601 |
< |
channel_invites, (unsigned long)channel_invites * |
| 602 |
< |
sizeof(dlink_node)); |
| 600 |
> |
(unsigned long long)(channel_users * sizeof(struct Membership)), |
| 601 |
> |
channel_invites, (unsigned long long)channel_invites * |
| 602 |
> |
sizeof(dlink_node) * 2); |
| 603 |
|
|
| 604 |
|
total_channel_memory = channel_memory + channel_ban_memory + |
| 605 |
|
channel_users * sizeof(struct Membership) + |
| 606 |
< |
channel_invites * sizeof(dlink_node); |
| 606 |
> |
(channel_invites * sizeof(dlink_node)*2); |
| 607 |
|
|
| 608 |
< |
sendto_one(source_p, ":%s %d %s z :Safelist %u(%u)", |
| 608 |
> |
sendto_one(source_p, ":%s %d %s z :Safelist %u(%llu)", |
| 609 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 610 |
|
safelist_count, safelist_memory); |
| 611 |
|
|
| 612 |
< |
sendto_one(source_p, ":%s %d %s z :Whowas users %u(%lu)", |
| 612 |
> |
sendto_one(source_p, ":%s %d %s z :Whowas users %u(%llu)", |
| 613 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 614 |
< |
wwu, (unsigned long)(wwu * sizeof(struct Client))); |
| 614 |
> |
wwu, (unsigned long long)(wwu * sizeof(struct Client))); |
| 615 |
|
|
| 616 |
< |
sendto_one(source_p, ":%s %d %s z :Whowas array %u(%d)", |
| 616 |
> |
sendto_one(source_p, ":%s %d %s z :Whowas array %u(%llu)", |
| 617 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 618 |
< |
NICKNAMEHISTORYLENGTH, (int)wwm); |
| 618 |
> |
NICKNAMEHISTORYLENGTH, wwm); |
| 619 |
|
|
| 620 |
|
totww = wwu * sizeof(struct Client) + wwm; |
| 621 |
|
/**** |
| 632 |
|
resv_hash_table_size, U_MAX, id_hash_table_size); |
| 633 |
|
****/ |
| 634 |
|
count_ip_hash(&number_ips_stored,&mem_ips_stored); |
| 635 |
< |
sendto_one(source_p, ":%s %d %s z :iphash %u(%d)", |
| 635 |
> |
sendto_one(source_p, ":%s %d %s z :iphash %u(%llu)", |
| 636 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 637 |
< |
number_ips_stored, (int)mem_ips_stored); |
| 637 |
> |
number_ips_stored, mem_ips_stored); |
| 638 |
|
|
| 639 |
|
total_memory = totww + total_channel_memory + conf_memory + class_count * |
| 640 |
|
sizeof(struct ClassItem); |
| 643 |
|
total_memory += resv_hash_table_size; |
| 644 |
|
total_memory += id_hash_table_size; |
| 645 |
|
|
| 646 |
< |
sendto_one(source_p, ":%s %d %s z :Total: whowas %d channel %d conf %d", |
| 647 |
< |
me.name, RPL_STATSDEBUG, source_p->name, (int)totww, |
| 648 |
< |
(int)total_channel_memory, (int)conf_memory); |
| 646 |
> |
sendto_one(source_p, ":%s %d %s z :Total: whowas %llu channel %llu conf %llu", |
| 647 |
> |
me.name, RPL_STATSDEBUG, source_p->name, totww, |
| 648 |
> |
total_channel_memory, conf_memory); |
| 649 |
|
|
| 650 |
|
local_client_memory_used = local_client_count*(sizeof(struct Client) + sizeof(struct LocalUser)); |
| 651 |
|
total_memory += local_client_memory_used; |
| 652 |
< |
sendto_one(source_p, ":%s %d %s z :Local client Memory in use: %d(%d)", |
| 652 |
> |
sendto_one(source_p, ":%s %d %s z :Local client Memory in use: %d(%llu)", |
| 653 |
|
me.name, RPL_STATSDEBUG, source_p->name, local_client_count, |
| 654 |
|
local_client_memory_used); |
| 655 |
|
|
| 656 |
|
remote_client_memory_used = remote_client_count * sizeof(struct Client); |
| 657 |
|
total_memory += remote_client_memory_used; |
| 658 |
< |
sendto_one(source_p, ":%s %d %s z :Remote client Memory in use: %d(%d)", |
| 658 |
> |
sendto_one(source_p, ":%s %d %s z :Remote client Memory in use: %d(%llu)", |
| 659 |
|
me.name, RPL_STATSDEBUG, source_p->name, remote_client_count, |
| 660 |
|
remote_client_memory_used); |
| 661 |
|
|
| 662 |
|
block_heap_report_stats(source_p); |
| 663 |
|
|
| 664 |
|
sendto_one(source_p, |
| 665 |
< |
":%s %d %s z :TOTAL: %d Available: Current max RSS: %lu", |
| 665 |
> |
":%s %d %s z :TOTAL: %llu", |
| 666 |
|
me.name, RPL_STATSDEBUG, source_p->name, |
| 667 |
< |
(int)total_memory, get_maxrss()); |
| 667 |
> |
total_memory); |
| 668 |
|
} |
| 669 |
|
|
| 670 |
|
static void |
| 765 |
|
struct AccessItem *aconf; |
| 766 |
|
int i; |
| 767 |
|
|
| 768 |
+ |
if (ConfigFileEntry.stats_e_disabled) |
| 769 |
+ |
{ |
| 770 |
+ |
sendto_one(source_p, form_str(ERR_NOPRIVILEGES), |
| 771 |
+ |
from, to); |
| 772 |
+ |
return; |
| 773 |
+ |
} |
| 774 |
+ |
|
| 775 |
|
for (i = 0; i < ATABLE_SIZE; i++) |
| 776 |
|
{ |
| 777 |
|
for (arec = atable[i]; arec; arec=arec->next) |
| 806 |
|
stats_pending_glines(struct Client *source_p) |
| 807 |
|
{ |
| 808 |
|
#ifdef GLINE_VOTING |
| 809 |
< |
dlink_node *pending_node; |
| 810 |
< |
struct gline_pending *glp_ptr; |
| 811 |
< |
char timebuffer[MAX_DATE_STRING]; |
| 812 |
< |
struct tm *tmptr; |
| 809 |
> |
const dlink_node *dn_ptr = NULL; |
| 810 |
> |
const struct gp_ptr *glp_ptr = NULL; |
| 811 |
> |
char timebuffer[MAX_DATE_STRING] = { '\0' }; |
| 812 |
> |
struct tm *tmptr = NULL; |
| 813 |
|
|
| 814 |
|
if (!ConfigFileEntry.glines) |
| 815 |
|
{ |
| 818 |
|
return; |
| 819 |
|
} |
| 820 |
|
|
| 821 |
< |
if (dlink_list_length(&pending_glines) > 0) |
| 821 |
> |
if (dlink_list_length(&pending_glines[GLINE_PENDING_ADD_TYPE]) > 0) |
| 822 |
|
sendto_one(source_p, ":%s NOTICE %s :Pending G-lines", |
| 823 |
|
from, to); |
| 824 |
|
|
| 825 |
< |
DLINK_FOREACH(pending_node, pending_glines.head) |
| 825 |
> |
DLINK_FOREACH(dn_ptr, pending_glines[GLINE_PENDING_ADD_TYPE].head) |
| 826 |
|
{ |
| 827 |
< |
glp_ptr = pending_node->data; |
| 828 |
< |
tmptr = localtime(&glp_ptr->time_request1); |
| 827 |
> |
glp_ptr = dn_ptr->data; |
| 828 |
> |
tmptr = localtime(&glp_ptr->vote_1.time_request); |
| 829 |
|
strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr); |
| 830 |
|
|
| 831 |
|
sendto_one(source_p, |
| 832 |
|
":%s NOTICE %s :1) %s!%s@%s on %s requested gline at %s for %s@%s [%s]", |
| 833 |
< |
from, to, glp_ptr->oper_nick1, |
| 834 |
< |
glp_ptr->oper_user1, glp_ptr->oper_host1, |
| 835 |
< |
glp_ptr->oper_server1, timebuffer, |
| 836 |
< |
glp_ptr->user, glp_ptr->host, glp_ptr->reason1); |
| 833 |
> |
from, to, glp_ptr->vote_1.oper_nick, |
| 834 |
> |
glp_ptr->vote_1.oper_user, glp_ptr->vote_1.oper_host, |
| 835 |
> |
glp_ptr->vote_1.oper_server, timebuffer, |
| 836 |
> |
glp_ptr->user, glp_ptr->host, glp_ptr->vote_1.reason); |
| 837 |
|
|
| 838 |
|
if (glp_ptr->oper_nick2[0] != '\0') |
| 839 |
|
{ |
| 840 |
< |
tmptr = localtime(&glp_ptr->time_request2); |
| 840 |
> |
tmptr = localtime(&glp_ptr->vote_2.time_request); |
| 841 |
|
strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr); |
| 842 |
|
sendto_one(source_p, |
| 843 |
|
":%s NOTICE %s :2) %s!%s@%s on %s requested gline at %s for %s@%s [%s]", |
| 844 |
< |
from, to, glp_ptr->oper_nick2, |
| 845 |
< |
glp_ptr->oper_user2, glp_ptr->oper_host2, |
| 846 |
< |
glp_ptr->oper_server2, timebuffer, |
| 847 |
< |
glp_ptr->user, glp_ptr->host, glp_ptr->reason2); |
| 844 |
> |
from, to, glp_ptr->vote_2.oper_nick, |
| 845 |
> |
glp_ptr->vote_2.oper_user, glp_ptr->vote_2.oper_host, |
| 846 |
> |
glp_ptr->vote_2.oper_server, timebuffer, |
| 847 |
> |
glp_ptr->user, glp_ptr->host, glp_ptr->vote_2.reason); |
| 848 |
|
} |
| 849 |
|
} |
| 850 |
|
|
| 851 |
|
sendto_one(source_p, ":%s NOTICE %s :End of Pending G-lines", |
| 852 |
|
from, to); |
| 853 |
+ |
|
| 854 |
+ |
if (dlink_list_length(&pending_glines[GLINE_PENDING_DEL_TYPE]) > 0) |
| 855 |
+ |
sendto_one(source_p, ":%s NOTICE %s :Pending UNG-lines", |
| 856 |
+ |
from, to); |
| 857 |
+ |
|
| 858 |
+ |
DLINK_FOREACH(dn_ptr, pending_glines[GLINE_PENDING_DEL_TYPE].head) |
| 859 |
+ |
{ |
| 860 |
+ |
glp_ptr = dn_ptr->data; |
| 861 |
+ |
tmptr = localtime(&glp_ptr->vote_1.time_request); |
| 862 |
+ |
strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr); |
| 863 |
+ |
|
| 864 |
+ |
sendto_one(source_p, |
| 865 |
+ |
":%s NOTICE %s :1) %s!%s@%s on %s requested ungline at %s for %s@%s [%s]", |
| 866 |
+ |
from, to, glp_ptr->vote_1.oper_nick, |
| 867 |
+ |
glp_ptr->vote_1.oper_user, glp_ptr->vote_1.oper_host, |
| 868 |
+ |
glp_ptr->vote_1.oper_server, timebuffer, |
| 869 |
+ |
glp_ptr->user, glp_ptr->host, glp_ptr->vote_1.reason); |
| 870 |
+ |
|
| 871 |
+ |
if (glp_ptr->oper_nick2[0] != '\0') |
| 872 |
+ |
{ |
| 873 |
+ |
tmptr = localtime(&glp_ptr->vote_2.time_request); |
| 874 |
+ |
strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr); |
| 875 |
+ |
sendto_one(source_p, |
| 876 |
+ |
":%s NOTICE %s :2) %s!%s@%s on %s requested ungline at %s for %s@%s [%s]", |
| 877 |
+ |
from, to, glp_ptr->vote_2.oper_nick, |
| 878 |
+ |
glp_ptr->vote_2.oper_user, glp_ptr->vote_2.oper_host, |
| 879 |
+ |
glp_ptr->vote_2.oper_server, timebuffer, |
| 880 |
+ |
glp_ptr->user, glp_ptr->host, glp_ptr->vote_2.reason); |
| 881 |
+ |
|
| 882 |
+ |
} |
| 883 |
+ |
} |
| 884 |
+ |
|
| 885 |
+ |
sendto_one(source_p, ":%s NOTICE %s :End of Pending UNG-lines", |
| 886 |
+ |
from, to); |
| 887 |
|
#else |
| 888 |
|
sendto_one(source_p, ":%s NOTICE %s :This server does not support G-Line voting", |
| 889 |
|
from, to); |
| 911 |
|
|
| 912 |
|
for (; i < ATABLE_SIZE; ++i) |
| 913 |
|
{ |
| 914 |
< |
for (arec = atable[i]; arec; arec=arec->next) |
| 914 |
> |
for (arec = atable[i]; arec; arec = arec->next) |
| 915 |
|
{ |
| 916 |
|
if (arec->type == CONF_GLINE) |
| 917 |
|
{ |
| 1051 |
|
struct AccessItem *aconf; |
| 1052 |
|
|
| 1053 |
|
/* search for a kline */ |
| 1054 |
< |
if(MyConnect(source_p)) |
| 1054 |
> |
if (MyConnect(source_p)) |
| 1055 |
|
aconf = find_conf_by_address(source_p->host, |
| 1056 |
|
&source_p->localClient->ip, |
| 1057 |
|
CONF_KILL, |
| 1061 |
|
aconf = find_conf_by_address(source_p->host, NULL, CONF_KILL, |
| 1062 |
|
0, source_p->username, NULL); |
| 1063 |
|
|
| 1064 |
< |
if(aconf == NULL) |
| 1064 |
> |
if (aconf == NULL) |
| 1065 |
|
return; |
| 1066 |
|
|
| 1067 |
|
/* dont report a tkline as a kline */ |
| 1068 |
< |
if(aconf->flags & CONF_FLAGS_TEMPORARY) |
| 1068 |
> |
if (aconf->flags & CONF_FLAGS_TEMPORARY) |
| 1069 |
|
return; |
| 1070 |
|
|
| 1071 |
|
sendto_one(source_p, form_str(RPL_STATSKLINE), from, |
| 1159 |
|
static void |
| 1160 |
|
stats_tstats(struct Client *source_p) |
| 1161 |
|
{ |
| 1162 |
< |
tstats(source_p); |
| 1162 |
> |
const struct Client *target_p = NULL; |
| 1163 |
> |
const dlink_node *ptr = NULL; |
| 1164 |
> |
struct ServerStatistics *sp; |
| 1165 |
> |
struct ServerStatistics tmp; |
| 1166 |
> |
|
| 1167 |
> |
sp = &tmp; |
| 1168 |
> |
memcpy(sp, &ServerStats, sizeof(struct ServerStatistics)); |
| 1169 |
> |
|
| 1170 |
> |
/* |
| 1171 |
> |
* must use the += operator. is_sv is not the number of currently |
| 1172 |
> |
* active server connections. Note the incrementation in |
| 1173 |
> |
* s_bsd.c:close_connection. |
| 1174 |
> |
*/ |
| 1175 |
> |
sp->is_sv += dlink_list_length(&serv_list); |
| 1176 |
> |
|
| 1177 |
> |
DLINK_FOREACH(ptr, serv_list.head) |
| 1178 |
> |
{ |
| 1179 |
> |
target_p = ptr->data; |
| 1180 |
> |
|
| 1181 |
> |
sp->is_sbs += target_p->localClient->send.bytes; |
| 1182 |
> |
sp->is_sbr += target_p->localClient->recv.bytes; |
| 1183 |
> |
sp->is_sti += CurrentTime - target_p->firsttime; |
| 1184 |
> |
} |
| 1185 |
> |
|
| 1186 |
> |
sp->is_cl += dlink_list_length(&local_client_list); |
| 1187 |
> |
|
| 1188 |
> |
DLINK_FOREACH(ptr, local_client_list.head) |
| 1189 |
> |
{ |
| 1190 |
> |
target_p = ptr->data; |
| 1191 |
> |
|
| 1192 |
> |
sp->is_cbs += target_p->localClient->send.bytes; |
| 1193 |
> |
sp->is_cbr += target_p->localClient->recv.bytes; |
| 1194 |
> |
sp->is_cti += CurrentTime - target_p->firsttime; |
| 1195 |
> |
} |
| 1196 |
> |
|
| 1197 |
> |
sp->is_ni += dlink_list_length(&unknown_list); |
| 1198 |
> |
|
| 1199 |
> |
sendto_one(source_p, ":%s %d %s T :accepts %u refused %u", |
| 1200 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_ac, sp->is_ref); |
| 1201 |
> |
sendto_one(source_p, ":%s %d %s T :unknown commands %u prefixes %u", |
| 1202 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_unco, sp->is_unpf); |
| 1203 |
> |
sendto_one(source_p, ":%s %d %s T :nick collisions %u unknown closes %u", |
| 1204 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_kill, sp->is_ni); |
| 1205 |
> |
sendto_one(source_p, ":%s %d %s T :wrong direction %u empty %u", |
| 1206 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_wrdi, sp->is_empt); |
| 1207 |
> |
sendto_one(source_p, ":%s %d %s T :numerics seen %u", |
| 1208 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_num); |
| 1209 |
> |
sendto_one(source_p, ":%s %d %s T :auth successes %u fails %u", |
| 1210 |
> |
me.name, RPL_STATSDEBUG, source_p->name, sp->is_asuc, sp->is_abad); |
| 1211 |
> |
sendto_one(source_p, ":%s %d %s T :Client Server", |
| 1212 |
> |
me.name, RPL_STATSDEBUG, source_p->name); |
| 1213 |
> |
|
| 1214 |
> |
sendto_one(source_p, ":%s %d %s T :connected %u %u", |
| 1215 |
> |
me.name, RPL_STATSDEBUG, source_p->name, |
| 1216 |
> |
(unsigned int)sp->is_cl, |
| 1217 |
> |
(unsigned int)sp->is_sv); |
| 1218 |
> |
sendto_one(source_p, ":%s %d %s T :bytes sent %llu %llu", |
| 1219 |
> |
me.name, RPL_STATSDEBUG, source_p->name, |
| 1220 |
> |
sp->is_cbs, sp->is_sbs); |
| 1221 |
> |
sendto_one(source_p, ":%s %d %s T :bytes recv %llu %llu", |
| 1222 |
> |
me.name, RPL_STATSDEBUG, source_p->name, |
| 1223 |
> |
sp->is_cbr, sp->is_sbr); |
| 1224 |
> |
sendto_one(source_p, ":%s %d %s T :time connected %u %u", |
| 1225 |
> |
me.name, RPL_STATSDEBUG, source_p->name, |
| 1226 |
> |
(unsigned int)sp->is_cti, |
| 1227 |
> |
(unsigned int)sp->is_sti); |
| 1228 |
|
} |
| 1229 |
|
|
| 1230 |
|
static void |
| 1296 |
|
static void |
| 1297 |
|
stats_ziplinks(struct Client *source_p) |
| 1298 |
|
{ |
| 1299 |
< |
dlink_node *ptr; |
| 1186 |
< |
struct Client *target_p; |
| 1299 |
> |
dlink_node *ptr = NULL; |
| 1300 |
|
unsigned int sent_data = 0; |
| 1301 |
|
|
| 1302 |
|
DLINK_FOREACH(ptr, serv_list.head) |
| 1303 |
|
{ |
| 1304 |
< |
target_p = ptr->data; |
| 1304 |
> |
const struct Client *target_p = ptr->data; |
| 1305 |
|
|
| 1306 |
|
if (IsCapable(target_p, CAP_ZIP)) |
| 1307 |
|
{ |
| 1310 |
|
* -jmallett, 04/27/2002 |
| 1311 |
|
*/ |
| 1312 |
|
struct ZipStats zipstats; |
| 1313 |
< |
memcpy(&zipstats, &target_p->localClient->zipstats, sizeof (struct ZipStats)); |
| 1313 |
> |
|
| 1314 |
> |
memcpy(&zipstats, &target_p->localClient->zipstats, sizeof(zipstats)); |
| 1315 |
|
|
| 1316 |
|
sendto_one(source_p, ":%s %d %s Z :ZipLinks stats for %s send[%.2f%% " |
| 1317 |
< |
"compression (%lu bytes data/%lu bytes wire)] recv[%.2f%% " |
| 1318 |
< |
"compression (%lu bytes data/%lu bytes wire)]", |
| 1317 |
> |
"compression (%llu bytes data/%llu bytes wire)] recv[%.2f%% " |
| 1318 |
> |
"compression (%llu bytes data/%llu bytes wire)]", |
| 1319 |
|
from, RPL_STATSDEBUG, to, target_p->name, |
| 1320 |
< |
zipstats.out_ratio, zipstats.out, zipstats.out_wire, |
| 1321 |
< |
zipstats.in_ratio, zipstats.in, zipstats.in_wire); |
| 1320 |
> |
zipstats.out_ratio, zipstats.out, zipstats.out_wire, |
| 1321 |
> |
zipstats.in_ratio, zipstats.in, zipstats.in_wire); |
| 1322 |
|
++sent_data; |
| 1323 |
|
} |
| 1324 |
|
} |
| 1332 |
|
{ |
| 1333 |
|
uint64_t sendB = 0, recvB = 0; |
| 1334 |
|
time_t uptime = 0; |
| 1335 |
< |
int j = 0; |
| 1222 |
< |
struct Client *target_p = NULL; |
| 1223 |
< |
dlink_node *ptr; |
| 1335 |
> |
dlink_node *ptr = NULL; |
| 1336 |
|
|
| 1337 |
|
if (ConfigServerHide.flatten_links && !IsOper(source_p)) |
| 1338 |
|
{ |
| 1343 |
|
|
| 1344 |
|
DLINK_FOREACH(ptr, serv_list.head) |
| 1345 |
|
{ |
| 1346 |
< |
target_p = ptr->data; |
| 1346 |
> |
struct Client *target_p = ptr->data; |
| 1347 |
|
|
| 1236 |
– |
++j; |
| 1348 |
|
sendB += target_p->localClient->send.bytes; |
| 1349 |
|
recvB += target_p->localClient->recv.bytes; |
| 1350 |
|
|
| 1366 |
|
recvB >>= 10; |
| 1367 |
|
|
| 1368 |
|
sendto_one(source_p, ":%s %d %s ? :%u total server(s)", |
| 1369 |
< |
from, RPL_STATSDEBUG, to, j); |
| 1369 |
> |
from, RPL_STATSDEBUG, to, dlink_list_length(&serv_list)); |
| 1370 |
|
sendto_one(source_p, ":%s %d %s ? :Sent total : %7.2f %s", |
| 1371 |
|
from, RPL_STATSDEBUG, to, |
| 1372 |
< |
_GMKv((signed)sendB), _GMKs((signed)sendB)); |
| 1372 |
> |
_GMKv(sendB), _GMKs(sendB)); |
| 1373 |
|
sendto_one(source_p, ":%s %d %s ? :Recv total : %7.2f %s", |
| 1374 |
|
from, RPL_STATSDEBUG, to, |
| 1375 |
< |
_GMKv((signed)recvB), _GMKs((signed)recvB)); |
| 1375 |
> |
_GMKv(recvB), _GMKs(recvB)); |
| 1376 |
|
|
| 1377 |
|
uptime = (CurrentTime - me.since); |
| 1378 |
|
|
| 1379 |
|
sendto_one(source_p, ":%s %d %s ? :Server send: %7.2f %s (%4.1f K/s)", |
| 1380 |
|
from, RPL_STATSDEBUG, to, |
| 1381 |
< |
_GMKv((signed)(me.localClient->send.bytes>>10)), |
| 1382 |
< |
_GMKs((signed)(me.localClient->send.bytes>>10)), |
| 1383 |
< |
(float)((float)(((signed)me.localClient->send.bytes) >> 10) / |
| 1384 |
< |
(float)uptime)); |
| 1381 |
> |
_GMKv((me.localClient->send.bytes>>10)), |
| 1382 |
> |
_GMKs((me.localClient->send.bytes>>10)), |
| 1383 |
> |
(float)((float)((me.localClient->send.bytes) >> 10) / |
| 1384 |
> |
(float)uptime)); |
| 1385 |
|
sendto_one(source_p, ":%s %d %s ? :Server recv: %7.2f %s (%4.1f K/s)", |
| 1386 |
|
from, RPL_STATSDEBUG, to, |
| 1387 |
< |
_GMKv((signed)(me.localClient->recv.bytes>>10)), |
| 1388 |
< |
_GMKs((signed)(me.localClient->recv.bytes>>10)), |
| 1389 |
< |
(float)((float)(((signed)me.localClient->recv.bytes) >> 10) / |
| 1390 |
< |
(float)uptime)); |
| 1387 |
> |
_GMKv((me.localClient->recv.bytes>>10)), |
| 1388 |
> |
_GMKs((me.localClient->recv.bytes>>10)), |
| 1389 |
> |
(float)((float)((me.localClient->recv.bytes) >> 10) / |
| 1390 |
> |
(float)uptime)); |
| 1391 |
|
} |
| 1392 |
|
|
| 1393 |
|
static void |