summaryrefslogtreecommitdiff
path: root/src/libsystemd
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: use returned value from log_*_errno()Yu Watanabe2018-08-071-4/+2
|
* tree-wide: shorten error logging a bitYu Watanabe2018-08-071-4/+2
| | | | Continuation of 4027f96aa08c73f109aa46b89842ca0e25c9c0e9.
* sd-bus: verify destination and sender values when settingZbigniew Jędrzejewski-Szmek2018-08-021-0/+2
| | | | | | We would verify destination e.g. in sd_bus_message_new_call, but allow setting any value later on with sd_bus_message_set_destination. I assume this check was omitted not on purpose.
* sd-resolve: workaround for structured initialization to nested structsYu Watanabe2018-07-291-12/+13
| | | | | | | | | | | | | | | | | | When a nested struct is initialized by structured initializer, then padding space is not cleared by zero. So, before setting values, this makes explicitly set zero including padding. This fixes the following false positive warning by valgrind: ``` ==492== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s) ==492== at 0x56D0CF7: sendmsg (in /usr/lib64/libpthread-2.27.so) ==492== by 0x4FDD3C5: sd_resolve_getaddrinfo (sd-resolve.c:975) ==492== by 0x110B9E: manager_connect (timesyncd-manager.c:879) ==492== by 0x10B729: main (timesyncd.c:165) ==492== Address 0x1fff0008f1 is on thread 1's stack ==492== in frame #1, created by sd_resolve_getaddrinfo (sd-resolve.c:928) ==492== ```
* sd-resolve: use structured initialization at more placesYu Watanabe2018-07-291-25/+28
|
* sd-login: let's also make sd-login understand ".host"Lennart Poettering2018-07-251-10/+17
| | | | if sd-bus and machined grok it, then sd-login should grok it too.
* sd-bus: allow connecting to the pseudo-container ".host"Lennart Poettering2018-07-251-2/+2
| | | | | | | | machined exposes the pseudo-container ".host" as a reference to the host system, and this means "machinectl login .host" and "machinectl shell .host" get your a login/shell on the host. systemd-run currently doesn't allow that. Let's fix that, and make sd-bus understand ".host" as an alias for connecting to the host system.
* sd-device: include sd-device.h in device-internal.hYu Watanabe2018-07-241-0/+2
|
* tree-wide: drop empty lines in commentsYu Watanabe2018-07-231-1/+0
|
* sd-bus: make bus_slot_disconnect() also unref the slot objectYu Watanabe2018-07-183-25/+15
| | | | | | | | | | | This makes bus_slot_disconnect() unref the slot object from bus when `unref == true` and it is floating, as the function removes the reference from the relevant bus object. This reverts 20d4ee2cbc21e0c4d2dd6c01d5a18a4cf0d98222, as it introduces #9604. Fixes #9604.
* bus: add comment to explain assertZbigniew Jędrzejewski-Szmek2018-07-181-1/+1
|
* bus: move BUS_DONT_DESTROY calls after assertsZbigniew Jędrzejewski-Szmek2018-07-182-8/+10
| | | | | | | | | | It's not useful to bump the reference count before checking if the object is NULL. Thanks to d40f5cc498 we can do this ;). Related to https://bugzilla.redhat.com/show_bug.cgi?id=1576084, https://bugzilla.redhat.com/show_bug.cgi?id=1575340, https://bugzilla.redhat.com/show_bug.cgi?id=1575350. I'm not sure why those two people hit this code path, while most people don't. At least we won't abort.
* bus-socket: Fix line_begins() to accept word matching full stringFilipe Brandenburger2018-07-171-4/+1
| | | | | | | | | | | | | | | | | | | | | | The switch to memory_startswith() changed the logic to only look for a space or NUL byte after the matched word, but matching the full size should also be acceptable. This changed the behavior of parsing of "AUTH\r\n", where m will be set to 4, since even though the word will match, the check for it being followed by ' ' or NUL will make line_begins() return false. Tested: - Using netcat to connect to the private socket directly: $ echo -ne '\0AUTH\r\n' | sudo nc -U /run/systemd/private REJECTED EXTERNAL ANONYMOUS - Running the Ignition blackbox test: $ sudo sh -c 'PATH=$PWD/bin/amd64:$PATH ./tests.test' PASS Fixes: d27b725abf64a19a6b2f99332b663f17ad046771
* sd-bus: make BUS_DEFAULT_TIMEOUT configurableYu Watanabe2018-07-164-8/+50
| | | | | | | This adds sd_bus_{get,set}_method_call_timeout(). If the timeout is not set or set to 0, then the timeout value is parsed from $SYSTEMD_BUS_TIMEOUT= environment variable. If the environment variable is not set, then built-in timeout is used.
* sd-bus: unref slot->match_callback.install_slot when slot is disconnectedYu Watanabe2018-07-131-1/+4
| | | | | | | | | When a slot is disconnected, then slot->match_callback.install_slot is also disconnected. So, bus_slot_disconnect() removes the install_slot from the list of slots in bus, although it is a floating object. This makes install_slot unreffed from bus when it is disconnected. Fixes #9505 and #9510.
* tree-wide: add a space after (void)Yu Watanabe2018-07-033-6/+6
|
* sd-bus: publicize sd_bus_message_readv()Violet Halo2018-06-292-3/+9
| | | | | | | | The D-Bus library supplies a va_list variant of `sd_bus_message_append()` called `sd_bus_message_appendv()`, but failed to provide a va_list variant of its opposite, `sd_bus_message_read()`. This commit publicizes a previously static function as `sd_bus_message_readv()`.
* tree-wide: drop double newlineYu Watanabe2018-06-2931-31/+0
|
* tree-wide: drop empty commentsYu Watanabe2018-06-2965-130/+0
|
* tree-wide: use 'signed int' instead of 'int' for bit field variablesYu Watanabe2018-06-281-1/+1
| | | | Suggested by LGTM: https://lgtm.com/rules/1506024027114/
* sd-bus: stop using the result of an assignment as an operand of &&Evegeny Vereshchagin2018-06-281-1/+1
| | | | | | This makes OBJECT_PATH_FOREACH_PREFIX consistent with PATH_FOREACH_PREFIX and also fixes 7 alerts reported by LGTM at https://lgtm.com/projects/g/systemd/systemd/snapshot/ac0a08700344a5690803df8dd80e8bb5013184a5/files/src/libsystemd/sd-bus/bus-objects.c?sort=name&dir=ASC&mode=heatmap&showExcluded=true#V1383
* sd-bus: fix implicit downcast of bitfield reported by LGTMYu Watanabe2018-06-271-1/+1
|
* tree-wide: drop copyright lines for more authorsZbigniew Jędrzejewski-Szmek2018-06-221-3/+0
| | | | Acks in https://github.com/systemd/systemd/issues/9320.
* tree-wide: drop MSG_NOSIGNAL flag from recvmsg() invocationsLennart Poettering2018-06-201-2/+2
| | | | | | | | MSG_NOSIGNAL is only defined for sendmsg(), not for recvmsg(), hence let's drop it's use, in particular as it appears to create problems on older kernels. See: https://lists.freedesktop.org/archives/systemd-devel/2018-June/040869.html
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-2023-72/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* sd-bus: fix typo in commentYu Watanabe2018-06-191-1/+1
|
* Correct a number of trivial typos.Chris Lamb2018-06-181-1/+1
|
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-143-8/+0
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-1425-31/+31
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-1468-68/+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: use proper unicode © instead of (C) where we canLennart Poettering2018-06-142-2/+2
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-1492-184/+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.
* resolve: rename PrivateDNS to DNSOverTLSIwan Timmer2018-06-141-2/+2
| | | PrivateDNS is not considered a good name for this option, so rename it to DNSOverTLS
* tree-wide: unify how we define bit mak enumsLennart Poettering2018-06-121-2/+2
| | | | | | Let's always write "1 << 0", "1 << 1" and so on, except where we need more than 31 flag bits, where we write "UINT64(1) << 0", and so on to force 64bit values.
* resolve: make PrivateDNS configurable per linkIwan Timmer2018-06-111-0/+4
| | | Like with DNSSec, make PrivateDNS configurable per link, so you can have trusted and untrusted links.
* Merge pull request #9157 from poettering/unit-config-load-errorZbigniew Jędrzejewski-Szmek2018-06-112-0/+2
|\ | | | | introduce a new "bad-setting" unit load state in order to improve "systemctl status" output when bad settings are used
| * core: introduce a new load state "bad-setting"Lennart Poettering2018-06-112-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since bb28e68477a3a39796e4999a6cbc6ac6345a9159 parsing failures of certain unit file settings will result in load failures of units. This introduces a new load state "bad-setting" that is entered in precisely this case. With this addition error messages on bad settings should be a lot more explicit, as we don't have to show some generic "errno" error in that case, but can explicitly say that a bad setting is at fault. Internally this unit load state is entered as soon as any configuration loader call returns ENOEXEC. Hence: config parser calls should return ENOEXEC now for such essential unit file settings. Turns out, they generally already do. Fixes: #9107
* | networkd-link: add support to configure CAN interfacesHiram van Paassen2018-06-092-0/+9
|/ | | | This patch adds support for kind "can". Fixes: #4042.
* Merge pull request #9221 from poettering/bus-track-destroyZbigniew Jędrzejewski-Szmek2018-06-083-6/+51
|\ | | | | add sd_bus_track and sd_event_source destroy callbacks too
| * sd-event: add destroy callback logic to sd-event tooLennart Poettering2018-06-072-1/+24
| | | | | | | | | | This adds what has been added to sd_bus_slot and sd_bus_track to sd_event too.
| * sd-bus: also add destroy callbacks to sd_bus_track objectsLennart Poettering2018-06-072-5/+27
| | | | | | | | | | This augments previous work for this for sd_bus_slot objects, and adds the same concept to sd_bus_track objects, too.
* | Merge pull request #9165 from ssahani/networkd-netdevsimLennart Poettering2018-06-072-0/+2
|\ \ | |/ |/| networkd: introduce netdev "Netdevsim" Driver
| * networkd: introduce netdev "Netdevsim" DriverSusant Sahani2018-06-032-0/+2
| | | | | | | | | | | | This "netdevsim" as implied by the name is a tool for network developers and is a simulator. This simulated networking device is used for testing various networking APIs and at this time is particularly focused on testing hardware offloading related interfaces.
* | bus: optionally call a callbacks for cleanupZbigniew Jędrzejewski-Szmek2018-06-063-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a function sd_bus_slot_set_destroy_callback() to set a function which can free userdata or perform other cleanups. sd_bus_slot_get_destory_callback() queries the callback, and is included for completeness. Without something like this, for floating asynchronous callbacks, which might be called or not, depending on the sequence of events, it's hard to perform resource cleanup. The alternative would be to always perform the cleanup from the caller too, but that requires more coordination and keeping of some shared state. It's nicer to keep the cleanup contained between the callback and the function that requests the callback.
* | sd-event: use structure initialization instead of new0() where possibleLennart Poettering2018-06-061-17/+38
| |
* | sd-event: add test for the new sd_event_add_inotify() APILennart Poettering2018-06-061-1/+147
| | | | | | | | | | | | This tests a couple of corner cases of the sd-event API including changing priorities of existing event sources, as well as overflow conditions of the inotify queue.
* | sd-event: add new API for subscribing to inotify eventsLennart Poettering2018-06-062-1/+817
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new call sd_event_add_inotify() which allows watching for inotify events on specified paths. sd-event will try to minimize the number of inotify fds allocated, and will try to add file watches to the same inotify fd objects as far as that's possible. Doing this kind of inotify object should optimize behaviour in programs that watch a limited set of mostly independent files as in most cases a single inotify object will suffice for watching all files. Traditionally, this kind of coalescing logic (i.e. that multiple event sources are implemented on top of a single inotify object) was very hard to do, as the inotify API had serious limitations: it only allowed adding watches by path, and would implicitly merge watches installed on the same node via different path, without letting the caller know about whether such merging took place or not. With the advent of O_PATH this issue can be dealt with to some point: instead of adding a path to watch to an inotify object with inotify_add_watch() right away, we can open the path with O_PATH first, call fstat() on the fd, and check the .st_dev/.st_ino fields of that against a list of watches we already have in place. If we find one we know that the inotify_add_watch() will update the watch mask of the existing watch, otherwise it will create a new watch. To make this race-free we use inotify_add_watch() on the /proc/self/fd/ path of the O_PATH fd, instead of the original path, so that we do the checking and watch updating with guaranteed the same inode. This approach let's us deal safely with inodes that may appear under various different paths (due to symlinks, hardlinks, bind mounts, fs namespaces). However it's not a perfect solution: currently the kernel has no API for changing the watch mask of an existing watch -- unless you have a path or fd to the original inode. This means we can "merge" the watches of the same inode of multiple event sources correctly, but we cannot "unmerge" it again correctly in many cases, as access to the original inode might have been lost, due to renames, mount/unmount, or deletions. We could in theory always keep open an O_PATH fd of the inode to watch so that we can change the mask anytime we want, but this is highly problematics, as it would consume too many fds (and in fact the scarcity of fds is the reason why watch descriptors are a separate concepts from fds) and would keep the backing mounts busy (wds do not keep mounts busy, fds do). The current implemented approach to all this: filter in userspace and accept that the watch mask on some inode might be higher than necessary due to earlier installed event sources that might have ceased to exist. This approach while ugly shouldn't be too bad for most cases as the same inodes are probably wacthed for the same masks in most implementations. In order to implement priorities correctly a seperate inotify object is allocated for each priority that is used. This way we get separate per-priority event queues, of which we never dequeue more than a few events at a time. Fixes: #3982
* | sd-event: voidify more thingsLennart Poettering2018-06-061-1/+1
| |
* | sd-event: propagate errors from source_set_pending() in all casesLennart Poettering2018-06-061-5/+14
| |
* | sd-event: drop pending events when we turn off/on an event sourceLennart Poettering2018-06-061-0/+15
| |