summaryrefslogtreecommitdiffstats
path: root/src/systemd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* netlink: introduce sd_netlink_message_has_flag()Yu Watanabe2021-02-161-0/+1
|
* netlink: drop sd_rtnl_message_{route,nexthop}_set_family()Yu Watanabe2021-02-161-10/+5
| | | | The family is already set when the message is created.
* tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-103-3/+6
| | | | | | | | | 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.
* network: correct name of parameter in function prototypeKevin P. Fleming2021-02-031-1/+1
| | | | | The output parameter of `sd_rtnl_message_neigh_get_ifindex` is called `index`, not `family`.
* sd-bus: Add sd_bus_reply()Daan De Meyer2021-01-251-0/+1
| | | | | | | | | | While sd-bus already provides sd_bus_call() for calling a method from a complete bus message object, We don't have an equivalent function for replying from a method with a complete bus message object. Currently, we use sd_bus_send(call->bus, m, NULL) instead. Let's add a shorthand for this pattern and name it sd_bus_reply().
* save link activation policy to state file and display in networkctlDan Streetman2021-01-211-0/+5
|
* meson: fix indentationYu Watanabe2021-01-181-1/+0
|
* dhcp6: refuse zero length vendor classYu Watanabe2021-01-121-1/+1
| | | | | Also, fixes the maximum length of the vendor class to UINT16_MAX. Moreover, a memory leak in sd_dhcp6_client_set_request_vendor_class().
* dhcp6: refuse zero length dhcp user classYu Watanabe2021-01-121-1/+1
| | | | | This also fixes a memory leak when sd_dhcp6_client_set_request_user_class() is called multiple times.
* dhcp: length of each user class field must be positiveYu Watanabe2021-01-121-1/+1
| | | | | This also fixes an memory leak when sd_dhcp_client_set_user_class() is called multiple times.
* sd-netlink: replace *messages[] -> **messagesYu Watanabe2020-12-181-1/+1
|
* Merge pull request #17026 from fw-strlen/nft_16Lennart Poettering2020-12-161-0/+28
|\ | | | | add networkd/nspawn nftables backend
| * sd-netlink: add a read functionFlorian Westphal2020-12-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | Will be used by nftables nfnetlink backend. It sends a series of netlink messages that form a nftables update transaction. The transaction will then generate a series of ack messages (or an error). This function will be used to read these acks.
| * sd-netlink: add sd_netlink_sendvFlorian Westphal2020-12-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | nftables uses a transaction-based netlink model: one netlink write comes with multiple messages. A 'BEGIN' message to tell nf_tables/kernel that a new transaction starts. Then, one more messages to add/delete tables/chains/rules etc. Lastly, an END message that commits all changes. This function will be used to send all the individual messages that should make up a single transaction as a single write.
| * sd-netlink: add nfnetlink helper routinesFlorian Westphal2020-12-161-0/+26
| | | | | | | | | | | | | | | | add nfnetlink_nftables helper functions to: * open a new nfnetlink socket to kernel * add tables, chains, rules, sets and maps * delete/flush table * add and delete elements from sets/maps
* | sd-netlink: routing policy rule port to fib_rule_hdrSusant Sahani2020-12-161-12/+12
|/
* sd-bus: add API for connecting to a specific user's user bus of a specific ↵Lennart Poettering2020-12-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | container This is unfortunately harder to implement than it sounds. The user's bus is bound a to the user's lifecycle after all (i.e. only exists as long as the user has at least one PAM session), and the path dynamically (at least theoretically, in practice it's going to be the same always) generated via $XDG_RUNTIME_DIR in /run/. To fix this properly, we'll thus go through PAM before connecting to a user bus. Which is hard since we cannot just link against libpam in the container, since the container might have been compiled entirely differently. So our way out is to use systemd-run from outside, which invokes a transient unit that does PAM from outside, doing so via D-Bus. Inside the transient unit we then invoke systemd-stdio-bridge which forwards D-Bus from the user bus to us. The systemd-stdio-bridge makes up the PAM session and thus we can sure tht the bus exists at least as long as the bus connection is kept. Or so say this differently: if you use "systemctl -M lennart@foobar" now, the bus connection works like this: 1. sd-bus on the host forks off: systemd-run -M foobar -PGq --wait -pUser=lennart -pPAMName=login systemd-stdio-bridge 2. systemd-run gets a connection to the "foobar" container's system bus, and invokes the "systemd-stdio-bridge" binary as transient service inside a PAM session for the user "lennart" 3. The systemd-stdio-bridge then proxies our D-Bus traffic to the user bus. sd-bus (on host) → systemd-run (on host) → systemd-stdio-bridge (in container) Complicated? Well, to some point yes, but otoh it's actually nice in various other ways, primarily as it makes the -H and -M codepaths more alike. In the -H case (i.e. connect to remote host via SSH) a very similar three steps are used. The only difference is that instead of "systemd-run" the "ssh" binary is used to invoke the stdio bridge in a PAM session of some other system. Thus we get similar implementation and isolation for similar operations. Fixes: #14580
* meson: check that cxx variable is set before using itLuca Boccassi2020-12-041-1/+1
| | | | | | In some cases it is not defined. Eg in a yocto build: src/systemd/meson.build:61:15: ERROR: Unknown variable cxx.
* sd-ipv4acd,sd-ipv4ll: introduce _get_ifindex() and _get_ifname()Yu Watanabe2020-12-022-0/+4
| | | | | | They will be used in later commits. This also makes sd_ipv4acd_set_ifindex() check the existence of the interface.
* Merge pull request #17692 from yuwata/ipv4llZbigniew Jędrzejewski-Szmek2020-12-011-0/+2
|\ | | | | network: fold ipv4ll fallback modes into normal ipv4ll addressing
| * sd-dhcp-client: report transient DHCP failure to the callerZbigniew Jędrzejewski-Szmek2020-11-301-0/+2
| | | | | | | | | | | | | | | | | | | | So far we only reported major state transitions like failure to acquire the message. Let's report the initial failure after a few timeouts in a new event type. The number of timeouts is hardcoded as 3, since Windows seems to be using that. I don't think we need to make this configurable out of the box. A reasonable default may be enough.
* | sd-event: add ability to ratelimit event sourcesLennart Poettering2020-12-011-0/+3
|/ | | | | | | | | | | | | | | Let's a concept of "rate limiting" to event sources: if specific event sources fire too often in some time interval temporarily take them offline, and take them back online once the interval passed. This is a simple scheme of avoiding starvation of event sources if some event source fires too often. This introduces the new conceptual states of "offline" and "online" for event sources: an event source is "online" only when enabled *and* not ratelimited, and offline in all other cases. An event source that is online hence has its fds registered in the epoll, its signals in the signalfd and so on.
* test: let's start getting ready for 2020Zbigniew Jędrzejewski-Szmek2020-11-171-0/+3
| | | | It'll be a wonderful year, I'm sure.
* meson: use proper variable for libudev.h pathZbigniew Jędrzejewski-Szmek2020-11-171-1/+1
|
* meson: fix build tests for c++14 and c++17Yu Watanabe2020-11-171-2/+2
|
* meson: use "_" as separator in test namesYu Watanabe2020-11-161-1/+2
| | | | | | Follow-up for ca121e20c42219e3bc4e5cb63dcc96cc5eae2879. Fixes #17568.
* meson: use "_" as separator in test namesZbigniew Jędrzejewski-Szmek2020-11-111-1/+1
| | | | | | | | | ":" is prettier, but meson 0.56+ doesn't like it: src/systemd/meson.build:73: DEPRECATION: ":" is not allowed in test name "cc-sd-bus.h:c", it has been replaced with "_" src/systemd/meson.build:73: DEPRECATION: ":" is not allowed in test name "cc-sd-bus.h:c-ansi", it has been replaced with "_" ... Fixes #17568.
* sd-radv: router lifetime is uint16_tYu Watanabe2020-11-091-1/+1
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-0930-30/+30
|
* dhcp4: fix DHCP on InfiniBand interfacesTimo Rothenpieler2020-10-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With these patches applied, networkd is successfully able to get an address from a DHCP server on an IPoIB interface. 1) Makes networkd pass the actual interface type to the dhcp client, instead of hardcoding it to Ethernet. 2) Fixes some issues in handling the larger (20 Byte) IB MAC addresses in the dhcp code. 3) Add a new field to networkds Link struct, which holds the interface broadcast address. 3.1) Modify the DHCP code to also expect the broadcast address as parameter. On an Ethernet-Interface the Broadcast address never changes and is always all 6 bytes set to 0xFF. On an IB one however it is not neccesarily always the same, thus fetching the actual address from the interface is neccesary. 4) Only the last 8 bytes of an IB MAC are stable, so when using an IB MAC to generate a client ID, only pass those 8 bytes.
* Merge pull request #15206 from anitazha/systoomd-v0Zbigniew Jędrzejewski-Szmek2020-10-151-0/+3
|\ | | | | systemd-oomd
| * core: systemd-oomd pid1 integrationAnita Zhang2020-10-081-0/+3
| |
* | sd-netlink: introduce sd_netlink_message_read_data()Yu Watanabe2020-10-071-0/+1
|/
* sd-event: optionally, if an event source fails, exit the event loopLennart Poettering2020-10-071-0/+2
| | | | | | | | | | | | | Currently, if an event source callback returns an error, we'll disable the event source and continue. This adds a per-event source flag that if turned on goes further: the event loop is also exited, propagating the error code. This is inspired by some patterns repeatedly seen in #15206. The idea is that event sources that server the "primary" function of a program are marked like this, so that if they fail the failure is instantly propagated and terminates the program.
* Merge pull request #16998 from zonque/networkd/mdbYu Watanabe2020-09-151-0/+2
|\ | | | | network: add support for setting MDB entries
| * sd-netlink: add MDB typesDaniel Mack2020-09-101-0/+2
| | | | | | | | These are used to configure multicast membership entries of bridge ports.
* | sd-device: introduce sd_device_set_sysattr_valuef()Yu Watanabe2020-09-111-0/+1
|/
* login: Add KEY_RESTART handlingRobert Marko2020-09-091-0/+2
| | | | | | | KEY_RESTART is widely used in Linux to indicate device reboot. So lets handle it in the same fashion as KEY_POWER. Signed-off-by: Robert Marko <robert.marko@sartura.hr>
* Merge pull request #16635 from keszybz/do-not-for-each-wordLennart Poettering2020-09-091-2/+6
|\ | | | | Drop FOREACH_WORD
| * Rewrite sd_machine_get_ifindices() to avoid FOREACH_WORD()Zbigniew Jędrzejewski-Szmek2020-09-091-1/+1
| | | | | | | | | | If we fail to parse the index, the failure is propogated as -EUNCLEAN. (-EINVAL would be confused with invalid args to the function itself.)
| * Fix output value of sd_seat_get_sessions() and drop FOREACH_WORD useZbigniew Jędrzejewski-Szmek2020-09-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | sd_seat_get_sessions() would return 0 in the 'n_uids' (now 'ret_n_uids') output parameter when 'uid' (now 'ret_uids') was passed as NULL. While at it, drop FOREACH_WORD() use. Also use any whitespace as separator. In practice this shouldn't matter, since logind always uses spaces, but it seems nicer to not specify this explicitly, and the default is more flexible.
* | sd-bus: move SD_BUS_MAXIMUM_(SIGNATURE|NAME)_LENGTH to sd-bus-protocol.hLennart Poettering2020-09-042-6/+6
|/ | | | | | | | So far we kept all defines directly originating from the spec in sd-bus-protocol.h, do this for this too. The precise place doesn't matter much API-wise given that sd-bus.h includes sd-bus-protocol.h, hence let's just clean this up.
* udev: make tags "sticky"Lennart Poettering2020-09-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tries to address the "bind"/"unbind" uevent kernel API breakage, by changing the semantics of device tags. Previously, tags would be applied on uevents (and the database entries they result in) only depending on the immediate context. This means that if one uevent causes the tag to be set and the next to be unset, this would immediately effect what apps would see and the database entries would contain each time. This is problematic however, as tags are a filtering concept, and if tags vanish then clients won't hence notice when a device stops being relevant to them since not only the tags disappear but immediately also the uevents for it are filtered including the one necessary for the app to notice that the device lost its tag and hence relevance. With this change tags become "sticky". If a tag is applied is once applied to a device it will stay in place forever, until the device is removed. Tags can never be removed again. This means that an app watching a specific set of devices by filtering for a tag is guaranteed to not only see the events where the tag is set but also all follow-up events where the tags might be removed again. This change of behaviour is unfortunate, but is required due to the kernel introducing new "bind" and "unbind" uevents that generally have the effect that tags and properties disappear and apps hence don't notice when a device looses relevance to it. "bind"/"unbind" events were introduced in kernel 4.12, and are now used in more and more subsystems. The introduction broke userspace widely, and this commit is an attempt to provide a way for apps to deal with it. While tags are now "sticky" a new automatic device property CURRENT_TAGS is introduced (matching the existing TAGS property) that always reflects the precise set of tags applied on the most recent events. Thus, when subscribing to devices through tags, all devices that ever had the tag put on them will be be seen, and by CURRENT_TAGS it may be checked whether the device right at the moment matches the tag requirements. See: #7587 #7018 #8221
* sd-bus: add a variant of sd_bus_error_has_name() that takes multiple namesZbigniew Jędrzejewski-Szmek2020-08-241-0/+2
|
* _sd-common.h: avoid parsing errors with CoverityKamil Dudka2020-08-061-1/+1
| | | | | | | | | | | | The commit 1070d271fa8fa553d57dd5f74dd1e3f60732d0b9 which was supposed too fix this does not seem to take effect any more. We get again 34% compilation success rate while scanning systemd itself. Moreover, the installed header file breaks compilation of programs that include it: "/usr/include/systemd/_sd-common.h", line 23: error #35: #error directive: "Do not include _sd-common.h directly; it is a private header." # error "Do not include _sd-common.h directly; it is a private header." ^
* Merge pull request #16596 from poettering/event-time-relZbigniew Jędrzejewski-Szmek2020-08-041-0/+2
|\ | | | | | | Conflict in src/libsystemd-network/test-ndisc-rs.c fixed manually.
| * sd-event: add relative timer callsLennart Poettering2020-07-281-0/+2
| | | | | | | | | | | | | | We frequently want to set a timer relative to the current time. Let's add an explicit API for this. This not only saves us a few lines of code everywhere and simplifies things, but also allows us to do correct overflow checking.
* | dhcp6: parse the FQDN optionBeniamino Galvani2020-08-031-0/+1
|/ | | | | Parse option 39 (Client Fully Qualified Domain Name, RFC 4704) from the DHCP reply, which specifies the FQDN assigned by the server to the client.
* Merge pull request #16514 from keszybz/zstd-decompress-fixZbigniew Jędrzejewski-Szmek2020-07-221-4/+6
|\ | | | | Fix coredumpctl operation with zstd-compressed journals
| * sd-journal: when enumerating, continue even after an inaccessible fieldZbigniew Jędrzejewski-Szmek2020-07-211-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SD_JOURNAL_FOREACH_DATA() and SD_JOURNAL_FOREACH_UNIQUE() would immediately terminate when a field couldn't be accessed. This can happen for example when a field is compressed with an unavailable compression format. But it's likely that this is the wrong thing to do: the caller for example might want to iterate over the fields but isn't interested in all of them. coredumpctl is like this: it uses SD_JOURNAL_FOREACH_DATA() but only uses a subset of the fields. Add two new functions sd_journal_enumerate_good_data() and sd_journal_enumerate_good_unique() that retry sd_journal_enumerate_data() and sd_journal_enumerate_unique() if the return value is something that applies to a single field: ENOBUS, E2BIG, EOPNOTSUPP. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1856037. An alternative would be to make the macros themselves smarter instead of adding new symbols, and do the looping internally in the macro. I don't like that approach for two reasons. First, it would embed the logic in the macro, so recompilation would be required if we decide to update the logic. With the current version of the patch, recompilation is required to use the new symbols, but after that, library upgrades are enough. So the current approach is safer in case further updates are needed. Second, our headers use primitive C, and it is hard to do the macros without using newer features.