aboutsummaryrefslogtreecommitdiffstats
path: root/ircd/modules.c
Commit message (Expand)AuthorAgeFilesLines
* Automatically rehash when modules change conf•••When loading a module that modifies config (add/remove conf items or top conf sections), we now queue a rehash operation so that new config can be immediately applied. A new rb_defer_once() function was added to deduplicate these rehash requests so that at most one rehash will occur regardless of how many modules change conf. Gravatar Ryan Schmidt2026-04-291-0/+7
* Tidy up module loading code•••The existing code had several defects: - Core module file names were hardcoded, while autoloaded non- core module filenames were not. Code that loaded core modules had a different but in some places duplicated structure to the code that loaded autoloaded modules. - Module loading for autoloaded modules happened in dentry order, making it unpredictable from one server to the next, or even across instances of `make install` on the same server. - Module loading for autoloaded modules did not verify that the dentry was a file before trying to load it. - An IRCd start (or a conftest) only printed lines about loading modules mentioned in the configuration file. - The configuration file was parsed before loading core and autoloaded modules, meaning any modules specified in the configuration file would be loaded first. - Once a module was loaded, it was added to the head of the module list, making MODLIST show them in reverse loaded order (newest (re)loaded modules at the top of the list). These are addressed as follows: - We now scan the core and autoload module directories and use this to determine which modules to load. - We now sort the dentries according to their filename before iterating them to load them, making module load order finally deterministic. - We now test if a dentry is actually a file before trying to load it. - We now print a message to the console (if running in foreground or conftest mode) when loading any module, including core and autoloaded modules. - The message printed to the console now has the IRCd module directory prefix stripped from it if it matches. - The configuration file is now parsed after loading core and autoload modules. - The modules are added to the module list in the order that they are loaded. This now makes MODLIST show the order that modules were (re)loaded in. Modifications to two modules are part of this effort: - The autoload module `m_alias` relied upon the alias dict not being NULL when loaded, but this is only the case after the configuration file has been parsed. The module already had a "rehash" hook to destroy all existing aliases and create new ones, so we can just make the module do nothing on load (remove its modinit function) and change it to use the "conf_read_end" hook instead of the "rehash" hook, and it will still create aliases after the configuration file is subsequently parsed. With this modification, there are now no in-tree consumers of the "rehash" hook. - The autoload module `m_services` iterated `service_list` upon loading it, which will now be empty (a no-op) since the module is loaded before configuration file is parsed. This module too handles the configuration file being parsed with a "conf_read_end" hook and takes the appropriate action, so we can just remove this code from its modinit function. All other modules' modinit functions have been audited for behaviour like this; there was nothing of note. Gravatar Aaron Jones2026-03-221-65/+133
* modules: quietly succeed at loading a module if already loaded•••This allows explicitly loading a module in the config so it's available for later config items that might need it, and skips the double load when main loads all modules, which would cause errors Gravatar Doug Freed2023-07-011-0/+4
* modules: clear module list and mod paths in init•••If main is called more than once (like in tests), everything is reinitialized except the loaded module list and module paths, so clear them too so that modules are loaded again and the path list is correct. Gravatar Doug Freed2023-07-011-0/+3
* Remove Windows supportGravatar jailbird7772021-07-301-5/+4
* make more snotes L_NETWIDEGravatar jess2020-11-081-12/+12
* Implement the solanum.chat/identify-msg vendor capGravatar Ed Kellett2020-10-161-0/+1
* Innovation by sedGravatar Ed Kellett2020-10-151-1/+1
* ircd/modules.c: complain to foreground if unable to locate module•••Without this a conftest user has no idea whether the module path is correct or not. [ci skip] Gravatar Aaron Jones2020-07-041-0/+4
* Actually use modules' declared hook prioritiesGravatar Doug Freed2020-07-011-1/+1
* Merge pull request #329 from edk0/reload-by-path•••Reload modules by pathGravatar Aaron Jones2020-06-251-1/+7
|\
| * Reload modules by pathGravatar Ed Kellett2020-06-021-1/+7
* | Merge pull request #330 from edk0/caps-before-init•••modules: create caps before mapi_register()Gravatar Aaron Jones2020-06-101-34/+53
|\ \
| * | modules: create caps before mapi_register()Gravatar Ed Kellett2020-06-021-34/+53
| |/
* / Implement hook prioritiesGravatar Ed Kellett2020-05-011-0/+5
|/
* modules: fix use-after-free when reloadingGravatar Ed Kellett2020-01-021-1/+3
* m_modules: make modreload work like restart•••/modrestart used to be implemented as a normal command and could crash when used remotely because it would reload m_encap, which was on the call stack at the time. This was fixed in 41390bfe5f. However, /modreload has exactly the same problem, so I'm giving it the same treatment. Incidentally: This bug was first discovered in ircd-seven, where the `/mod*` commands themselves live in the core, so m_encap was the only way the crash could happen (and it didn't most of the time, because m_encap would only be moved if you got unlucky). But `/mod*` are in modules in charybdis, so /modrestart would have unloaded the code it was in the middle of executing. With that in mind, I'm not sure how it ever appeared to work. Gravatar Ed Kellett2019-11-171-0/+44
* Deferred capability notifications from modules•••Reloading modules sends CAP DEL followed by an immediate CAP NEW: :staberinde.local CAP * DEL :account-tag :staberinde.local CAP * NEW :account-tag This isn't very nice. /modrestart is particularly bad. In order to avoid doing this, we remember the capability set at the beginning of module operations, compare that with the set afterwards, and report only the differences with CAP {DEL,NEW}. Gravatar Ed Kellett2019-09-071-6/+27
* remove unused variablesGravatar Simon Arlott2017-08-041-1/+0
* Revert "Core modules cannot be unloaded, otherwise bad things happen."•••This reverts commit b5cfad03195d566cd259154d212875fb238f5d80. Gravatar Simon Arlott2017-07-291-3/+0
* When a remote MODRESTART command is received, it will pass through the•••ENCAP module. The ms_encap function is responsible for dispatching the command handler and then the modules will eventually be reloaded. However, if the ENCAP module is reloaded to a different address, the stack now contains the address of a function that no longer exists. Also, in this version of the IRCd, the module restarting functionality was located in a function that is itself located in a module, so things will also go badly if that module is reloaded to a different address, too. Return immediately from the command handler and have the event loop call the function responsible for reloading the modules instead. c.f. release/3.5 commit db05a3621058 Reported-by: mniip (Freenode) Gravatar Aaron Jones2016-12-281-0/+35
* Core modules cannot be unloaded, otherwise bad things happen.•••Additionally some information is logged and passed to the operator conducting a MODRESTART. Gravatar Jason Volk2016-06-211-0/+3
* modules: serious cleanupsGravatar William Pitcock2016-06-181-74/+36
* modules: cleanupsGravatar William Pitcock2016-06-181-5/+3
* minor spring cleaning: remove/relocate duplicate/unused includes & macros•••[ci skip] Gravatar Aaron Jones2016-05-141-2/+0
* modules: use exit(EXIT_FAILURE) on failure•••This will allow service process monitoring to recognise the difference between a shutdown and an error of a -foreground ircd, because only /DIE (or SIGINT) will exit with return code 0. Gravatar Simon Arlott2016-04-251-2/+2
* modules: add missing breakGravatar Simon Arlott2016-04-231-0/+1
* modules: fix up display namesGravatar Elizabeth Myers2016-04-071-25/+30
* modules: move module loading/unloading commands to dedicated module.•••There's no reason to really have these in the main ircd anymore, static modules are dead and aren't coming back. To ensure people don't do something hopelessly retarded, this is a core module. Gravatar Elizabeth Myers2016-04-071-370/+1
* Use rb_* versions of nonportable string functionsGravatar Elizabeth Myers2016-04-051-1/+1
* Announce changed capabilities on module load•••Closes #165 Gravatar Elizabeth Myers2016-04-041-1/+8
* modules: Revert mapi_register() to use ints•••modinit() returns either 0 (success) or -1 (failure) so we can't check for true/false. Gravatar staticfox2016-04-031-1/+1
* boolify calls to rehashGravatar Elizabeth Myers2016-04-031-3/+3
* bool-ify modules stuffGravatar Elizabeth Myers2016-04-031-59/+49
* Clean up module loading a bit.Gravatar Elizabeth Myers2016-04-031-4/+5
* ircd: start staging for relocatable pathsGravatar William Pitcock2016-03-241-6/+6
* Cleanup warningsGravatar Matt Ullman2016-03-211-1/+0
* modules: fix thinkoGravatar William Pitcock2016-03-201-2/+2
* ircd: modules: findmodule_byname(): also check LT_MODULE_EXT hereGravatar William Pitcock2016-03-201-0/+8
* ircd: modules: use LT_MODULE_EXT more consistentlyGravatar William Pitcock2016-03-201-4/+3
* modules: warning cleanupsGravatar William Pitcock2016-03-201-4/+4
* modules: fix stupid GCC false positive warning.•••This invocation of strlen is on a constant string and should be folded by any sane compiler (GCC included), but it warns anyway because GCC is stupid. Gravatar Elizabeth Myers2016-03-181-2/+2
* modules: can .la suffix.•••.la archives are prohibited by most Linux distributions because they clutter up the linker. They may get caught up as victims in scripts that purge .la files. Besides, .la files don't matter for simple loadable modules on most systems. So, what we do now instead is just use the platform suffix detected by libtool. Gravatar Elizabeth Myers2016-03-121-9/+15
* More bool conversionsGravatar Elizabeth Myers2016-03-091-1/+1
* Merge branch 'master' of github.com:charybdis-ircd/charybdis into elizafox-cl...Gravatar Elizabeth Myers2016-03-091-3/+2
|\
| * ircd: fix up some iwarn() calls which referred to L_MAINGravatar William Pitcock2016-03-081-2/+1
| * modules: using labs() for date math is unsafeGravatar William Pitcock2016-03-081-1/+1
* | Message handlers should return void.•••Also fix up some return values and stuff to use bool (or void if nothing). I just did it whilst I was here. According to jilles, the return value used to signify whether or not the client had exited. This was error-prone and was fixed a long, long time ago, but the return value was left int for historical reasons. Since the return type is not used (and has no clear use case anyway), it's safe to just get rid of it. Gravatar Elizabeth Myers2016-03-091-169/+162
|/
* Add ircd serials to AV2.Gravatar Elizabeth Myers2016-03-071-2/+25
* modules: show module provenance in modlistGravatar Elizabeth Myers2016-03-061-7/+21