summaryrefslogtreecommitdiffstats
path: root/src/sysctl (follow)
Commit message (Collapse)AuthorAgeFilesLines
* sysctl: downgrade warning about excluded keysZbigniew Jędrzejewski-Szmek2021-02-171-1/+1
| | | | | | | | | | | | Our own config generates logs like this: systemd-sysctl[1280]: Not setting net/ipv4/conf/all/rp_filter (explicit setting exists). systemd-sysctl[1280]: Not setting net/ipv4/conf/default/rp_filter (explicit setting exists). systemd-sysctl[1280]: Not setting net/ipv4/conf/all/accept_source_route (explicit setting exists). systemd-sysctl[1280]: Not setting net/ipv4/conf/default/accept_source_route (explicit setting exists). systemd-sysctl[1280]: Not setting net/ipv4/conf/all/promote_secondaries (explicit setting exists). systemd-sysctl[1280]: Not setting net/ipv4/conf/default/promote_secondaries (explicit setting exists). There is no error and nothing really to see.
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-01-311-1/+1
| | | | It may be useful when debugging daemons.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-4/+3
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-081-2/+1
|
* journalctl,elsewhere: make sure --file=foo fails with sane error msg if foo ↵Lennart Poettering2020-05-191-1/+1
| | | | | | | | | | | | | is not readable It annoyed me for quite a while that running "journalctl --file=…" on a file that is not readable failed with a "File not found" error instead of a permission error. Let's fix that. We make this work by using the GLOB_NOCHECK flag for glob() which means that files are not accessible will be returned in the array as they are instead of being filtered away. This then means that our later attemps to open the files will fail cleanly with a good error message.
* sysctl: check correct error codeLennart Poettering2020-05-141-1/+1
|
* sysctl: fix segfaultYu Watanabe2020-02-061-1/+1
| | | | Fixes #14801.
* sysctl: add glob syntax to sysctl.d filesZbigniew Jędrzejewski-Szmek2020-02-041-51/+117
| | | | | | | | | This is intended for net.*.conf.*.foo files. Setting just "default" is not very useful because any interfaces present before systemd-sysctl is invoked are not affected. Setting "all" is too harsh, because the kernel takes the stronger of the device-specific setting and the "all" value, so effectively having a weaker setting for specific interfaces is not possible. Let's add a way in which can set "default" first and then all the others without "all".
* sysctl: downgrade message when we have no permissionZbigniew Jędrzejewski-Szmek2020-01-161-7/+10
| | | | | | | | | | | | | We need to run sysctl also in containers, because the network subtree is namespaces and may legitimately be writable. But logging all "errors" at notice level creates unwanted noise. Also downgrade message about missing sysctls to log_info. This might also be relatively common when configuration is targeted at different kernel versions. With log_debug it'll still end up in the logs, but isn't really worth of "notice" most of the time. https://bugzilla.redhat.com/show_bug.cgi?id=1609806
* sysctl: move hashmap allocation out of main functionZbigniew Jędrzejewski-Szmek2020-01-161-10/+9
| | | | | This allocation is a low level detail, and it seems nicer to keep it out of run().
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-031-1/+0
|
* sysctl: if options are prefixed with "-" ignore write errorsLennart Poettering2019-07-261-34/+80
|
* sysctl: reset 'r' only where neededLennart Poettering2019-07-261-2/+2
|
* sysctl: switch to log_syntax()Lennart Poettering2019-07-261-2/+1
| | | | | With @keszybz' recent work this will give us clickable links in the journalctl output.
* tree-wide: get rid of strappend()Lennart Poettering2019-07-121-1/+1
| | | | | It's a special case of strjoin(), so no need to keep both. In particular as typing strjoin() is even shoert than strappend().
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-1/+2
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* sysctl: Don't pass null directive argument to '%s'Khem Raj2018-12-171-1/+1
| | | | | | | | value pointer here is always NULL but subsequent use of that pointer with a %s format will always be NULL, printing p instead would be a valid string Signed-off-by: Khem Raj <raj.khem@gmail.com>
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-4/+3
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-1/+1
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* basic/main-func: also close the pager automaticallyZbigniew Jędrzejewski-Szmek2018-11-201-15/+7
| | | | | | We generally want to close the pager last. This patch closes the pager last, after the static destuctor calls. This means that they can do logging and such like during normal program runtime.
* sysctl: use STATIC_DESTRUCTOR_REGISTER() to free arg_prefixesLennart Poettering2018-11-201-2/+2
|
* sysctl: use _cleanup_ in one more occasionLennart Poettering2018-11-201-2/+1
|
* sysctl: port to use DEFINE_MAIN_FUNCTION()Lennart Poettering2018-11-201-2/+5
|
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* basic/pager: convert the pager options to a flags argumentZbigniew Jędrzejewski-Szmek2018-11-141-3/+3
| | | | | Pretty much everything uses just the first argument, and this doesn't make this common pattern more complicated, but makes it simpler to pass multiple options.
* tree-wide: add clickable man page link to all --help textsLennart Poettering2018-08-201-4/+15
| | | | | | | | | | This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* binfmt,sysctl,sysuers,tmpfiles: add auto-paging for --cat-config commandsLennart Poettering2018-06-131-0/+13
| | | | | The output of these commands is really long, and already enriched with color. Let's add auto-paging to make this easier to digest.
* Eliminate config_dirs vars which hold a static strvZbigniew Jędrzejewski-Szmek2018-05-071-4/+2
|
* sysctl: add --cat-configZbigniew Jędrzejewski-Szmek2018-04-271-7/+26
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* tree-wide: use path_hash_ops instead of string_hash_ops whenever we key by a ↵Lennart Poettering2018-02-121-4/+4
| | | | | | path Let's make use of our new hash_ops!
* Use read_line() and LONG_LINE_MAX to read values configuration files.Tiago Salem Herrmann2017-12-131-7/+7
|
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* exec-util,conf-files: skip non-executable files in execute_directories()Lennart Poettering2017-09-131-1/+1
| | | | Fixes: #6787
* tree-wide: use path_startswith() rather than startswith() where ever that's ↵Lennart Poettering2017-08-091-1/+1
| | | | | | | appropriate When checking path prefixes we really should use the right APIs, just in case people add multiple slashes to their paths...
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* sysctl: minor simplificationLennart Poettering2016-11-021-2/+2
| | | | Let's place only one ternary operator.
* sysctl: no need to check for eof twiceLennart Poettering2016-11-021-1/+1
| | | | | Let's only check for eof once after the fgets(). There's no point in checking EOF before the first read, and twice in each loop.
* sysctl: when failing to process a config line, show line nrLennart Poettering2016-11-021-2/+5
|
* sysctl: split out condition check into its own functionLennart Poettering2016-11-021-12/+20
| | | | This way, we can get rid of a label/goto.
* sysctl: do not fail systemd-sysctl.service if /proc/sys is mounted read-onlyLennart Poettering2016-11-021-5/+12
| | | | | | | | | | Let's make missing write access to /proc/sys non-fatal to the sysctl service. This is a follow-up to 411e869f497c7c7bd0688f1e3500f9043bc56e48 which altered the condition for running the sysctl service to check for /proc/sys/net being writable, accepting that /proc/sys might be read-only. In order to ensure the boot-up stays clean in containers lower the log level for the EROFS errors generated due to this.
* sysctl: configure kernel parameters in the order they occur in each sysctl ↵HATAYAMA Daisuke2016-09-241-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | configuration files (#4205) Currently, systemd-sysctl command configures kernel parameters in each sysctl configuration files in random order due to characteristics of iterator of Hashmap. However, kernel parameters need to be configured in the order they occur in each sysctl configuration files. - For example, consider fs.suid_coredump and kernel.core_pattern. If fs.suid_coredump=2 is configured before kernel.core_pattern= whose default value is "core", then kernel outputs the following message: Unsafe core_pattern used with suid_dumpable=2. Pipe handler or fully qualified core dump path required. Note that the security issue mentioned in this message has already been fixed on recent kernels, so this is just a warning message on such kernels. But it's still confusing to users that this message is output on some boot and not output on another boot. - I don't know but there could be other kernel parameters that are significant in the order they are configured. - The legacy sysctl command configures kernel parameters in the order they occur in each sysctl configuration files. Although I didn't find any official specification explaining this behavior of sysctl command, I don't think there is any meaningful reason to change this behavior, in particular, to the random one. This commit does the change by simply using OrderedHashmap instead of Hashmap.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* defs: rework CONF_DIRS_NULSTR() macroLennart Poettering2015-11-101-1/+1
| | | | | | | | | | | | The macro is generically useful for putting together search paths, hence let's make it truly generic, by dropping the implicit ".d" appending it does, and leave that to the caller. Also rename it from CONF_DIRS_NULSTR() to CONF_PATHS_NULSTR(), since it's not strictly about dirs that way, but any kind of file system path. Also, mark CONF_DIR_SPLIT_USR() as internal macro by renaming it to _CONF_PATHS_SPLIT_USR() so that the leading underscore indicates that it's internal.
* treewide: apply errno.cocciMichal Schmidt2015-11-091-2/+1
| | | | with small manual cleanups for style.
* util-lib: move CONF_DIRS_NULSTR definition to def.hLennart Poettering2015-11-031-0/+1
| | | | | | After all, this is not some compiler or C magic, but something very specific to how systemd works, hence let's move it into def.h, and out of macro.h
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.