ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_stats.c
Revision: 4143
Committed: Wed Jul 2 17:15:01 2014 UTC (12 years ago) by michael
Content type: text/x-csrc
File size: 52936 byte(s)
Log Message:
- Removed hooking system

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2820 * Copyright (c) 1997-2014 ircd-hybrid development team
5 adx 30 *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19     * USA
20     */
21    
22 michael 2820 /*! \file m_stats.c
23     * \brief Includes required functions for processing the STATS command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28 michael 2820 #include "list.h"
29     #include "client.h"
30     #include "irc_string.h"
31     #include "ircd.h"
32     #include "listener.h"
33 michael 3321 #include "gline.h"
34 michael 1632 #include "conf.h"
35 michael 1644 #include "conf_class.h"
36 adx 30 #include "hostmask.h"
37 michael 2820 #include "numeric.h"
38     #include "send.h"
39     #include "fdlist.h"
40     #include "s_bsd.h"
41 michael 3347 #include "misc.h"
42     #include "server.h"
43     #include "user.h"
44 michael 2820 #include "event.h"
45 adx 30 #include "dbuf.h"
46     #include "parse.h"
47     #include "modules.h"
48 michael 2820 #include "resv.h"
49 adx 30 #include "whowas.h"
50 michael 884 #include "watch.h"
51 michael 3322 #include "res.h"
52 michael 2150 #include "motd.h"
53 adx 30
54    
55 michael 1922 static const struct shared_flags
56     {
57     const unsigned int type;
58     const unsigned char letter;
59     } flag_table[] = {
60     { SHARED_KLINE, 'K' },
61     { SHARED_UNKLINE, 'U' },
62     { SHARED_XLINE, 'X' },
63     { SHARED_UNXLINE, 'Y' },
64     { SHARED_RESV, 'Q' },
65     { SHARED_UNRESV, 'R' },
66     { SHARED_LOCOPS, 'L' },
67     { SHARED_DLINE, 'D' },
68     { SHARED_UNDLINE, 'E' },
69     { 0, '\0' }
70     };
71    
72 adx 30 /*
73 michael 1922 * inputs - pointer to client requesting confitem report
74     * - ConfType to report
75     * output - none
76     * side effects -
77     */
78     static void
79     report_confitem_types(struct Client *source_p, enum maskitem_type type)
80     {
81 michael 4033 const dlink_node *ptr = NULL;
82     const struct MaskItem *conf = NULL;
83 michael 2691 char buf[IRCD_BUFSIZE];
84 michael 1922 char *p = NULL;
85    
86     switch (type)
87     {
88 michael 4035 case CONF_XLINE:
89     DLINK_FOREACH(ptr, xconf_items.head)
90     {
91     conf = ptr->data;
92     sendto_one_numeric(source_p, &me, RPL_STATSXLINE,
93     conf->until ? 'x': 'X', conf->count,
94     conf->name, conf->reason);
95     }
96 michael 1922
97 michael 4035 break;
98 michael 1922
99 michael 4035 case CONF_ULINE:
100     DLINK_FOREACH(ptr, uconf_items.head)
101     {
102     conf = ptr->data;
103     p = buf;
104 michael 1922
105 michael 4035 *p++ = 'c';
106 michael 1922
107 michael 4035 for (const struct shared_flags *shared = flag_table; shared->type; ++shared)
108     if (shared->type & conf->flags)
109     *p++ = shared->letter;
110     else
111     *p++ = ToLower(shared->letter);
112 michael 1922
113 michael 4035 *p = '\0';
114 michael 3285
115 michael 4035 sendto_one_numeric(source_p, &me, RPL_STATSULINE, conf->name,
116     conf->user ? conf->user: "*",
117     conf->host ? conf->host: "*", buf);
118     }
119 michael 1922
120 michael 4035 DLINK_FOREACH(ptr, cluster_items.head)
121     {
122     conf = ptr->data;
123     p = buf;
124 michael 1922
125 michael 4035 *p++ = 'C';
126 michael 1922
127 michael 4035 for (const struct shared_flags *shared = flag_table; shared->type; ++shared)
128     if (shared->type & conf->flags)
129     *p++ = shared->letter;
130     else
131     *p++ = ToLower(shared->letter);
132 michael 1922
133 michael 4035 *p = '\0';
134 michael 3285
135 michael 4035 sendto_one_numeric(source_p, &me, RPL_STATSULINE, conf->name, "*", "*", buf);
136     }
137 michael 1922
138 michael 4035 break;
139 michael 1922
140 michael 4035 case CONF_OPER:
141     DLINK_FOREACH(ptr, oconf_items.head)
142     {
143     conf = ptr->data;
144 michael 1922
145 michael 4035 /* Don't allow non opers to see oper privs */
146     if (HasUMode(source_p, UMODE_OPER))
147     sendto_one_numeric(source_p, &me, RPL_STATSOLINE, 'O', conf->user, conf->host,
148     conf->name, oper_privs_as_string(conf->port),
149     conf->class->name);
150     else
151     sendto_one_numeric(source_p, &me, RPL_STATSOLINE, 'O', conf->user, conf->host,
152     conf->name, "0", conf->class->name);
153     }
154 michael 1922
155 michael 4035 break;
156 michael 1922
157 michael 4035 case CONF_SERVICE:
158     DLINK_FOREACH(ptr, service_items.head)
159     {
160     conf = ptr->data;
161     sendto_one_numeric(source_p, &me, RPL_STATSSERVICE, 'S', "*", conf->name, 0, 0);
162     }
163 michael 1922
164 michael 4035 break;
165 michael 1922
166 michael 4035 case CONF_SERVER:
167     DLINK_FOREACH(ptr, server_items.head)
168     {
169     p = buf;
170     conf = ptr->data;
171 michael 1922
172 michael 4035 buf[0] = '\0';
173 michael 1922
174 michael 4035 if (IsConfAllowAutoConn(conf))
175     *p++ = 'A';
176     if (IsConfSSL(conf))
177     *p++ = 'S';
178     if (buf[0] == '\0')
179     *p++ = '*';
180    
181     *p = '\0';
182    
183     /*
184     * Allow admins to see actual ips unless hide_server_ips is enabled
185     */
186     if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN))
187     sendto_one_numeric(source_p, &me, RPL_STATSCLINE, 'C', conf->host,
188     buf, conf->name, conf->port,
189     conf->class->name);
190 michael 1922 else
191 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSCLINE, 'C',
192 michael 4035 "*@127.0.0.1", buf, conf->name, conf->port,
193     conf->class->name);
194     }
195 michael 1922
196 michael 4035 break;
197    
198     default:
199     break;
200 michael 1922 }
201     }
202    
203 michael 1927 /* report_resv()
204     *
205     * inputs - pointer to client pointer to report to.
206     * output - NONE
207     * side effects - report all resvs to client.
208     */
209     static void
210     report_resv(struct Client *source_p)
211     {
212 michael 4033 const dlink_node *ptr = NULL;
213 michael 1927
214 michael 2174 DLINK_FOREACH(ptr, cresv_items.head)
215 michael 1927 {
216 michael 4033 const struct MaskItem *conf = ptr->data;
217 michael 3109
218     sendto_one_numeric(source_p, &me, RPL_STATSQLINE,
219     conf->until ? 'q' : 'Q', conf->count,
220     conf->name, conf->reason);
221 michael 1927 }
222    
223     DLINK_FOREACH(ptr, nresv_items.head)
224     {
225 michael 4033 const struct MaskItem *conf = ptr->data;
226 michael 3109
227     sendto_one_numeric(source_p, &me, RPL_STATSQLINE,
228     conf->until ? 'q' : 'Q', conf->count,
229     conf->name, conf->reason);
230 michael 1927 }
231     }
232    
233 michael 1922 /*
234 adx 30 * This is part of the STATS replies. There is no offical numeric for this
235     * since this isnt an official command, in much the same way as HASH isnt.
236     * It is also possible that some systems wont support this call or have
237     * different field names for "struct rusage".
238     * -avalon
239     */
240     static void
241 michael 1457 stats_usage(struct Client *source_p, int parc, char *parv[])
242 adx 30 {
243     struct rusage rus;
244     time_t secs;
245     time_t rup;
246     #ifdef hz
247     # define hzz hz
248     #else
249     # ifdef HZ
250     # define hzz HZ
251     # else
252     int hzz = 1;
253     # endif
254     #endif
255    
256     if (getrusage(RUSAGE_SELF, &rus) == -1)
257     {
258 michael 3110 sendto_one_notice(source_p, &me, ":Getruseage error: %s",
259     strerror(errno));
260 adx 30 return;
261     }
262    
263     secs = rus.ru_utime.tv_sec + rus.ru_stime.tv_sec;
264    
265     if (secs == 0)
266     secs = 1;
267    
268 michael 1241 rup = (CurrentTime - me.localClient->since) * hzz;
269 adx 30
270     if (rup == 0)
271     rup = 1;
272    
273 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
274     "R :CPU Secs %d:%02d User %d:%02d System %d:%02d",
275     (int)(secs/60), (int)(secs%60),
276     (int)(rus.ru_utime.tv_sec/60), (int)(rus.ru_utime.tv_sec%60),
277     (int)(rus.ru_stime.tv_sec/60), (int)(rus.ru_stime.tv_sec%60));
278     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
279     "R :RSS %ld ShMem %ld Data %ld Stack %ld",
280     rus.ru_maxrss,
281     (rus.ru_ixrss / rup), (rus.ru_idrss / rup),
282     (rus.ru_isrss / rup));
283     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
284     "R :Swaps %d Reclaims %d Faults %d",
285     (int)rus.ru_nswap,
286     (int)rus.ru_minflt, (int)rus.ru_majflt);
287     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
288     "R :Block in %d out %d",
289     (int)rus.ru_inblock,
290     (int)rus.ru_oublock);
291     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
292     "R :Msg Rcv %d Send %d",
293     (int)rus.ru_msgrcv,
294     (int)rus.ru_msgsnd);
295     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
296     "R :Signals %d Context Vol. %d Invol %d",
297     (int)rus.ru_nsignals,
298     (int)rus.ru_nvcsw, (int)rus.ru_nivcsw);
299 adx 30 }
300    
301     static void
302 michael 1457 stats_memory(struct Client *source_p, int parc, char *parv[])
303 adx 30 {
304     const dlink_node *gptr = NULL;
305     const dlink_node *dlink = NULL;
306    
307 michael 948 unsigned int local_client_conf_count = 0; /* local client conf links */
308     unsigned int users_counted = 0; /* user structs */
309 adx 30
310 michael 1017 unsigned int channel_members = 0;
311 michael 948 unsigned int channel_invites = 0;
312     unsigned int channel_bans = 0;
313     unsigned int channel_except = 0;
314     unsigned int channel_invex = 0;
315 adx 30
316 michael 948 unsigned int wwu = 0; /* whowas users */
317     unsigned int class_count = 0; /* classes */
318     unsigned int aways_counted = 0;
319     unsigned int number_ips_stored; /* number of ip addresses hashed */
320 adx 30
321 michael 948 uint64_t channel_memory = 0;
322     uint64_t channel_ban_memory = 0;
323     uint64_t channel_except_memory = 0;
324     uint64_t channel_invex_memory = 0;
325 adx 30
326     unsigned int safelist_count = 0;
327 michael 948 uint64_t safelist_memory = 0;
328 adx 30
329 michael 948 uint64_t wwm = 0; /* whowas array memory used */
330     uint64_t conf_memory = 0; /* memory used by conf lines */
331     uint64_t mem_ips_stored; /* memory used by ip address hash */
332 adx 30
333 michael 948 uint64_t total_channel_memory = 0;
334     uint64_t totww = 0;
335 adx 30
336     unsigned int local_client_count = 0;
337     unsigned int remote_client_count = 0;
338    
339 michael 948 uint64_t local_client_memory_used = 0;
340     uint64_t remote_client_memory_used = 0;
341 adx 30
342 michael 948 uint64_t total_memory = 0;
343 adx 30 unsigned int topic_count = 0;
344    
345 michael 1017 unsigned int watch_list_headers = 0; /* watchlist headers */
346     unsigned int watch_list_entries = 0; /* watchlist entries */
347     uint64_t watch_list_memory = 0; /* watchlist memory used */
348 michael 884
349 adx 30
350     DLINK_FOREACH(gptr, global_client_list.head)
351     {
352 michael 4033 const struct Client *target_p = gptr->data;
353 adx 30
354     if (MyConnect(target_p))
355     {
356     ++local_client_count;
357     local_client_conf_count += dlink_list_length(&target_p->localClient->confs);
358 michael 1017 watch_list_entries += dlink_list_length(&target_p->localClient->watches);
359 adx 30 }
360     else
361     ++remote_client_count;
362    
363     if (IsClient(target_p))
364     {
365     ++users_counted;
366    
367 michael 1483 if (target_p->away[0])
368 adx 30 ++aways_counted;
369     }
370     }
371    
372     /* Count up all channels, ban lists, except lists, Invex lists */
373 michael 3945 channel_memory = dlink_list_length(&channel_list) *
374 adx 30 sizeof(struct Channel);
375 michael 3945 DLINK_FOREACH(gptr, channel_list.head)
376 adx 30 {
377 michael 948 const struct Ban *actualBan;
378     const struct Channel *chptr = gptr->data;
379 adx 30
380 michael 1017 channel_members += dlink_list_length(&chptr->members);
381 adx 30 channel_invites += dlink_list_length(&chptr->invites);
382    
383 michael 1203 if (chptr->topic[0])
384 adx 30 ++topic_count;
385    
386 michael 1017 channel_bans += dlink_list_length(&chptr->banlist);
387     channel_ban_memory += dlink_list_length(&chptr->banlist) * sizeof(struct Ban);
388    
389     DLINK_FOREACH(dlink, chptr->banlist.head)
390 adx 30 {
391 michael 1017 actualBan = dlink->data;
392     assert(actualBan->who);
393 adx 30
394 michael 1017 channel_ban_memory += actualBan->len + 1;
395     channel_ban_memory += strlen(actualBan->who) + 1;
396 adx 30 }
397    
398 michael 1017 channel_except += dlink_list_length(&chptr->exceptlist);
399     channel_except_memory += dlink_list_length(&chptr->exceptlist) * sizeof(struct Ban);
400    
401     DLINK_FOREACH(dlink, chptr->exceptlist.head)
402 adx 30 {
403 michael 1017 actualBan = dlink->data;
404     assert(actualBan->who);
405 adx 30
406 michael 1017 channel_except_memory += actualBan->len + 1;
407     channel_except_memory += strlen(actualBan->who) + 1;
408 adx 30 }
409    
410 michael 1017 channel_invex += dlink_list_length(&chptr->invexlist);
411     channel_invex_memory += dlink_list_length(&chptr->invexlist) * sizeof(struct Ban);
412    
413     DLINK_FOREACH(dlink, chptr->invexlist.head)
414 adx 30 {
415 michael 1017 actualBan = dlink->data;
416     assert(actualBan->who);
417 adx 30
418 michael 1017 channel_invex_memory += actualBan->len + 1;
419     channel_invex_memory += strlen(actualBan->who) + 1;
420 adx 30 }
421     }
422    
423     if ((safelist_count = dlink_list_length(&listing_client_list)))
424     {
425     safelist_memory = safelist_count * sizeof(struct ListTask);
426     DLINK_FOREACH(gptr, listing_client_list.head)
427     {
428 michael 948 const struct Client *acptr = gptr->data;
429 adx 30
430     DLINK_FOREACH(dlink, acptr->localClient->list_task->show_mask.head)
431     safelist_memory += strlen(dlink->data);
432    
433     DLINK_FOREACH(dlink, acptr->localClient->list_task->hide_mask.head)
434     safelist_memory += strlen(dlink->data);
435     }
436     }
437    
438     #if 0
439     /* XXX THIS has to be fixed !!!! -db */
440     /* count up all config items */
441     DLINK_FOREACH(dlink, ConfigItemList.head)
442     {
443     aconf = dlink->data;
444     conf_memory += aconf->host ? strlen(aconf->host)+1 : 0;
445     conf_memory += aconf->passwd ? strlen(aconf->passwd)+1 : 0;
446     conf_memory += aconf->name ? strlen(aconf->name)+1 : 0;
447     conf_memory += sizeof(struct AccessItem);
448     }
449     #endif
450     /* count up all classes */
451 michael 1644 class_count = dlink_list_length(class_get_list());
452 adx 30
453 michael 2297 whowas_count_memory(&wwu, &wwm);
454 michael 1017 watch_count_memory(&watch_list_headers, &watch_list_memory);
455 michael 884
456 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
457     "z :WATCH headers %u(%llu) entries %d(%u)",
458     watch_list_headers,
459     watch_list_memory, watch_list_entries,
460     watch_list_entries * sizeof(dlink_node) * 2);
461 michael 884
462 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
463     "z :Clients %u(%u)",
464     users_counted,
465     (users_counted * sizeof(struct Client)));
466 adx 30
467 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
468     "z :User aways %u", aways_counted);
469 adx 30
470 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
471     "z :Attached confs %u(%llu)",
472     local_client_conf_count,
473     (unsigned long long)(local_client_conf_count * sizeof(dlink_node)));
474 adx 30
475 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
476     "z :Resv channels %u(%lu) nicks %u(%lu)",
477     dlink_list_length(&cresv_items),
478     dlink_list_length(&cresv_items) * sizeof(struct MaskItem),
479     dlink_list_length(&nresv_items),
480     dlink_list_length(&nresv_items) * sizeof(struct MaskItem));
481 adx 30
482 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
483     "z :Classes %u(%llu)",
484     class_count, (unsigned long long)(class_count * sizeof(struct ClassItem)));
485 adx 30
486 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
487     "z :Channels %u(%llu) Topics %u(%u)",
488 michael 3945 dlink_list_length(&channel_list),
489 michael 3574 channel_memory, topic_count, topic_count *
490     (TOPICLEN + 1 + USERHOST_REPLYLEN));
491 adx 30
492 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
493     "z :Bans %u(%llu)",
494     channel_bans, channel_ban_memory);
495 adx 30
496 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
497     "z :Exceptions %u(%llu)",
498     channel_except, channel_except_memory);
499 adx 30
500 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
501     "z :Invex %u(%llu)",
502     channel_invex, channel_invex_memory);
503 adx 30
504 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
505     "z :Channel members %u(%llu) invites %u(%llu)",
506     channel_members,
507     (unsigned long long)(channel_members * sizeof(struct Membership)),
508     channel_invites, (unsigned long long)channel_invites * sizeof(dlink_node) * 2);
509 adx 30
510     total_channel_memory = channel_memory + channel_ban_memory +
511 michael 1017 channel_members * sizeof(struct Membership) +
512 michael 884 (channel_invites * sizeof(dlink_node)*2);
513 adx 30
514 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
515     "z :Safelist %u(%llu)",
516     safelist_count, safelist_memory);
517 adx 30
518 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
519     "z :Whowas users %u(%llu)",
520     wwu, (unsigned long long)(wwu * sizeof(struct Client)));
521 adx 30
522 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
523     "z :Whowas array %u(%llu)",
524     NICKNAMEHISTORYLENGTH, wwm);
525 adx 30
526     totww = wwu * sizeof(struct Client) + wwm;
527    
528 michael 2150 motd_memory_count(source_p);
529 adx 30 count_ip_hash(&number_ips_stored,&mem_ips_stored);
530 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
531     "z :iphash %u(%llu)",
532     number_ips_stored, mem_ips_stored);
533 adx 30
534     total_memory = totww + total_channel_memory + conf_memory + class_count *
535     sizeof(struct ClassItem);
536 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
537     "z :Total: whowas %llu channel %llu conf %llu",
538     totww, total_channel_memory, conf_memory);
539 adx 30
540     local_client_memory_used = local_client_count*(sizeof(struct Client) + sizeof(struct LocalUser));
541     total_memory += local_client_memory_used;
542 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
543     "z :Local client Memory in use: %u(%llu)",
544     local_client_count, local_client_memory_used);
545 adx 30
546     remote_client_memory_used = remote_client_count * sizeof(struct Client);
547     total_memory += remote_client_memory_used;
548 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
549     "z :Remote client Memory in use: %u(%llu)",
550     remote_client_count, remote_client_memory_used);
551 adx 30
552 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
553     "z :TOTAL: %llu",
554     me.name, RPL_STATSDEBUG, source_p->name,
555     total_memory);
556 adx 30 }
557    
558     static void
559     stats_dns_servers(struct Client *source_p)
560     {
561     report_dns_servers(source_p);
562     }
563    
564     static void
565 michael 1457 stats_connect(struct Client *source_p, int parc, char *parv[])
566 adx 30 {
567 michael 1632 report_confitem_types(source_p, CONF_SERVER);
568 adx 30 }
569    
570     /* stats_deny()
571     *
572     * input - client to report to
573     * output - none
574     * side effects - client is given dline list.
575     */
576     static void
577 michael 1457 stats_deny(struct Client *source_p, int parc, char *parv[])
578 adx 30 {
579 michael 4033 const struct MaskItem *conf = NULL;
580     const dlink_node *ptr = NULL;
581 adx 30
582 michael 3246 for (unsigned int i = 0; i < ATABLE_SIZE; ++i)
583 adx 30 {
584 michael 1367 DLINK_FOREACH(ptr, atable[i].head)
585 adx 30 {
586 michael 4033 const struct AddressRec *arec = ptr->data;
587 michael 1367
588 michael 1632 if (arec->type != CONF_DLINE)
589     continue;
590 adx 30
591 michael 1632 conf = arec->conf;
592 adx 30
593 michael 4035 /* Don't report a tdline as a dline */
594 michael 1649 if (conf->until)
595 michael 1632 continue;
596 adx 30
597 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSDLINE, 'D', conf->host, conf->reason);
598 adx 30 }
599     }
600     }
601    
602     /* stats_tdeny()
603     *
604     * input - client to report to
605     * output - none
606     * side effects - client is given dline list.
607     */
608     static void
609 michael 1457 stats_tdeny(struct Client *source_p, int parc, char *parv[])
610 adx 30 {
611 michael 4033 const struct MaskItem *conf = NULL;
612     const dlink_node *ptr = NULL;
613 adx 30
614 michael 3246 for (unsigned int i = 0; i < ATABLE_SIZE; ++i)
615 adx 30 {
616 michael 1367 DLINK_FOREACH(ptr, atable[i].head)
617 adx 30 {
618 michael 4033 const struct AddressRec *arec = ptr->data;
619 michael 1367
620 michael 1632 if (arec->type != CONF_DLINE)
621     continue;
622 adx 30
623 michael 1632 conf = arec->conf;
624 adx 30
625 michael 4035 /* Don't report a permanent dline as a tdline */
626 michael 1649 if (!conf->until)
627 michael 1632 continue;
628 adx 30
629 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSDLINE, 'd', conf->host, conf->reason);
630 adx 30 }
631     }
632     }
633    
634     /* stats_exempt()
635     *
636     * input - client to report to
637     * output - none
638     * side effects - client is given list of exempt blocks
639     */
640     static void
641 michael 1457 stats_exempt(struct Client *source_p, int parc, char *parv[])
642 adx 30 {
643 michael 4035 const struct MaskItem *conf = NULL;
644 michael 4033 const dlink_node *ptr = NULL;
645 adx 30
646 michael 584 if (ConfigFileEntry.stats_e_disabled)
647     {
648 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
649 michael 584 return;
650     }
651    
652 michael 3246 for (unsigned int i = 0; i < ATABLE_SIZE; ++i)
653 adx 30 {
654 michael 1367 DLINK_FOREACH(ptr, atable[i].head)
655 adx 30 {
656 michael 4033 const struct AddressRec *arec = ptr->data;
657 michael 1367
658 michael 1632 if (arec->type != CONF_EXEMPT)
659     continue;
660 adx 30
661 michael 1632 conf = arec->conf;
662 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSDLINE, 'e', conf->host, "");
663 adx 30 }
664     }
665     }
666    
667     static void
668 michael 1457 stats_events(struct Client *source_p, int parc, char *parv[])
669 adx 30 {
670     show_events(source_p);
671     }
672    
673     /* stats_pending_glines()
674     *
675     * input - client pointer
676     * output - none
677     * side effects - client is shown list of pending glines
678     */
679     static void
680 michael 1457 stats_pending_glines(struct Client *source_p, int parc, char *parv[])
681 adx 30 {
682 michael 958 const dlink_node *dn_ptr = NULL;
683 michael 988 const struct gline_pending *glp_ptr = NULL;
684 michael 3246 char timebuffer[MAX_DATE_STRING] = "";
685 michael 958 struct tm *tmptr = NULL;
686 adx 30
687     if (!ConfigFileEntry.glines)
688     {
689 michael 3110 sendto_one_notice(source_p, &me, ":This server does not support G-Lines");
690 adx 30 return;
691     }
692    
693 michael 3246 if (dlink_list_length(&pending_glines[GLINE_PENDING_ADD_TYPE]))
694 michael 3110 sendto_one_notice(source_p, &me, ":Pending G-lines");
695 adx 30
696 michael 958 DLINK_FOREACH(dn_ptr, pending_glines[GLINE_PENDING_ADD_TYPE].head)
697 adx 30 {
698 michael 958 glp_ptr = dn_ptr->data;
699     tmptr = localtime(&glp_ptr->vote_1.time_request);
700 adx 30 strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
701    
702 michael 3110 sendto_one_notice(source_p, &me, ":1) %s!%s@%s on %s requested gline at %s for %s@%s [%s]",
703     glp_ptr->vote_1.oper_nick,
704     glp_ptr->vote_1.oper_user, glp_ptr->vote_1.oper_host,
705     glp_ptr->vote_1.oper_server, timebuffer,
706     glp_ptr->user, glp_ptr->host, glp_ptr->vote_1.reason);
707 adx 30
708 michael 3246 if (glp_ptr->vote_2.oper_nick[0])
709 adx 30 {
710 michael 958 tmptr = localtime(&glp_ptr->vote_2.time_request);
711 adx 30 strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
712 michael 3110
713     sendto_one_notice(source_p, &me, ":2) %s!%s@%s on %s requested gline at %s for %s@%s [%s]",
714     glp_ptr->vote_2.oper_nick,
715     glp_ptr->vote_2.oper_user, glp_ptr->vote_2.oper_host,
716     glp_ptr->vote_2.oper_server, timebuffer,
717     glp_ptr->user, glp_ptr->host, glp_ptr->vote_2.reason);
718 adx 30 }
719     }
720    
721 michael 3110 sendto_one_notice(source_p, &me, ":End of Pending G-lines");
722 michael 958
723 michael 3246 if (dlink_list_length(&pending_glines[GLINE_PENDING_DEL_TYPE]))
724 michael 3110 sendto_one_notice(source_p, &me, ":Pending UNG-lines");
725 michael 958
726     DLINK_FOREACH(dn_ptr, pending_glines[GLINE_PENDING_DEL_TYPE].head)
727     {
728     glp_ptr = dn_ptr->data;
729     tmptr = localtime(&glp_ptr->vote_1.time_request);
730     strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
731    
732 michael 3110 sendto_one_notice(source_p, &me, ":1) %s!%s@%s on %s requested ungline at %s for %s@%s [%s]",
733     glp_ptr->vote_1.oper_nick,
734     glp_ptr->vote_1.oper_user, glp_ptr->vote_1.oper_host,
735     glp_ptr->vote_1.oper_server, timebuffer,
736     glp_ptr->user, glp_ptr->host, glp_ptr->vote_1.reason);
737 michael 958
738 michael 3246 if (glp_ptr->vote_2.oper_nick[0])
739 michael 958 {
740     tmptr = localtime(&glp_ptr->vote_2.time_request);
741     strftime(timebuffer, MAX_DATE_STRING, "%Y/%m/%d %H:%M:%S", tmptr);
742    
743 michael 3110 sendto_one_notice(source_p, &me, ":2) %s!%s@%s on %s requested ungline at %s for %s@%s [%s]",
744     glp_ptr->vote_2.oper_nick,
745     glp_ptr->vote_2.oper_user, glp_ptr->vote_2.oper_host,
746     glp_ptr->vote_2.oper_server, timebuffer,
747     glp_ptr->user, glp_ptr->host, glp_ptr->vote_2.reason);
748    
749 michael 958 }
750     }
751    
752 michael 3110 sendto_one_notice(source_p, &me, ":End of Pending UNG-lines");
753 adx 30 }
754    
755     /* stats_glines()
756     *
757     * input - client pointer
758     * output - none
759     * side effects - client is shown list of glines
760     */
761     static void
762 michael 1457 stats_glines(struct Client *source_p, int parc, char *parv[])
763 adx 30 {
764 michael 4033 const dlink_node *ptr = NULL;
765 adx 30
766     if (!ConfigFileEntry.glines)
767     {
768 michael 3110 sendto_one_notice(source_p, &me, ":This server does not support G-Lines");
769 adx 30 return;
770     }
771    
772 michael 3246 for (unsigned int i = 0; i < ATABLE_SIZE; ++i)
773 adx 30 {
774 michael 1367 DLINK_FOREACH(ptr, atable[i].head)
775 adx 30 {
776 michael 1376 const struct AddressRec *arec = ptr->data;
777 michael 1367
778 adx 30 if (arec->type == CONF_GLINE)
779     {
780 michael 1632 const struct MaskItem *conf = arec->conf;
781 adx 30
782 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSKLINE, 'G',
783     conf->host ? conf->host : "*",
784     conf->user ? conf->user : "*",
785     conf->reason ? conf->reason : CONF_NOREASON);
786    
787 adx 30 }
788     }
789     }
790     }
791    
792     static void
793 michael 1457 stats_hubleaf(struct Client *source_p, int parc, char *parv[])
794 adx 30 {
795 michael 2118 const dlink_node *ptr = NULL, *dptr = NULL;
796    
797     DLINK_FOREACH(ptr, server_items.head)
798     {
799     const struct MaskItem *conf = ptr->data;
800    
801     DLINK_FOREACH(dptr, conf->hub_list.head)
802 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSHLINE, 'H', dptr->data, conf->name, 0, "*");
803 michael 2118 }
804    
805     DLINK_FOREACH(ptr, server_items.head)
806     {
807     const struct MaskItem *conf = ptr->data;
808    
809     DLINK_FOREACH(dptr, conf->leaf_list.head)
810 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLLINE, 'L', dptr->data, conf->name, 0, "*");
811 michael 2118 }
812 adx 30 }
813    
814 michael 1372 /*
815     * show_iline_prefix()
816     *
817     * inputs - pointer to struct Client requesting output
818 michael 2820 * - pointer to struct MaskItem
819 michael 1372 * - name to which iline prefix will be prefixed to
820     * output - pointer to static string with prefixes listed in ascii form
821     * side effects - NONE
822     */
823     static const char *
824 michael 1632 show_iline_prefix(const struct Client *sptr, const struct MaskItem *conf)
825 michael 1372 {
826 michael 1715 static char prefix_of_host[USERLEN + 15];
827 michael 1372 char *prefix_ptr = prefix_of_host;
828    
829 michael 1715 if (IsConfWebIRC(conf))
830     *prefix_ptr++ = '<';
831 michael 1632 if (IsNoTilde(conf))
832 michael 1372 *prefix_ptr++ = '-';
833 michael 1632 if (IsNeedIdentd(conf))
834 michael 1372 *prefix_ptr++ = '+';
835 michael 1632 if (!IsNeedPassword(conf))
836 michael 1372 *prefix_ptr++ = '&';
837 michael 1632 if (IsConfExemptResv(conf))
838 michael 1372 *prefix_ptr++ = '$';
839 michael 1632 if (IsConfDoSpoofIp(conf))
840 michael 1372 *prefix_ptr++ = '=';
841 michael 1632 if (MyOper(sptr) && IsConfExemptKline(conf))
842 michael 1372 *prefix_ptr++ = '^';
843 michael 1632 if (MyOper(sptr) && IsConfExemptGline(conf))
844 michael 1372 *prefix_ptr++ = '_';
845 michael 1632 if (MyOper(sptr) && IsConfExemptLimits(conf))
846 michael 1372 *prefix_ptr++ = '>';
847 michael 1632 if (IsConfCanFlood(conf))
848 michael 1372 *prefix_ptr++ = '|';
849    
850 michael 1632 strlcpy(prefix_ptr, conf->user, USERLEN+1);
851 michael 1372
852     return prefix_of_host;
853     }
854    
855 adx 30 static void
856 michael 3156 report_auth(struct Client *source_p, int parc, char *parv[])
857 michael 1372 {
858 michael 4033 const struct MaskItem *conf = NULL;
859     const dlink_node *ptr = NULL;
860 michael 1372
861 michael 3246 for (unsigned int i = 0; i < ATABLE_SIZE; ++i)
862 michael 1372 {
863     DLINK_FOREACH(ptr, atable[i].head)
864     {
865 michael 4033 const struct AddressRec *arec = ptr->data;
866 michael 1372
867 michael 1632 if (arec->type != CONF_CLIENT)
868     continue;
869 michael 1372
870 michael 1632 conf = arec->conf;
871 michael 1372
872 michael 3156 if (!MyOper(source_p) && IsConfDoSpoofIp(conf))
873 michael 1632 continue;
874 michael 1372
875 michael 1632 /* We are doing a partial list, based on what matches the u@h of the
876     * sender, so prepare the strings for comparing --fl_
877     */
878     if (ConfigFileEntry.hide_spoof_ips)
879 michael 3156 sendto_one_numeric(source_p, &me, RPL_STATSILINE, 'I',
880 michael 3109 conf->name == NULL ? "*" : conf->name,
881 michael 3156 show_iline_prefix(source_p, conf),
882 michael 3109 IsConfDoSpoofIp(conf) ? "255.255.255.255" :
883     conf->host, conf->port,
884 michael 4031 conf->class->name);
885 michael 1372
886 michael 1632 else
887 michael 3156 sendto_one_numeric(source_p, &me, RPL_STATSILINE, 'I',
888 michael 3109 conf->name == NULL ? "*" : conf->name,
889 michael 3156 show_iline_prefix(source_p, conf),
890 michael 3109 conf->host, conf->port,
891 michael 4031 conf->class->name);
892 michael 1372 }
893     }
894     }
895    
896     static void
897 michael 1457 stats_auth(struct Client *source_p, int parc, char *parv[])
898 adx 30 {
899     /* Oper only, if unopered, return ERR_NOPRIVILEGES */
900 michael 4035 if (ConfigFileEntry.stats_i_oper_only == 2 && !HasUMode(source_p, UMODE_OPER))
901 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
902 adx 30
903 michael 4035 /* If unopered, only return matching auth blocks */
904     else if (ConfigFileEntry.stats_i_oper_only == 1 && !HasUMode(source_p, UMODE_OPER))
905 adx 30 {
906 michael 4035 const struct MaskItem *conf = NULL;
907 adx 30
908     if (MyConnect(source_p))
909 michael 1632 conf = find_conf_by_address(source_p->host,
910 michael 2820 &source_p->localClient->ip, CONF_CLIENT,
911     source_p->localClient->aftype,
912     source_p->username,
913     source_p->localClient->passwd, 1);
914 adx 30 else
915 michael 4035 conf = find_conf_by_address(source_p->host, NULL, CONF_CLIENT, 0,
916     source_p->username, NULL, 1);
917 adx 30
918 michael 1632 if (conf == NULL)
919 adx 30 return;
920    
921 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSILINE,
922     'I', "*", show_iline_prefix(source_p, conf),
923     conf->host, conf->port,
924 michael 4036 conf->class->name);
925 adx 30 }
926 michael 4035 else /* They are opered, or allowed to see all auth blocks */
927 michael 1457 report_auth(source_p, 0, NULL);
928 adx 30 }
929    
930 michael 1372 /* report_Klines()
931     * Inputs: Client to report to,
932     * type(==0 for perm, !=0 for temporary)
933 michael 2820 * mask
934 michael 1372 * Output: None
935 michael 3156 * Side effects: Reports configured K(or k)-lines to source_p.
936 michael 1372 */
937 adx 30 static void
938 michael 3156 report_Klines(struct Client *source_p, int tkline)
939 michael 1372 {
940 michael 4033 const struct MaskItem *conf = NULL;
941     const dlink_node *ptr = NULL;
942 michael 1921 char c = '\0';
943 michael 1372
944     if (tkline)
945 michael 1921 c = 'k';
946 michael 1372 else
947 michael 1921 c = 'K';
948 michael 1372
949 michael 3246 for (unsigned int i = 0; i < ATABLE_SIZE; ++i)
950 michael 1372 {
951     DLINK_FOREACH(ptr, atable[i].head)
952     {
953 michael 4033 const struct AddressRec *arec = ptr->data;
954 michael 1372
955 michael 1632 if (arec->type != CONF_KLINE)
956     continue;
957 michael 1628
958 michael 1632 conf = arec->conf;
959 michael 1372
960 michael 1650 if ((!tkline && conf->until) ||
961     (tkline && !conf->until))
962 michael 1632 continue;
963    
964 michael 3156 if (HasUMode(source_p, UMODE_OPER))
965     sendto_one_numeric(source_p, &me, RPL_STATSKLINE, c, conf->host, conf->user,
966 michael 3109 conf->reason);
967 michael 1632 else
968 michael 3156 sendto_one_numeric(source_p, &me, RPL_STATSKLINE, c, conf->host, conf->user,
969 michael 3109 conf->reason);
970 michael 1372 }
971     }
972     }
973    
974     static void
975 michael 1457 stats_tklines(struct Client *source_p, int parc, char *parv[])
976 adx 30 {
977     /* Oper only, if unopered, return ERR_NOPRIVILEGES */
978 michael 4035 if (ConfigFileEntry.stats_k_oper_only == 2 && !HasUMode(source_p, UMODE_OPER))
979 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
980 adx 30
981 michael 4035 /* If unopered, only return matching klines */
982     else if (ConfigFileEntry.stats_k_oper_only == 1 && !HasUMode(source_p, UMODE_OPER))
983 adx 30 {
984 michael 4033 const struct MaskItem *conf = NULL;
985 adx 30
986     if (MyConnect(source_p))
987 michael 1632 conf = find_conf_by_address(source_p->host,
988 michael 2820 &source_p->localClient->ip, CONF_KLINE,
989     source_p->localClient->aftype,
990     source_p->username, NULL, 1);
991 adx 30 else
992 michael 4035 conf = find_conf_by_address(source_p->host, NULL, CONF_KLINE, 0,
993     source_p->username, NULL, 1);
994 adx 30
995 michael 1632 if (!conf)
996 adx 30 return;
997    
998 michael 4035 /* Don't report a permanent kline as a tkline */
999 michael 1649 if (!conf->until)
1000 adx 30 return;
1001    
1002 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSKLINE, 'k',
1003     conf->host, conf->user, conf->reason);
1004 adx 30 }
1005 michael 4035 else /* They are opered, or allowed to see all klines */
1006 adx 30 report_Klines(source_p, 1);
1007     }
1008    
1009     static void
1010 michael 1457 stats_klines(struct Client *source_p, int parc, char *parv[])
1011 adx 30 {
1012     /* Oper only, if unopered, return ERR_NOPRIVILEGES */
1013 michael 4035 if (ConfigFileEntry.stats_k_oper_only == 2 && !HasUMode(source_p, UMODE_OPER))
1014 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1015 adx 30
1016 michael 4035 /* If unopered, only return matching klines */
1017     else if (ConfigFileEntry.stats_k_oper_only == 1 && !HasUMode(source_p, UMODE_OPER))
1018 adx 30 {
1019 michael 4033 const struct MaskItem *conf = NULL;
1020 adx 30
1021 michael 4035 /* Search for a kline */
1022 michael 560 if (MyConnect(source_p))
1023 michael 1632 conf = find_conf_by_address(source_p->host,
1024 michael 2820 &source_p->localClient->ip, CONF_KLINE,
1025     source_p->localClient->aftype,
1026     source_p->username, NULL, 0);
1027 adx 30 else
1028 michael 4035 conf = find_conf_by_address(source_p->host, NULL, CONF_KLINE, 0,
1029     source_p->username, NULL, 0);
1030 adx 30
1031 michael 1632 if (!conf)
1032 adx 30 return;
1033    
1034 michael 4035 /* Don't report a tkline as a kline */
1035 michael 1649 if (conf->until)
1036 adx 30 return;
1037 michael 2820
1038 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSKLINE, 'K',
1039     conf->host, conf->user, conf->reason);
1040 adx 30 }
1041 michael 4035 else /* They are opered, or allowed to see all klines */
1042 adx 30 report_Klines(source_p, 0);
1043     }
1044    
1045     static void
1046 michael 1457 stats_messages(struct Client *source_p, int parc, char *parv[])
1047 adx 30 {
1048     report_messages(source_p);
1049     }
1050    
1051     static void
1052 michael 1457 stats_oper(struct Client *source_p, int parc, char *parv[])
1053 adx 30 {
1054 michael 1219 if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_o_oper_only)
1055 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1056 adx 30 else
1057 michael 1632 report_confitem_types(source_p, CONF_OPER);
1058 adx 30 }
1059    
1060     /* stats_operedup()
1061     *
1062     * input - client pointer
1063     * output - none
1064     * side effects - client is shown a list of active opers
1065     */
1066     static void
1067 michael 1457 stats_operedup(struct Client *source_p, int parc, char *parv[])
1068 adx 30 {
1069 michael 4033 const dlink_node *ptr = NULL;
1070 michael 3512 unsigned int opercount = 0;
1071 michael 3517 char buf[IRCD_BUFSIZE] = "";
1072 adx 30
1073     DLINK_FOREACH(ptr, oper_list.head)
1074     {
1075     const struct Client *target_p = ptr->data;
1076    
1077 michael 1294 if (HasUMode(target_p, UMODE_HIDDEN) && !HasUMode(source_p, UMODE_OPER))
1078 adx 30 continue;
1079    
1080 michael 3517 if (HasUMode(source_p, UMODE_OPER) || !HasUMode(target_p, UMODE_HIDEIDLE))
1081     snprintf(buf, sizeof(buf), "%u", idle_time_get(source_p, target_p));
1082     else
1083     strlcpy(buf, "n/a", sizeof(buf));
1084    
1085 michael 1219 if (MyClient(source_p) && HasUMode(source_p, UMODE_OPER))
1086 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1087     "p :[%c][%s] %s (%s@%s) Idle: %s",
1088     HasUMode(target_p, UMODE_ADMIN) ? 'A' : 'O',
1089     oper_privs_as_string(target_p->localClient->operflags),
1090     target_p->name, target_p->username, target_p->host, buf);
1091 adx 30 else
1092 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1093     "p :[%c] %s (%s@%s) Idle: %s",
1094     HasUMode(target_p, UMODE_ADMIN) ? 'A' : 'O',
1095     target_p->name, target_p->username, target_p->host, buf);
1096 michael 3512 ++opercount;
1097 adx 30 }
1098    
1099 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1100     "p :%u OPER(s)", opercount);
1101 adx 30 }
1102    
1103     static void
1104 michael 1457 stats_ports(struct Client *source_p, int parc, char *parv[])
1105 adx 30 {
1106 michael 1219 if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_P_oper_only)
1107 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1108 adx 30 else
1109     show_ports(source_p);
1110     }
1111    
1112     static void
1113 michael 1457 stats_resv(struct Client *source_p, int parc, char *parv[])
1114 adx 30 {
1115     report_resv(source_p);
1116     }
1117    
1118     static void
1119 michael 1457 stats_service(struct Client *source_p, int parc, char *parv[])
1120 adx 30 {
1121 michael 1632 report_confitem_types(source_p, CONF_SERVICE);
1122 michael 1175 }
1123    
1124     static void
1125 michael 1457 stats_tstats(struct Client *source_p, int parc, char *parv[])
1126 adx 30 {
1127 michael 896 const struct Client *target_p = NULL;
1128     const dlink_node *ptr = NULL;
1129     struct ServerStatistics tmp;
1130 michael 1842 struct ServerStatistics *sp = &tmp;
1131 michael 896
1132     memcpy(sp, &ServerStats, sizeof(struct ServerStatistics));
1133    
1134     /*
1135     * must use the += operator. is_sv is not the number of currently
1136     * active server connections. Note the incrementation in
1137     * s_bsd.c:close_connection.
1138     */
1139     sp->is_sv += dlink_list_length(&serv_list);
1140    
1141     DLINK_FOREACH(ptr, serv_list.head)
1142     {
1143     target_p = ptr->data;
1144    
1145     sp->is_sbs += target_p->localClient->send.bytes;
1146     sp->is_sbr += target_p->localClient->recv.bytes;
1147 michael 1241 sp->is_sti += CurrentTime - target_p->localClient->firsttime;
1148 michael 896 }
1149    
1150     sp->is_cl += dlink_list_length(&local_client_list);
1151    
1152     DLINK_FOREACH(ptr, local_client_list.head)
1153     {
1154     target_p = ptr->data;
1155    
1156     sp->is_cbs += target_p->localClient->send.bytes;
1157     sp->is_cbr += target_p->localClient->recv.bytes;
1158 michael 1241 sp->is_cti += CurrentTime - target_p->localClient->firsttime;
1159 michael 896 }
1160    
1161     sp->is_ni += dlink_list_length(&unknown_list);
1162    
1163 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1164 michael 4039 "t :accepts %u refused %u",
1165 michael 3574 sp->is_ac, sp->is_ref);
1166     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1167 michael 4039 "t :unknown commands %u prefixes %u",
1168 michael 3574 sp->is_unco, sp->is_unpf);
1169     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1170 michael 4039 "t :nick collisions %u unknown closes %u",
1171 michael 3574 sp->is_kill, sp->is_ni);
1172     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1173 michael 4039 "t :wrong direction %u empty %u",
1174 michael 3574 sp->is_wrdi, sp->is_empt);
1175     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1176 michael 4039 "t :numerics seen %u",
1177 michael 3574 sp->is_num);
1178     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1179 michael 4039 "t :auth successes %u fails %u",
1180 michael 3574 sp->is_asuc, sp->is_abad);
1181     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1182 michael 4039 "t :Client Server");
1183 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1184 michael 4039 "t :connected %u %u",
1185 michael 3574 (unsigned int)sp->is_cl,
1186     (unsigned int)sp->is_sv);
1187     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1188 michael 4039 "t :bytes sent %llu %llu",
1189 michael 3574 sp->is_cbs, sp->is_sbs);
1190     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1191 michael 4039 "t :bytes recv %llu %llu",
1192 michael 3574 sp->is_cbr, sp->is_sbr);
1193     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1194 michael 4039 "t :time connected %u %u",
1195 michael 3574 (unsigned int)sp->is_cti,
1196     (unsigned int)sp->is_sti);
1197 adx 30 }
1198    
1199     static void
1200 michael 1457 stats_uptime(struct Client *source_p, int parc, char *parv[])
1201 adx 30 {
1202 michael 2270 if (!HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.stats_u_oper_only)
1203 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1204 michael 2269 else
1205     {
1206     time_t now = CurrentTime - me.localClient->since;
1207 michael 1148
1208 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSUPTIME, now / 86400,
1209     (now / 3600) % 24, (now / 60) % 60, now % 60);
1210 michael 1148
1211 michael 2269 if (!ConfigServerHide.disable_remote_commands || HasUMode(source_p, UMODE_OPER))
1212 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSCONN, Count.max_loc_con,
1213     Count.max_loc_cli, Count.totalrestartcount);
1214 michael 2269 }
1215 adx 30 }
1216    
1217     static void
1218 michael 1457 stats_shared(struct Client *source_p, int parc, char *parv[])
1219 adx 30 {
1220 michael 1632 report_confitem_types(source_p, CONF_ULINE);
1221 adx 30 }
1222    
1223     /* stats_servers()
1224     *
1225     * input - client pointer
1226     * output - none
1227     * side effects - client is shown lists of who connected servers
1228     */
1229     static void
1230 michael 1457 stats_servers(struct Client *source_p, int parc, char *parv[])
1231 adx 30 {
1232 michael 4033 const dlink_node *ptr = NULL;
1233 adx 30
1234     DLINK_FOREACH(ptr, serv_list.head)
1235     {
1236 michael 1127 const struct Client *target_p = ptr->data;
1237 adx 30
1238 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1239     "v :%s (%s!%s@%s) Idle: %d",
1240     target_p->name,
1241     (target_p->serv->by[0] ? target_p->serv->by : "Remote."),
1242     "*", "*", (int)(CurrentTime - target_p->localClient->lasttime));
1243 adx 30 }
1244    
1245 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1246     "v :%u Server(s)", dlink_list_length(&serv_list));
1247 adx 30 }
1248    
1249     static void
1250 michael 1457 stats_gecos(struct Client *source_p, int parc, char *parv[])
1251 adx 30 {
1252 michael 1632 report_confitem_types(source_p, CONF_XLINE);
1253 adx 30 }
1254    
1255     static void
1256 michael 1457 stats_class(struct Client *source_p, int parc, char *parv[])
1257 adx 30 {
1258 michael 2116 const dlink_node *ptr = NULL;
1259    
1260     DLINK_FOREACH(ptr, class_get_list()->head)
1261     {
1262     const struct ClassItem *class = ptr->data;
1263    
1264 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSYLINE, 'Y',
1265     class->name, class->ping_freq,
1266     class->con_freq,
1267     class->max_total, class->max_sendq,
1268     class->max_recvq,
1269     class->ref_count,
1270     class->number_per_cidr, class->cidr_bitlen_ipv4,
1271     class->number_per_cidr, class->cidr_bitlen_ipv6,
1272     class->active ? "active" : "disabled");
1273 michael 2116 }
1274 adx 30 }
1275    
1276     static void
1277 michael 1457 stats_servlinks(struct Client *source_p, int parc, char *parv[])
1278 adx 30 {
1279     uint64_t sendB = 0, recvB = 0;
1280     time_t uptime = 0;
1281 michael 560 dlink_node *ptr = NULL;
1282 adx 30
1283 michael 1219 if (ConfigServerHide.flatten_links && !HasUMode(source_p, UMODE_OPER))
1284 adx 30 {
1285 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1286 adx 30 return;
1287     }
1288    
1289     DLINK_FOREACH(ptr, serv_list.head)
1290     {
1291 michael 560 struct Client *target_p = ptr->data;
1292 adx 30
1293 michael 1851 if (HasFlag(target_p, FLAGS_SERVICE) && ConfigServerHide.hide_services)
1294     if (!HasUMode(source_p, UMODE_OPER))
1295     continue;
1296    
1297 adx 30 sendB += target_p->localClient->send.bytes;
1298     recvB += target_p->localClient->recv.bytes;
1299    
1300     /* ":%s 211 %s %s %u %u %llu %u %llu :%u %u %s" */
1301 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLINKINFO,
1302 michael 1219 get_client_name(target_p, HasUMode(source_p, UMODE_ADMIN) ? SHOW_IP : MASK_IP),
1303 adx 30 dbuf_length(&target_p->localClient->buf_sendq),
1304     target_p->localClient->send.messages,
1305     target_p->localClient->send.bytes >> 10,
1306     target_p->localClient->recv.messages,
1307     target_p->localClient->recv.bytes >> 10,
1308 michael 1241 (unsigned)(CurrentTime - target_p->localClient->firsttime),
1309 michael 4035 (CurrentTime > target_p->localClient->since) ? (unsigned)(CurrentTime - target_p->localClient->since) : 0,
1310 michael 1219 HasUMode(source_p, UMODE_OPER) ? show_capabilities(target_p) : "TS");
1311 adx 30 }
1312    
1313     sendB >>= 10;
1314     recvB >>= 10;
1315    
1316 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT, "? :%u total server(s)",
1317     dlink_list_length(&serv_list));
1318     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT, "? :Sent total: %7.2f %s",
1319     _GMKv(sendB), _GMKs(sendB));
1320     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT, "? :Recv total: %7.2f %s",
1321     _GMKv(recvB), _GMKs(recvB));
1322 adx 30
1323 michael 1241 uptime = (CurrentTime - me.localClient->since);
1324 adx 30
1325 michael 3574 sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1326     "? :Server send: %7.2f %s (%4.1f K/s)",
1327     _GMKv((me.localClient->send.bytes>>10)),
1328     _GMKs((me.localClient->send.bytes>>10)),
1329     (float)((float)((me.localClient->send.bytes) >> 10) /
1330     (float)uptime));
1331     sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
1332     "? :Server recv: %7.2f %s (%4.1f K/s)",
1333     _GMKv((me.localClient->recv.bytes>>10)),
1334     _GMKs((me.localClient->recv.bytes>>10)),
1335     (float)((float)((me.localClient->recv.bytes) >> 10) /
1336     (float)uptime));
1337 adx 30 }
1338    
1339 michael 1457 /* parse_stats_args()
1340     *
1341     * inputs - arg count
1342     * - args
1343     * - doall flag
1344     * - wild card or not
1345     * output - pointer to name to use
1346     * side effects -
1347     * common parse routine for m_stats args
1348 michael 2820 *
1349 michael 1457 */
1350     static char *
1351 michael 3114 parse_stats_args(struct Client *source_p, int parc, char *parv[], int *doall, int *wilds)
1352 adx 30 {
1353 michael 1457 if (parc > 2)
1354 adx 30 {
1355 michael 4035 char *name = parv[2];
1356 adx 30
1357 michael 3114 if (!irccmp(name, ID_or_name(&me, source_p)))
1358 michael 1457 *doall = 2;
1359 michael 3114 else if (!match(name, ID_or_name(&me, source_p)))
1360 michael 1457 *doall = 1;
1361    
1362     *wilds = has_wildcards(name);
1363    
1364     return name;
1365 adx 30 }
1366    
1367 michael 1457 return NULL;
1368 adx 30 }
1369    
1370     static void
1371 michael 3079 stats_L_list(struct Client *source_p, char *name, int doall, int wilds,
1372     dlink_list *list, char statchar)
1373 adx 30 {
1374 michael 4035 dlink_node *ptr = NULL;
1375 adx 30
1376     /*
1377 michael 4035 * Send info about connections which match, or all if the
1378     * mask matches from. Only restrictions are on those who
1379 adx 30 * are invisible not being visible to 'foreigners' who use
1380     * a wild card based search to list it.
1381     */
1382     DLINK_FOREACH(ptr, list->head)
1383     {
1384 michael 4035 struct Client *target_p = ptr->data;
1385 adx 30
1386 michael 1219 if (HasUMode(target_p, UMODE_INVISIBLE) && (doall || wilds) &&
1387 michael 1457 !(MyConnect(source_p) && HasUMode(source_p, UMODE_OPER)) &&
1388     !HasUMode(target_p, UMODE_OPER) && (target_p != source_p))
1389 adx 30 continue;
1390 michael 4035
1391 michael 1652 if (!doall && wilds && match(name, target_p->name))
1392 adx 30 continue;
1393 michael 4035
1394 adx 30 if (!(doall || wilds) && irccmp(name, target_p->name))
1395     continue;
1396    
1397 michael 4035 /*
1398     * This basically shows ips for our opers if it's not a server/admin, or
1399     * its one of our admins.
1400     */
1401 michael 3654 if (MyClient(source_p) && HasUMode(source_p, UMODE_OPER) &&
1402     (HasUMode(source_p, UMODE_ADMIN) ||
1403     (!IsServer(target_p) && !HasUMode(target_p, UMODE_ADMIN) &&
1404     !IsHandshake(target_p) && !IsConnecting(target_p))))
1405 adx 30 {
1406 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLINKINFO,
1407 adx 30 (IsUpper(statchar)) ?
1408     get_client_name(target_p, SHOW_IP) :
1409     get_client_name(target_p, HIDE_IP),
1410     dbuf_length(&target_p->localClient->buf_sendq),
1411     target_p->localClient->send.messages,
1412     target_p->localClient->send.bytes>>10,
1413     target_p->localClient->recv.messages,
1414     target_p->localClient->recv.bytes>>10,
1415 michael 1241 (unsigned)(CurrentTime - target_p->localClient->firsttime),
1416 michael 4035 (CurrentTime > target_p->localClient->since) ? (unsigned)(CurrentTime - target_p->localClient->since) : 0,
1417 adx 30 IsServer(target_p) ? show_capabilities(target_p) : "-");
1418     }
1419     else
1420     {
1421     /* If its a hidden ip, an admin, or a server, mask the real IP */
1422 michael 3654 if (IsIPSpoof(target_p) || IsServer(target_p) || HasUMode(target_p, UMODE_ADMIN) ||
1423     IsHandshake(target_p) || IsConnecting(target_p))
1424 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLINKINFO,
1425 michael 1457 get_client_name(target_p, MASK_IP),
1426     dbuf_length(&target_p->localClient->buf_sendq),
1427     target_p->localClient->send.messages,
1428     target_p->localClient->send.bytes>>10,
1429     target_p->localClient->recv.messages,
1430     target_p->localClient->recv.bytes>>10,
1431     (unsigned)(CurrentTime - target_p->localClient->firsttime),
1432     (CurrentTime > target_p->localClient->since) ? (unsigned)(CurrentTime - target_p->localClient->since):0,
1433     IsServer(target_p) ? show_capabilities(target_p) : "-");
1434 adx 30 else /* show the real IP */
1435 michael 3109 sendto_one_numeric(source_p, &me, RPL_STATSLINKINFO,
1436 michael 1457 (IsUpper(statchar)) ?
1437     get_client_name(target_p, SHOW_IP) :
1438     get_client_name(target_p, HIDE_IP),
1439     dbuf_length(&target_p->localClient->buf_sendq),
1440     target_p->localClient->send.messages,
1441     target_p->localClient->send.bytes>>10,
1442     target_p->localClient->recv.messages,
1443     target_p->localClient->recv.bytes>>10,
1444     (unsigned)(CurrentTime - target_p->localClient->firsttime),
1445     (CurrentTime > target_p->localClient->since) ? (unsigned)(CurrentTime - target_p->localClient->since):0,
1446     IsServer(target_p) ? show_capabilities(target_p) : "-");
1447 adx 30 }
1448     }
1449     }
1450    
1451 michael 1457 /*
1452     * stats_L
1453 adx 30 *
1454 michael 1457 * inputs - pointer to client to report to
1455     * - doall flag
1456     * - wild card or not
1457     * output - NONE
1458     * side effects -
1459     */
1460     static void
1461 michael 3079 stats_L(struct Client *source_p, char *name,int doall,
1462     int wilds, char statchar)
1463 michael 1457 {
1464     stats_L_list(source_p, name, doall, wilds, &unknown_list, statchar);
1465     stats_L_list(source_p, name, doall, wilds, &local_client_list, statchar);
1466     stats_L_list(source_p, name, doall, wilds, &serv_list, statchar);
1467     }
1468    
1469     static void
1470     stats_ltrace(struct Client *source_p, int parc, char *parv[])
1471     {
1472     int doall = 0;
1473     int wilds = 0;
1474     char *name = NULL;
1475     char statchar;
1476    
1477 michael 3246 if ((name = parse_stats_args(source_p, parc, parv, &doall, &wilds)))
1478 michael 1457 {
1479 michael 3246 statchar = *parv[1];
1480 michael 1457 stats_L(source_p, name, doall, wilds, statchar);
1481     }
1482     else
1483 michael 3109 sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "STATS");
1484 michael 1457 }
1485    
1486     static const struct StatsStruct
1487     {
1488     const unsigned char letter;
1489     void (*handler)();
1490     const unsigned int need_oper;
1491     const unsigned int need_admin;
1492     } stats_cmd_table[] = {
1493 michael 4035 /* letter function need_oper need_admin */
1494     { 'a', stats_dns_servers, 1, 1 },
1495     { 'A', stats_dns_servers, 1, 1 },
1496     { 'c', stats_connect, 1, 0 },
1497     { 'C', stats_connect, 1, 0 },
1498     { 'd', stats_tdeny, 1, 0 },
1499     { 'D', stats_deny, 1, 0 },
1500     { 'e', stats_exempt, 1, 0 },
1501     { 'E', stats_events, 1, 1 },
1502     { 'f', fd_dump, 1, 1 },
1503     { 'F', fd_dump, 1, 1 },
1504     { 'g', stats_pending_glines, 1, 0 },
1505     { 'G', stats_glines, 1, 0 },
1506 michael 4143 { 'h', stats_hubleaf, 1, 1 },
1507 michael 4035 { 'H', stats_hubleaf, 1, 0 },
1508     { 'i', stats_auth, 0, 0 },
1509     { 'I', stats_auth, 0, 0 },
1510     { 'k', stats_tklines, 0, 0 },
1511     { 'K', stats_klines, 0, 0 },
1512     { 'l', stats_ltrace, 1, 0 },
1513     { 'L', stats_ltrace, 1, 0 },
1514     { 'm', stats_messages, 0, 0 },
1515     { 'M', stats_messages, 0, 0 },
1516     { 'o', stats_oper, 0, 0 },
1517     { 'O', stats_oper, 0, 0 },
1518     { 'p', stats_operedup, 0, 0 },
1519     { 'P', stats_ports, 0, 0 },
1520     { 'q', stats_resv, 1, 0 },
1521     { 'Q', stats_resv, 1, 0 },
1522     { 'r', stats_usage, 1, 0 },
1523     { 'R', stats_usage, 1, 0 },
1524     { 's', stats_service, 1, 0 },
1525     { 'S', stats_service, 1, 0 },
1526     { 't', stats_tstats, 1, 0 },
1527     { 'T', motd_report, 1, 0 },
1528     { 'u', stats_uptime, 0, 0 },
1529     { 'U', stats_shared, 1, 0 },
1530     { 'v', stats_servers, 1, 0 },
1531     { 'x', stats_gecos, 1, 0 },
1532     { 'X', stats_gecos, 1, 0 },
1533     { 'y', stats_class, 1, 0 },
1534     { 'Y', stats_class, 1, 0 },
1535     { 'z', stats_memory, 1, 0 },
1536     { '?', stats_servlinks, 0, 0 },
1537     { '\0', NULL, 0, 0 }
1538 michael 1457 };
1539    
1540     static void
1541     do_stats(struct Client *source_p, int parc, char *parv[])
1542     {
1543     const char statchar = *parv[1];
1544    
1545     if (statchar == '\0')
1546     {
1547 michael 3109 sendto_one_numeric(source_p, &me, RPL_ENDOFSTATS, '*');
1548 michael 1457 return;
1549     }
1550    
1551 michael 3283 for (const struct StatsStruct *tab = stats_cmd_table; tab->handler; ++tab)
1552 michael 1457 {
1553     if (tab->letter == statchar)
1554     {
1555     /* The stats table says what privs are needed, so check --fl_ */
1556     if ((tab->need_admin && !HasUMode(source_p, UMODE_ADMIN)) ||
1557     (tab->need_oper && !HasUMode(source_p, UMODE_OPER)))
1558     {
1559 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVILEGES);
1560 michael 1457 break;
1561     }
1562    
1563 michael 1618 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
1564 michael 1532 "STATS %c requested by %s (%s@%s) [%s]",
1565 michael 1457 statchar, source_p->name, source_p->username,
1566     source_p->host, source_p->servptr->name);
1567     tab->handler(source_p, parc, parv);
1568     break;
1569     }
1570     }
1571    
1572 michael 3109 sendto_one_numeric(source_p, &me, RPL_ENDOFSTATS, statchar);
1573 michael 1457 }
1574    
1575     /*
1576     * m_stats()
1577 michael 3096 * parv[0] = command
1578 michael 1457 * parv[1] = stat letter/command
1579     * parv[2] = (if present) server/mask in stats L
1580 adx 30 */
1581 michael 2820 static int
1582 michael 3156 m_stats(struct Client *source_p, int parc, char *parv[])
1583 adx 30 {
1584 michael 1457 static time_t last_used = 0;
1585 adx 30
1586 michael 1457 /* Check the user is actually allowed to do /stats, and isnt flooding */
1587     if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
1588     {
1589 michael 3109 sendto_one_numeric(source_p, &me, RPL_LOAD2HI);
1590 michael 2820 return 0;
1591 michael 1457 }
1592 adx 30
1593 michael 1457 last_used = CurrentTime;
1594 adx 30
1595 michael 2341 /* Is the stats meant for us? */
1596     if (!ConfigServerHide.disable_remote_commands)
1597 michael 4035 if (hunt_server(source_p, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME)
1598 michael 2820 return 0;
1599 michael 2341
1600 michael 1457 do_stats(source_p, parc, parv);
1601 michael 2820 return 0;
1602 michael 1457 }
1603    
1604     /*
1605 michael 3219 * ms_stats()
1606 michael 3096 * parv[0] = command
1607 michael 1457 * parv[1] = stat letter/command
1608     * parv[2] = (if present) server/mask in stats L, or target
1609     */
1610 michael 2820 static int
1611 michael 3219 ms_stats(struct Client *source_p, int parc, char *parv[])
1612 michael 1457 {
1613 michael 4035 if (hunt_server(source_p, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME)
1614 michael 2820 return 0;
1615 michael 1457
1616     do_stats(source_p, parc, parv);
1617 michael 2820 return 0;
1618 adx 30 }
1619 michael 1230
1620 michael 2820 static struct Message stats_msgtab =
1621     {
1622 michael 1230 "STATS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
1623 michael 3219 { m_unregistered, m_stats, ms_stats, m_ignore, ms_stats, m_ignore }
1624 michael 1230 };
1625    
1626     static void
1627     module_init(void)
1628     {
1629     mod_add_cmd(&stats_msgtab);
1630     }
1631    
1632     static void
1633     module_exit(void)
1634     {
1635     mod_del_cmd(&stats_msgtab);
1636     }
1637    
1638 michael 2820 struct module module_entry =
1639     {
1640 michael 1230 .node = { NULL, NULL, NULL },
1641     .name = NULL,
1642     .version = "$Revision$",
1643     .handle = NULL,
1644     .modinit = module_init,
1645     .modexit = module_exit,
1646     .flags = 0
1647     };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision