]> jfr.im git - solanum.git/blob - ircd/modules.c
Merge pull request #341 from ophion-project/upstream/modularize-regonlymsg
[solanum.git] / ircd / modules.c
1 /*
2 * ircd-ratbox: A slightly useful ircd.
3 * modules.c: A module loader.
4 *
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 */
24
25 #include "stdinc.h"
26 #include "modules.h"
27 #include "logger.h"
28 #include "ircd.h"
29 #include "client.h"
30 #include "send.h"
31 #include "s_conf.h"
32 #include "s_newconf.h"
33 #include "numeric.h"
34 #include "parse.h"
35 #include "ircd_defs.h"
36 #include "match.h"
37 #include "s_serv.h"
38 #include "capability.h"
39 #include "hash.h"
40
41 #include <ltdl.h>
42
43 #ifndef LT_MODULE_EXT
44 # error "Charybdis requires loadable module support."
45 #endif
46
47 rb_dlink_list module_list;
48 rb_dlink_list mod_paths;
49
50 static const char *core_module_table[] = {
51 "m_ban",
52 "m_die",
53 "m_error",
54 "m_join",
55 "m_kick",
56 "m_kill",
57 "m_message",
58 "m_mode",
59 "m_modules",
60 "m_nick",
61 "m_part",
62 "m_quit",
63 "m_server",
64 "m_squit",
65 NULL
66 };
67
68 #define MOD_WARN_DELTA (90 * 86400) /* time in seconds, 86400 seconds in a day */
69
70 void
71 init_modules(void)
72 {
73 if(lt_dlinit())
74 {
75 ilog(L_MAIN, "lt_dlinit failed");
76 exit(EXIT_FAILURE);
77 }
78
79 /* Add the default paths we look in to the module system --nenolod */
80 mod_add_path(ircd_paths[IRCD_PATH_MODULES]);
81 mod_add_path(ircd_paths[IRCD_PATH_AUTOLOAD_MODULES]);
82 }
83
84 static unsigned int prev_caps;
85
86 void
87 mod_remember_clicaps(void)
88 {
89 prev_caps = capability_index_mask(cli_capindex);
90 }
91
92 void
93 mod_notify_clicaps(void)
94 {
95 unsigned int cur_caps = capability_index_mask(cli_capindex);
96 unsigned int del = prev_caps & ~cur_caps;
97 unsigned int new = cur_caps & ~prev_caps;
98
99 if (del)
100 sendto_local_clients_with_capability(CLICAP_CAP_NOTIFY, ":%s CAP * DEL :%s",
101 me.name, capability_index_list(cli_capindex, del));
102 if (new)
103 sendto_local_clients_with_capability(CLICAP_CAP_NOTIFY, ":%s CAP * NEW :%s",
104 me.name, capability_index_list(cli_capindex, new));
105 }
106
107 /* mod_find_path()
108 *
109 * input - path
110 * output - none
111 * side effects - returns a module path from path
112 */
113 static char *
114 mod_find_path(const char *path)
115 {
116 rb_dlink_node *ptr;
117 char *mpath;
118
119 RB_DLINK_FOREACH(ptr, mod_paths.head)
120 {
121 mpath = ptr->data;
122
123 if(!strcmp(path, mpath))
124 return mpath;
125 }
126
127 return NULL;
128 }
129
130 /* mod_add_path
131 *
132 * input - path
133 * ouput -
134 * side effects - adds path to list
135 */
136 void
137 mod_add_path(const char *path)
138 {
139 char *pathst;
140
141 if(mod_find_path(path))
142 return;
143
144 pathst = rb_strdup(path);
145 rb_dlinkAddAlloc(pathst, &mod_paths);
146 }
147
148 /* mod_clear_paths()
149 *
150 * input -
151 * output -
152 * side effects - clear the lists of paths
153 */
154 void
155 mod_clear_paths(void)
156 {
157 rb_dlink_node *ptr, *next_ptr;
158
159 RB_DLINK_FOREACH_SAFE(ptr, next_ptr, mod_paths.head)
160 {
161 rb_free(ptr->data);
162 rb_free_rb_dlink_node(ptr);
163 }
164
165 mod_paths.head = mod_paths.tail = NULL;
166 mod_paths.length = 0;
167 }
168
169 /* findmodule_byname
170 *
171 * input - module to load
172 * output - index of module on success, -1 on failure
173 * side effects - none
174 */
175 struct module *
176 findmodule_byname(const char *name)
177 {
178 rb_dlink_node *ptr;
179 char name_ext[PATH_MAX + 1];
180
181 rb_strlcpy(name_ext, name, sizeof name_ext);
182 rb_strlcat(name_ext, LT_MODULE_EXT, sizeof name_ext);
183
184 RB_DLINK_FOREACH(ptr, module_list.head)
185 {
186 struct module *mod = ptr->data;
187
188 if(!irccmp(mod->name, name))
189 return mod;
190
191 if(!irccmp(mod->name, name_ext))
192 return mod;
193 }
194
195 return NULL;
196 }
197
198 /* load_all_modules()
199 *
200 * input -
201 * output -
202 * side effects -
203 */
204 void
205 load_all_modules(bool warn)
206 {
207 DIR *system_module_dir = NULL;
208 struct dirent *ldirent = NULL;
209 char module_fq_name[PATH_MAX + 1];
210 size_t module_ext_len = strlen(LT_MODULE_EXT);
211
212 system_module_dir = opendir(ircd_paths[IRCD_PATH_AUTOLOAD_MODULES]);
213
214 if(system_module_dir == NULL)
215 {
216 ilog(L_MAIN, "Could not load modules from %s: %s", ircd_paths[IRCD_PATH_AUTOLOAD_MODULES], strerror(errno));
217 return;
218 }
219
220 while ((ldirent = readdir(system_module_dir)) != NULL)
221 {
222 size_t len = strlen(ldirent->d_name);
223
224 if(len > module_ext_len &&
225 rb_strncasecmp(ldirent->d_name + (len - module_ext_len), LT_MODULE_EXT, module_ext_len) == 0)
226 {
227 (void) snprintf(module_fq_name, sizeof(module_fq_name), "%s%c%s",
228 ircd_paths[IRCD_PATH_AUTOLOAD_MODULES], RB_PATH_SEPARATOR, ldirent->d_name);
229 (void) load_a_module(module_fq_name, warn, MAPI_ORIGIN_CORE, false);
230 }
231
232 }
233 (void) closedir(system_module_dir);
234 }
235
236 /* load_core_modules()
237 *
238 * input -
239 * output -
240 * side effects - core modules are loaded, if any fail, kill ircd
241 */
242 void
243 load_core_modules(bool warn)
244 {
245 char module_name[PATH_MAX];
246 int i;
247
248
249 for (i = 0; core_module_table[i]; i++)
250 {
251 snprintf(module_name, sizeof(module_name), "%s%c%s", ircd_paths[IRCD_PATH_MODULES], RB_PATH_SEPARATOR,
252 core_module_table[i]);
253
254 if(load_a_module(module_name, warn, MAPI_ORIGIN_CORE, true) == false)
255 {
256 ilog(L_MAIN,
257 "Error loading core module %s: terminating ircd",
258 core_module_table[i]);
259 exit(EXIT_FAILURE);
260 }
261 }
262 }
263
264 /* load_one_module()
265 *
266 * input -
267 * output -
268 * side effects -
269 */
270 bool
271 load_one_module(const char *path, int origin, bool coremodule)
272 {
273 char modpath[PATH_MAX];
274 rb_dlink_node *pathst;
275
276 if (server_state_foreground)
277 inotice("loading module %s ...", path);
278
279 if(coremodule)
280 origin = MAPI_ORIGIN_CORE;
281
282 RB_DLINK_FOREACH(pathst, mod_paths.head)
283 {
284 struct stat statbuf;
285 const char *mpath = pathst->data;
286
287 snprintf(modpath, sizeof(modpath), "%s%c%s%s", mpath, RB_PATH_SEPARATOR, path, LT_MODULE_EXT);
288 if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL))
289 {
290 if(stat(modpath, &statbuf) == 0 && S_ISREG(statbuf.st_mode))
291 {
292 /* Regular files only please */
293 return load_a_module(modpath, true, origin, coremodule);
294 }
295
296 }
297 }
298
299 sendto_realops_snomask(SNO_GENERAL, L_ALL, "Cannot locate module %s", path);
300 return false;
301 }
302
303 static char unknown_ver[] = "<unknown>";
304 static char unknown_description[] = "<none>";
305
306 /* unload_one_module()
307 *
308 * inputs - name of module to unload
309 * - true to say modules unloaded, false to not
310 * output - true if successful, false if error
311 * side effects - module is unloaded
312 */
313 bool
314 unload_one_module(const char *name, bool warn)
315 {
316 struct module *mod;
317
318 if((mod = findmodule_byname(name)) == NULL)
319 return false;
320
321 /*
322 ** XXX - The type system in C does not allow direct conversion between
323 ** data and function pointers, but as it happens, most C compilers will
324 ** safely do this, however it is a theoretical overlow to cast as we
325 ** must do here. I have library functions to take care of this, but
326 ** despite being more "correct" for the C language, this is more
327 ** practical. Removing the abuse of the ability to cast ANY pointer
328 ** to and from an integer value here will break some compilers.
329 ** -jmallett
330 */
331 /* Left the comment in but the code isn't here any more -larne */
332 switch (mod->mapi_version)
333 {
334 case 1:
335 {
336 struct mapi_mheader_av1 *mheader = mod->mapi_header;
337 if(mheader->mapi_command_list)
338 {
339 struct Message **m;
340 for (m = mheader->mapi_command_list; *m; ++m)
341 mod_del_cmd(*m);
342 }
343
344 /* hook events are never removed, we simply lose the
345 * ability to call them --fl
346 */
347 if(mheader->mapi_hfn_list)
348 {
349 mapi_hfn_list_av1 *m;
350 for (m = mheader->mapi_hfn_list; m->hapi_name; ++m)
351 remove_hook(m->hapi_name, m->fn);
352 }
353
354 if(mheader->mapi_unregister)
355 mheader->mapi_unregister();
356 break;
357 }
358 case 2:
359 {
360 struct mapi_mheader_av2 *mheader = mod->mapi_header;
361
362 /* XXX duplicate code :( */
363 if(mheader->mapi_command_list)
364 {
365 struct Message **m;
366 for (m = mheader->mapi_command_list; *m; ++m)
367 mod_del_cmd(*m);
368 }
369
370 /* hook events are never removed, we simply lose the
371 * ability to call them --fl
372 */
373 if(mheader->mapi_hfn_list)
374 {
375 mapi_hfn_list_av1 *m;
376 for (m = mheader->mapi_hfn_list; m->hapi_name; ++m)
377 remove_hook(m->hapi_name, m->fn);
378 }
379
380 if(mheader->mapi_unregister)
381 mheader->mapi_unregister();
382
383 if(mheader->mapi_cap_list)
384 {
385 mapi_cap_list_av2 *m;
386 for (m = mheader->mapi_cap_list; m->cap_name; ++m)
387 {
388 struct CapabilityIndex *idx;
389
390 switch (m->cap_index)
391 {
392 case MAPI_CAP_CLIENT:
393 idx = cli_capindex;
394 break;
395 case MAPI_CAP_SERVER:
396 idx = serv_capindex;
397 break;
398 default:
399 sendto_realops_snomask(SNO_GENERAL, L_ALL,
400 "Unknown/unsupported CAP index found of type %d on capability %s when unloading %s",
401 m->cap_index, m->cap_name, mod->name);
402 ilog(L_MAIN,
403 "Unknown/unsupported CAP index found of type %d on capability %s when unloading %s",
404 m->cap_index, m->cap_name, mod->name);
405 continue;
406 }
407
408 capability_orphan(idx, m->cap_name);
409 }
410 }
411 break;
412 }
413 default:
414 sendto_realops_snomask(SNO_GENERAL, L_ALL,
415 "Unknown/unsupported MAPI version %d when unloading %s!",
416 mod->mapi_version, mod->name);
417 ilog(L_MAIN, "Unknown/unsupported MAPI version %d when unloading %s!",
418 mod->mapi_version, mod->name);
419 break;
420 }
421
422 lt_dlclose(mod->address);
423
424 rb_dlinkDelete(&mod->node, &module_list);
425 rb_free(mod->name);
426 rb_free(mod->path);
427 rb_free(mod);
428
429 if(warn)
430 {
431 ilog(L_MAIN, "Module %s unloaded", name);
432 sendto_realops_snomask(SNO_GENERAL, L_ALL, "Module %s unloaded", name);
433 }
434
435 return true;
436 }
437
438 /*
439 * load_a_module()
440 *
441 * inputs - path name of module, bool to notice, int of origin, bool if core
442 * output - false if error true if success
443 * side effects - loads a module if successful
444 */
445 bool
446 load_a_module(const char *path, bool warn, int origin, bool core)
447 {
448 struct module *mod;
449 lt_dlhandle tmpptr;
450 char *mod_displayname, *c;
451 const char *ver, *description = NULL;
452
453 int *mapi_version;
454
455 mod_displayname = rb_basename(path);
456
457 /* Trim off the ending for the display name if we have to */
458 if((c = rb_strcasestr(mod_displayname, LT_MODULE_EXT)) != NULL)
459 *c = '\0';
460
461 tmpptr = lt_dlopenext(path);
462
463 if(tmpptr == NULL)
464 {
465 const char *err = lt_dlerror();
466
467 sendto_realops_snomask(SNO_GENERAL, L_ALL,
468 "Error loading module %s: %s", mod_displayname, err);
469 ilog(L_MAIN, "Error loading module %s: %s", mod_displayname, err);
470 rb_free(mod_displayname);
471 return false;
472 }
473
474 /*
475 * _mheader is actually a struct mapi_mheader_*, but mapi_version
476 * is always the first member of this structure, so we treate it
477 * as a single int in order to determine the API version.
478 * -larne.
479 */
480 mapi_version = (int *) (uintptr_t) lt_dlsym(tmpptr, "_mheader");
481 if((mapi_version == NULL
482 && (mapi_version = (int *) (uintptr_t) lt_dlsym(tmpptr, "__mheader")) == NULL)
483 || MAPI_MAGIC(*mapi_version) != MAPI_MAGIC_HDR)
484 {
485 sendto_realops_snomask(SNO_GENERAL, L_ALL,
486 "Data format error: module %s has no MAPI header.",
487 mod_displayname);
488 ilog(L_MAIN, "Data format error: module %s has no MAPI header.", mod_displayname);
489 (void) lt_dlclose(tmpptr);
490 rb_free(mod_displayname);
491 return false;
492 }
493
494 switch (MAPI_VERSION(*mapi_version))
495 {
496 case 1:
497 {
498 struct mapi_mheader_av1 *mheader = (struct mapi_mheader_av1 *)(void *)mapi_version; /* see above */
499 if(mheader->mapi_register && (mheader->mapi_register() == -1))
500 {
501 ilog(L_MAIN, "Module %s indicated failure during load.",
502 mod_displayname);
503 sendto_realops_snomask(SNO_GENERAL, L_ALL,
504 "Module %s indicated failure during load.",
505 mod_displayname);
506 lt_dlclose(tmpptr);
507 rb_free(mod_displayname);
508 return false;
509 }
510 if(mheader->mapi_command_list)
511 {
512 struct Message **m;
513 for (m = mheader->mapi_command_list; *m; ++m)
514 mod_add_cmd(*m);
515 }
516
517 if(mheader->mapi_hook_list)
518 {
519 mapi_hlist_av1 *m;
520 for (m = mheader->mapi_hook_list; m->hapi_name; ++m)
521 *m->hapi_id = register_hook(m->hapi_name);
522 }
523
524 if(mheader->mapi_hfn_list)
525 {
526 mapi_hfn_list_av1 *m;
527 for (m = mheader->mapi_hfn_list; m->hapi_name; ++m)
528 add_hook(m->hapi_name, m->fn);
529 }
530
531 ver = mheader->mapi_module_version;
532 break;
533 }
534 case 2:
535 {
536 struct mapi_mheader_av2 *mheader = (struct mapi_mheader_av2 *)(void *)mapi_version; /* see above */
537
538 if(mheader->mapi_cap_list)
539 {
540 mapi_cap_list_av2 *m;
541 for (m = mheader->mapi_cap_list; m->cap_name; ++m)
542 {
543 struct CapabilityIndex *idx;
544 int result;
545
546 switch (m->cap_index)
547 {
548 case MAPI_CAP_CLIENT:
549 idx = cli_capindex;
550 break;
551 case MAPI_CAP_SERVER:
552 idx = serv_capindex;
553 break;
554 default:
555 sendto_realops_snomask(SNO_GENERAL, L_ALL,
556 "Unknown/unsupported CAP index found of type %d on capability %s when loading %s",
557 m->cap_index, m->cap_name, mod_displayname);
558 ilog(L_MAIN,
559 "Unknown/unsupported CAP index found of type %d on capability %s when loading %s",
560 m->cap_index, m->cap_name, mod_displayname);
561 continue;
562 }
563
564 result = capability_put(idx, m->cap_name, m->cap_ownerdata);
565 if (m->cap_id != NULL)
566 *(m->cap_id) = result;
567 }
568 }
569
570 /* XXX duplicated code :( */
571 if(mheader->mapi_register && (mheader->mapi_register() == -1))
572 {
573 ilog(L_MAIN, "Module %s indicated failure during load.",
574 mod_displayname);
575 sendto_realops_snomask(SNO_GENERAL, L_ALL,
576 "Module %s indicated failure during load.",
577 mod_displayname);
578 if(mheader->mapi_cap_list)
579 {
580 mapi_cap_list_av2 *m;
581 for (m = mheader->mapi_cap_list; m->cap_name; ++m)
582 {
583 struct CapabilityIndex *idx;
584 switch (m->cap_index)
585 {
586 case MAPI_CAP_CLIENT:
587 idx = cli_capindex;
588 break;
589 case MAPI_CAP_SERVER:
590 idx = serv_capindex;
591 break;
592 default:
593 continue;
594 }
595 capability_orphan(idx, m->cap_name);
596 }
597 }
598 lt_dlclose(tmpptr);
599 rb_free(mod_displayname);
600 return false;
601 }
602
603 /* Basic date code checks
604 *
605 * Don't make them fatal, but do complain about differences within a certain time frame.
606 * Later on if there are major API changes we can add fatal checks.
607 * -- Elizafox
608 */
609 if(mheader->mapi_datecode != datecode && mheader->mapi_datecode > 0)
610 {
611 long int delta = datecode - mheader->mapi_datecode;
612 if (delta > MOD_WARN_DELTA)
613 {
614 delta /= 86400;
615 iwarn("Module %s build date is out of sync with ircd build date by %ld days, expect problems",
616 mod_displayname, delta);
617 sendto_realops_snomask(SNO_GENERAL, L_ALL,
618 "Module %s build date is out of sync with ircd build date by %ld days, expect problems",
619 mod_displayname, delta);
620 }
621 }
622
623 if(mheader->mapi_command_list)
624 {
625 struct Message **m;
626 for (m = mheader->mapi_command_list; *m; ++m)
627 mod_add_cmd(*m);
628 }
629
630 if(mheader->mapi_hook_list)
631 {
632 mapi_hlist_av1 *m;
633 for (m = mheader->mapi_hook_list; m->hapi_name; ++m)
634 *m->hapi_id = register_hook(m->hapi_name);
635 }
636
637 if(mheader->mapi_hfn_list)
638 {
639 mapi_hfn_list_av1 *m;
640 for (m = mheader->mapi_hfn_list; m->hapi_name; ++m)
641 {
642 int priority = m->priority;
643 if (priority == 0)
644 priority = HOOK_NORMAL;
645 add_hook(m->hapi_name, m->fn);
646 }
647 }
648
649 /* New in MAPI v2 - version replacement */
650 ver = mheader->mapi_module_version ? mheader->mapi_module_version : ircd_version;
651 description = mheader->mapi_module_description;
652 }
653
654 break;
655 default:
656 ilog(L_MAIN, "Module %s has unknown/unsupported MAPI version %d.",
657 mod_displayname, MAPI_VERSION(*mapi_version));
658 sendto_realops_snomask(SNO_GENERAL, L_ALL,
659 "Module %s has unknown/unsupported MAPI version %d.",
660 mod_displayname, *mapi_version);
661 lt_dlclose(tmpptr);
662 rb_free(mod_displayname);
663 return false;
664 }
665
666 if(ver == NULL)
667 ver = unknown_ver;
668
669 if(description == NULL)
670 description = unknown_description;
671
672 mod = rb_malloc(sizeof(struct module));
673 mod->address = tmpptr;
674 mod->version = ver;
675 mod->description = description;
676 mod->core = core;
677 mod->name = rb_strdup(mod_displayname);
678 mod->mapi_header = mapi_version;
679 mod->mapi_version = MAPI_VERSION(*mapi_version);
680 mod->origin = origin;
681 mod->path = rb_strdup(path);
682 rb_dlinkAdd(mod, &mod->node, &module_list);
683
684 if(warn)
685 {
686 const char *o;
687
688 switch (origin)
689 {
690 case MAPI_ORIGIN_EXTENSION:
691 o = "extension";
692 break;
693 case MAPI_ORIGIN_CORE:
694 o = "core";
695 break;
696 default:
697 o = "unknown";
698 break;
699 }
700
701 sendto_realops_snomask(SNO_GENERAL, L_ALL,
702 "Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at %p",
703 mod_displayname, ver, MAPI_VERSION(*mapi_version), o, description,
704 (void *) tmpptr);
705 ilog(L_MAIN, "Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at %p",
706 mod_displayname, ver, MAPI_VERSION(*mapi_version), o, description, (void *) tmpptr);
707 }
708 rb_free(mod_displayname);
709 return true;
710 }
711
712 void
713 modules_do_reload(void *info_)
714 {
715 struct modreload *info = info_;
716 struct module *mod;
717 int check_core;
718 int origin;
719 char *m_bn = rb_basename(info->module);
720 char *path;
721 struct Client *source_p = find_id(info->id);
722
723 if((mod = findmodule_byname(m_bn)) == NULL)
724 {
725 if (source_p) sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
726 rb_free(info);
727 rb_free(m_bn);
728 return;
729 }
730
731 origin = mod->origin;
732 check_core = mod->core;
733 path = rb_strdup(mod->path);
734
735 mod_remember_clicaps();
736
737 if(unload_one_module(m_bn, true) == false)
738 {
739 if (source_p) sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
740 rb_free(info);
741 rb_free(m_bn);
742 rb_free(path);
743 return;
744 }
745
746 if((load_a_module(path, true, origin, check_core) == false) && check_core)
747 {
748 sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
749 "Error reloading core module: %s: terminating ircd", m_bn);
750 ilog(L_MAIN, "Error loading core module %s: terminating ircd", m_bn);
751 exit(0);
752 }
753
754 mod_notify_clicaps();
755
756 rb_free(info);
757 rb_free(m_bn);
758 rb_free(path);
759 }
760
761 void
762 modules_do_restart(void *unused)
763 {
764 unsigned int modnum = 0;
765 rb_dlink_node *ptr, *nptr;
766
767 mod_remember_clicaps();
768
769 RB_DLINK_FOREACH_SAFE(ptr, nptr, module_list.head)
770 {
771 struct module *mod = ptr->data;
772 if(!unload_one_module(mod->name, false))
773 {
774 ilog(L_MAIN, "Module Restart: %s was not unloaded %s",
775 mod->name,
776 mod->core? "(core module)" : "");
777
778 if(!mod->core)
779 sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
780 "Module Restart: %s failed to unload",
781 mod->name);
782 continue;
783 }
784
785 modnum++;
786 }
787
788 load_all_modules(false);
789 load_core_modules(false);
790 rehash(false);
791
792 mod_notify_clicaps();
793
794 sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
795 "Module Restart: %u modules unloaded, %lu modules loaded",
796 modnum, rb_dlink_list_length(&module_list));
797 ilog(L_MAIN, "Module Restart: %u modules unloaded, %lu modules loaded", modnum, rb_dlink_list_length(&module_list));
798 }