summaryrefslogtreecommitdiffstats
path: root/src/libsystemd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #18685 from poettering/network-type-tweaksLennart Poettering2021-02-183-8/+8
|\ | | | | sd-network.h type tweaks
| * network: suffix types with _t in public headersLennart Poettering2021-02-183-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | Apparently, in our current public headers (i.e. those called sd-*.h) we suffixed typedefs that we use as values with _t, but we didn't do this for enum typedefs. Fix that while this stuff is not actually public yet. With this scheme "value typedefs" now end systematically in _t, and "object typedefs" (i.e. structures that are typically passed around via pointers and not values) do not. No code changes, just some renaming.
* | Merge pull request #18546 from poettering/sd-device-actionLennart Poettering2021-02-185-76/+69
|\ \ | | | | | | export sd_device_get_action() API + more
| * | sd-device: add sd_device_get_action() + sd_device_get_seqnum() + ↵Lennart Poettering2021-02-185-73/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sd_device_new_from_stat_rdev() To make sd-device properly usable for all programs we need to provide an API for the "action" field of an event, it's one of the most relevant ones, and it was so far missing. This also adds sd_device_get_seqnum(), which isn't that interesting, except for generating pretty debug output, which we use it ourselves for. This also makes device_new_from_stat_rdev() public, as it is truly useful, as we can see in our own uses of it, and I think is fairly generic to show up in the public APIs.
| * | sd-device: don't compare pointers with numeric zeroLennart Poettering2021-02-181-3/+8
| |/ | | | | | | Our coding style says no to this.
* / journald: when we fail to add a new entry to a journal, return the seqnoLennart Poettering2021-02-181-14/+46
|/ | | | Fixes: #18005
* journal-file: fix archiving offline journalsVito Caputo2021-02-161-2/+7
| | | | | | | | | | | | The existing set_offline() short-circuit erroneously included when f->archive was true and header->state was STATE_OFFLINE. This commit makes the short-circuit f->archive aware, so it will only catch scenarios where there's not an offlining in progress and the header state matches the target state of either archived or offline. Fixes https://github.com/systemd/systemd/issues/17770
* netlink: introduce sd_netlink_message_has_flag()Yu Watanabe2021-02-161-5/+31
|
* Merge pull request #18631 from yuwata/sd-netlink-fix-assertionsLennart Poettering2021-02-161-30/+15
|\ | | | | sd-netlink: update assertions and drop unused functions
| * netlink: drop sd_rtnl_message_{route,nexthop}_set_family()Yu Watanabe2021-02-161-26/+0
| | | | | | | | The family is already set when the message is created.
| * netlink: fix assertionsYu Watanabe2021-02-161-4/+15
| |
* | Merge pull request #18616 from keszybz/argv-fuzzer-quick-fixLennart Poettering2021-02-164-11/+11
|\ \ | | | | | | fuzz-systemctl-parse-argv: avoid "leak" of bus object
| * | Rename strbuf_cleanup to strbuf_freeZbigniew Jędrzejewski-Szmek2021-02-162-2/+2
| | | | | | | | | | | | It frees the whole object.
| * | tree-wide: reset the cleaned-up variable in cleanup functionsZbigniew Jędrzejewski-Szmek2021-02-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the cleanup function returns the appropriate type, use that to reset the variable. For other functions (usually the foreign ones which return void), add an explicit value to reset to. This causes a bit of code churn, but I think it might be worth it. In a following patch static destructors will be called from a fuzzer, and this change allows them to be called multiple times. But I think such a change might help with detecting unitialized code reuse too. We hit various bugs like this, and things are more obvious when a pointer has been set to NULL. I was worried whether this change increases text size, but it doesn't seem to: -Dbuildtype=debug: before "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 4494520 Feb 16 15:06 build/systemd* after "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 4494576 Feb 16 15:10 build/systemd* now: -rwxrwxr-x 1 zbyszek zbyszek 4117672 Feb 16 14:36 build/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 4494640 Feb 16 15:15 build/systemd* -Dbuildtype=release: before "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:09 build-rawhide/systemd* after "tree-wide: return NULL from freeing functions": -rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:10 build-rawhide/systemd* now: -rwxrwxr-x 1 zbyszek zbyszek 5252256 Feb 14 14:47 build-rawhide/libsystemd.so.0.30.0* -rwxrwxr-x 1 zbyszek zbyszek 1834184 Feb 16 15:16 build-rawhide/systemd* I would expect that the compiler would be able to elide the setting of a variable if the variable is never used again. And this seems to be the case: in optimized builds there is no change in size whatsoever. And the change in size in unoptimized build is negligible. Something strange is happening with size of libsystemd: it's bigger in optimized builds. Something to figure out, but unrelated to this patch.
| * | tree-wide: return NULL from freeing functionsZbigniew Jędrzejewski-Szmek2021-02-162-5/+5
| |/ | | | | | | | | | | I started working on this because I wanted to change how DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's nice to make make things more consistent and predictable.
* | netlink: add nexthop related typesYu Watanabe2021-02-161-0/+8
| |
* | sd-netlink: add RTA_NH_ID attribute supportYu Watanabe2021-02-161-1/+2
|/
* Merge pull request #18481 from keszybz/rpm-restart-post-transZbigniew Jędrzejewski-Szmek2021-02-162-48/+56
|\ | | | | Restart units after the rpm transaction
| * sd-bus: standarize on NULL for empty signature in method callsZbigniew Jędrzejewski-Szmek2021-02-121-45/+44
| | | | | | | | | | We would use sometimes "" and sometimes NULL. They are equivalent, so let's use NULL everywhere, except for a two places in tests.
| * sd-bus: extend sd_bus_message_read_strv() to paths and signaturesZbigniew Jędrzejewski-Szmek2021-02-121-3/+12
| | | | | | | | | | | | | | It's rather convenient to be able to read all three types with this function. Strictly speaking this change is not fully compatible, in case someone was relying on sd_bus_message_read_strv() returning an error for anything except "as", but I hope nobody was doing that.
* | resolved: refuse sending packets to our own stub listenersLennart Poettering2021-02-142-0/+2
| | | | | | | | | | | | | | | | | | A previous commit made sure that when one of our own packets is looped back to us, we ignore it. But let's go one step further, and refuse operation if we notice the server we talk to is our own. This way we won't generate unnecessary traffic and can return a cleaner error. Fixes: #17413
* | sd-journal: add forgotten unmap in error pathZbigniew Jędrzejewski-Szmek2021-02-111-4/+5
| | | | | | | | | | | | Bug introduced in 4b5bc5396c090ee41c45cab9052372d296c4a2f4 :( Coverity CID#1444709.
* | Merge pull request #18545 from poettering/netlink-seqno-fixZbigniew Jędrzejewski-Szmek2021-02-112-38/+62
|\ \ | | | | | | sd-netlink seqnum fixes
| * | sd-netlink: spread out sequence numbers a bitLennart Poettering2021-02-101-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | An (imperfect) fix for #14760. This makes collisions unlikely, but still theoretically possible. Fixes: #14760
| * | sd-netlink: reduce indentation levels a bitLennart Poettering2021-02-101-12/+11
| | |
| * | sd-netlink: use getsockopt_int() where appropriateLennart Poettering2021-02-101-5/+2
| | |
| * | sd-netlink: revamp message serial handlingLennart Poettering2021-02-102-16/+26
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Let's use uint32_t everywhere to maintain the seqno, since that's what the kernel does. Prviously in the reply_callback logic we used 64bit, for no apparent reason. Using 32bit also provides us with the benefit that we can avoid using uint64_hash_ops, and can use trivial_hash_ops instead for the reply hashmap, so that we can store the seqno in the key pointer directly. While we are at it, let's make sure we never run into serial collisions internally (32bit is a lot, but not that much), and let's put a limit on outstanding serials, to catch programming errors.
* | Merge pull request #17823 from poettering/resolved-just-bypassZbigniew Jędrzejewski-Szmek2021-02-112-0/+2
|\ \ | |/ |/| resolved: just the dnssec bypass logic
| * resolved: add support for answering DNSSEC questions on the stubLennart Poettering2021-02-092-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This substantially beefs up the local DNS stub feature set in order to allow local clients to do DNSSEC validation through the stub. Previously we'd return NOTIMP if we'd get a DO or DO+CD lookup. With this change we'll instead: 1. If we get DO+CD requests (i.e. DNSSEC with no local checking) we'll proxy DNS queries and response mostly unmodified to/from upstream DNS servers if possible (this is called "bypass" mode). We will patch in new request IDs, (and patch them back out on reply), so that we can sanely keep track of things. We'll also maintain a minimal local cache for such lookups, always keeping the whole DNS packets in it (if we reply from cache we'll patch the TTLs of all included RRs). 2. If we get DO requests without CD (i.e. DNSSEC with local checking) we'll resolve and validate locally. In this mode we will not proxy packets, but generate our own. We will however cache the combination of answer RRs (along with their packet section assignments) we got back in the cache, and use this information to generate reply packets from the DNS stub. In both cases: if we determine a lookup is to be answered from LLMNR or mDNS we'll always revert to non-DNSSEC, non-proxy operation as before. Answers will lack the DO bit then, since the data cannot be validated via DNSSEC by the clients. To make this logic more debuggable, this also adds query flags for turning off RR sources. i.e. cache/network/zone/trust anchor/local synthesis may now be disabled individually for each lookup. The cache is substantially updated to make all this work: in addition to caching simple RRs for lookup RR keys, we'll now cache the whole packets and the whole combination of RRs, so that we can answer DO and DO+CD replies sensibly according to the rules described above. This sounds wasteful, but given that the DnsResourceRecord/DnsResourceKey/DnsAnswer/DnsPacket objects are all ref-counted and we try to merge references the actual additional memory used should be limited (but this might be something to optimize further later on). To implement classic RR key lookups and new-style packet proxy lookups (i.e. the ones necessary for DO+CD packet proxying, as described above) DnsTransaction and DnsQuery objects now always maintain either a DnsResourceKey/DnsQuestion as lookup key or a DnsPacket for "bypass" mode. Fixes: #4621 #17218
* | tree-wide: propagate error code from _from_string() functionsZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
| | | | | | | | Now that we know we have something useful, no need to make an answer up.
* | tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-109-14/+16
| | | | | | | | | | | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617. This does not touch anything exposed in src/systemd. Changing the defines there would be a compatibility break. Note that tests are broken after this commit. They will be fixed in the next one.
* | sd-bus: drop some bitfields in sd_bus_slotZbigniew Jędrzejewski-Szmek2021-02-101-11/+11
| | | | | | | | | | | | | | | | | | | | | | A hole was/is present after the booleans, so changing them to be one byte each doesn't change the structure size (122 bits on amd64). If we add more stuff later, it might make sense to turn some of those into bitfields again. For now, let's take the easy route. EINVAL fits into type now. Code size it minimally reduced: -rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb 10 14:00 build/libsystemd.so.0.30.0 -rwxrwxr-x 1 zbyszek zbyszek 4109712 Feb 10 14:01 build/libsystemd.so.0.30.0
* | sd-netlink: pahole optimization of sd_netlink_slotZbigniew Jędrzejewski-Szmek2021-02-101-2/+2
| | | | | | | | | | | | | | | | | | | | By rearranging the fields, we can avoid one of the holes (on amd64). By adding more space for .type, -EINVAL can be used as a value later on. The structure is reduced from 96 to 88 bytes (on amd64). Text size is also smaller: -rwxrwxr-x 1 zbyszek zbyszek 4109832 Feb 9 19:50 build/libsystemd.so.0.30.0 -rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb 9 19:51 build/libsystemd.so.0.30.0
* | sd-event: drop one bitfield from sd_event_sourceZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
| | | | | | | | | | pahole analysis confirms that the structure size does not change (there was/is a hole after the sequence of bitfields anyway).
* | Add comma in structured initialization in a few placesZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
|/ | | | It just looks nicer…
* hostname: introduce two bus errors for updating fileYu Watanabe2021-02-092-0/+4
|
* bus-error: align error definitionsYu Watanabe2021-02-091-104/+105
|
* Merge pull request #18331 from yuwata/test-udev-event-spawnZbigniew Jędrzejewski-Szmek2021-02-081-14/+30
|\ | | | | udev: add tests for udev_event_spawn()
| * sd-event: retrieve more events when epoll_wait() returns number equivalent ↵Yu Watanabe2021-02-011-14/+30
| | | | | | | | | | | | | | | | to the buffer size When epoll_wait() returns number equivalent to the buffer size, there may exist remaining events which may have higher priority. To make priority sorting correctly, let's retrieve all events.
* | network,udev: move TransmitQueues=/ReceiveQueues= from .network to .linkYu Watanabe2021-02-032-5/+36
|/ | | | | | | | | As the settings are mostly hardware setup, and merely see from network layer. See also discussions in https://github.com/systemd/systemd/pull/18170#issuecomment-758807497 https://github.com/orgs/systemd/teams/systemd/discussions/1
* man: use ellipses for ranges in range descriptionsZbigniew Jędrzejewski-Szmek2021-01-291-1/+1
| | | | … and in few other places ;)
* license: LGPL-2.1+ -> LGPL-2.1-or-laterZbigniew Jędrzejewski-Szmek2021-01-281-1/+1
| | | | | Follow-up for db9ecf050165fd1033c6f81485917e229c4be537 and faa73d4e0c8095fedd98ff29851b9634810ff97e.
* docs: expose GVARIANT-SERIALIZATION as markdownZbigniew Jędrzejewski-Szmek2021-01-281-105/+0
|
* tree-wide: add spdx header on all scripts and helpersZbigniew Jędrzejewski-Szmek2021-01-282-0/+3
| | | | | | Even though many of those scripts are very simple, it is easier to include the header than to try to say whether each of those files is trivial enough not to require one.
* treewide: tighten variable scope in loops (#18372)Susant Sahani2021-01-273-12/+6
| | | | Also use _cleanup_free_ in one more place.
* Merge pull request #18377 from yuwata/sd-device-cleanupsLennart Poettering2021-01-262-35/+32
|\ | | | | sd-device: several tiny cleanups
| * sd-device: use size_t for index in the loopYu Watanabe2021-01-261-3/+2
| |
| * sd-device: use string_hash_ops_free_freeYu Watanabe2021-01-261-15/+13
| |
| * sd-device: add a short comment why we simply return negative errno here on ↵Yu Watanabe2021-01-261-0/+1
| | | | | | | | failure
| * sd-device: rename variables and use TAKE_PTR()Yu Watanabe2021-01-261-14/+13
| |