summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* shared: don't unconditionally set SOCK_STREAM as type in socket_address_parse()Zbigniew Jędrzejewski-Szmek2020-09-103-51/+71
| | | | | | | | | | We would set .type to a fake value. All real callers (outside of tests) immediately overwrite .type with a proper value after calling socket_address_parse(). So let's not set it and adjust the few places that relied on it being set to the fake value. socket_address_parse() is modernized to only set the output argument on success.
* shared: make socket_address_parse use the generic parser for IPv[46] addressesZbigniew Jędrzejewski-Szmek2020-09-101-72/+33
| | | | | | | | One special syntax is not supported anymore: "iface:port" would be parsed as an interface name plus numerical port, equivalent to "[::]%iface:port". This was added in 542563babda, but was undocumented, and we had no tests for it. It seems that this actually wasn't doing anything useful, because the kernel only uses the scope identifier for link-local addresses.
* Get rid of in_addr_port_from_string_auto() againZbigniew Jędrzejewski-Szmek2020-09-104-63/+1
| | | | | With the commit "shared/socket-netlink: only allow ifindex if explicitly supported" this helper is not necessary anymore.
* shared: check interface name validity in ↵Zbigniew Jędrzejewski-Szmek2020-09-101-0/+4
| | | | | | | | | in_addr_port_ifindex_name_from_string_auto() We don't try to resolve invalid ifnames as all. A different return code is used. This difference will be verified later in test_socket_address_parse() when socket_address_parse() is converted to use in_addr_port_ifindex_name_from_string_auto().
* basic: show interface scope in sockaddr_pretty()Zbigniew Jędrzejewski-Szmek2020-09-101-4/+8
| | | | | | | | If the interface scope is specified, this changes the meaning of the address quite significantly. Let's show the IPv6 scope_id if present. Sadly we don't even have a test for sockaddr_pretty() output :( This will be implicitly tested through socket_address_parse() later on.
* basic: convert ifname_valid_full() to take flags and allow numeric interfacesZbigniew Jędrzejewski-Szmek2020-09-105-21/+38
|
* shared/socket-netlink: only allow ifindex if explicitly supportedZbigniew Jędrzejewski-Szmek2020-09-102-18/+63
| | | | | Instead of ignoring ifindex if not wanted, refuse it is the caller does not allow it.
* test-socket-netlink: print the proper expected stringZbigniew Jędrzejewski-Szmek2020-09-101-4/+12
| | | | | | We would use the return value from the tested function to decide what to print as "expected", which is confusing when something is wrong with the tested function.
* test-in-addr-util: add log headersZbigniew Jędrzejewski-Szmek2020-09-102-8/+8
|
* resolved: unify the two functions to create main stubsZbigniew Jędrzejewski-Szmek2020-09-101-72/+32
| | | | | There is a small functional difference: IP_TTL==1 is now also set for the UDP socket. I assume that it wasn't set by mistake.
* resolved: unify the two functions to create extra stubsZbigniew Jędrzejewski-Szmek2020-09-101-100/+46
| | | | | | | | | | | | | | There is a minor functional change: IPV6_FREEBIND is set of IPv6 sockets, not IP_FREEBIND. This was missed in af8b1384, but I noticed only after the merging the two functions. And a not-so-minor functional chagnge: 7216a3b5dcde36245 changed manager_dns_stub_tcp_fd_extra() to return the fd even if the source was already initialized, but it didn't do the same change for manager_dns_stub_udp_fd_extra(), so it would return 0 in that case. But 0354029bf572489b uses manager_dns_stub_udp_fd_extra() when preparing to call manager_send(), and will pass 0 as the fd in that case. For both socket types fd is now always returned.
* resolve: move handler functions higherZbigniew Jędrzejewski-Szmek2020-09-101-56/+56
| | | | No functional change, preparation for subsequent refactoring.
* man: document that sd_bus_message_close_container() may only be called at ↵Lennart Poettering2020-09-091-2/+15
| | | | | | end of container Prompted-by: https://lists.freedesktop.org/archives/systemd-devel/2020-September/045264.html
* Merge pull request #16985 from poettering/resolve-dns-stub-extra-fixletsZbigniew Jędrzejewski-Szmek2020-09-0910-128/+168
|\ | | | | resolved: dns stub listener extra fixes
| * resolved: don't store udp/tcp fd in DnsPacket objectLennart Poettering2020-09-087-50/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DnsPacket should better be a "dead" object, i.e. list facts, not track resources. By including an fd in its fields it started tracking resources however, without actually taking a ref to the fd (i.e. no dup() or so was called on it). Let's hence rework things so that we don#t have to keep track of the fd a packet came in from. Instead, pass around the DnsStubListenerExtra object wherever we need to. This should be useful as soon as we start caching whole DnsPacket objects to allow replying to DNSSEC/CO packets, i.e. where we have to keep a copy of the original DnsPacket around for a long time in cache, potentially much longer than the fds the packet was received on.
| * resolved: move dns stub definitions to resolved-dns-stub.[ch]Lennart Poettering2020-09-086-71/+78
| | | | | | | | Just some moving around, no logic changes.
| * resolve: DNSStubListenerExtra → DnsStubListenerExtraLennart Poettering2020-09-084-15/+15
| | | | | | | | | | All our other struct types use the "Dns" spelling, rather than "DNS". Do the same for this struct.
* | Merge pull request #16997 from poettering/foreach-word-followupZbigniew Jędrzejewski-Szmek2020-09-092-4/+5
|\ \ | | | | | | fix two coverity issues
| * | sd-login: fix memory leakLennart Poettering2020-09-091-3/+4
| | | | | | | | | | | | Fixes: CID1432652
| * | socket: fix copy/paste errorLennart Poettering2020-09-091-1/+1
| | | | | | | | | | | | Fixes: CID1432653
* | | cryptsetup: Fix null pointer dereference (#16987)Mikael Szreder2020-09-091-2/+4
|/ / | | | | | | | | cryptsetup: Fix null pointer dereference Fix null pointer dereference in the pkcs11 related code of systemd-cryptsetup
* | logind: fix merge issueLennart Poettering2020-09-091-1/+1
| | | | | | | | | | The two PRs #16664 and #16635 individually passed CI, but when combined cannot build. Since both are merged now, let's fix that.
* | login: Add KEY_RESTART handlingRobert Marko2020-09-0911-17/+75
| | | | | | | | | | | | | | 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>
* | logind.conf: document UserStopDelaySec in logind.confFranck Bui2020-09-091-0/+1
| |
* | Merge pull request #16635 from keszybz/do-not-for-each-wordLennart Poettering2020-09-0936-624/+669
|\ \ | | | | | | Drop FOREACH_WORD
| * | Rename strv_split_extract() to strv_split_full()Zbigniew Jędrzejewski-Szmek2020-09-0912-34/+34
| | | | | | | | | | | | | | | Now that _full() is gone, we can rename _extract() to have the usual suffix we use for the more featureful version.
| * | Remove FOREACH_WORD and friendsZbigniew Jędrzejewski-Szmek2020-09-093-98/+0
| | |
| * | tree-wide: replace strv_split_full() with strv_split_extract() everywhereZbigniew Jędrzejewski-Szmek2020-09-096-98/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Behaviour is not identical, as shown by the tests in test-strv. The combination of EXTRACT_UNQUOTE without EXTRACT_RELAX only appears in the test, so it doesn't seem particularly important. OTOH, the difference in handling of squished parameters could make a difference. New behaviour is what both bash and python do, so I think we can ignore this corner case. This change has the following advantages: - the duplication of code paths that do a very similar thing is removed - extract_one_word() / strv_split_extract() return a proper error code.
| * | test-string-util: stop testing FOREACH_WORDZbigniew Jędrzejewski-Szmek2020-09-091-9/+17
| | |
| * | shared/fstab-util: replace FOREACH_WORD_SEPARATOR() with open-coded loopZbigniew Jędrzejewski-Szmek2020-09-091-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | The tricky part here is that the function is not allowed to fail in this code path. Initially, I wanted to change the return value to allow it to fail, but this cascades through all the places where fstab_test_option() and friends are used; updating all those sites would be a lot of work. And since quoting is not allowed here, a simple loop with strcspn() is easy to do.
| * | shared/fstab-util: use free_and_str[n]dup()Zbigniew Jędrzejewski-Szmek2020-09-091-31/+22
| | | | | | | | | | | | No functional change. I'm keeping this separate to make review easier.
| * | Use extract_first_word() in generated conf parsersZbigniew Jędrzejewski-Szmek2020-09-091-16/+18
| | |
| * | nspawn: use extract_first_word()Zbigniew Jędrzejewski-Szmek2020-09-091-7/+9
| | |
| * | getty-generator: use extract_first_word()Zbigniew Jędrzejewski-Szmek2020-09-091-59/+55
| | |
| * | sd-journal: use extract_first_word()Zbigniew Jędrzejewski-Szmek2020-09-091-33/+28
| | |
| * | delta: use extract_first_word()Zbigniew Jędrzejewski-Szmek2020-09-091-11/+16
| | |
| * | cryptsetup: use extract_first_word()Zbigniew Jędrzejewski-Szmek2020-09-091-10/+10
| | |
| * | core/load-fragment: use extract_first_word()Zbigniew Jędrzejewski-Szmek2020-09-091-17/+12
| | | | | | | | | | | | | | | This is much nicer, and also fixes a potential overflow when we used 'word' in log_error() as if it was a NUL-terminated string.
| * | Let sd_machine_get_ifindices() omit the output param tooZbigniew Jędrzejewski-Szmek2020-09-092-15/+21
| | | | | | | | | | | | Nowadays we do that almost everywhere, let's also do it here.
| * | Rewrite sd_machine_get_ifindices() to avoid FOREACH_WORD()Zbigniew Jędrzejewski-Szmek2020-09-093-25/+25
| | | | | | | | | | | | | | | 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-093-67/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-device: use extract_first_word()Zbigniew Jędrzejewski-Szmek2020-09-091-19/+18
| | |
| * | basic/cgroup-util: port over to string_contains_word()Zbigniew Jędrzejewski-Szmek2020-09-091-23/+13
| | |
| * | logind: use extract_first_word()Zbigniew Jędrzejewski-Szmek2020-09-092-14/+23
| | |
| * | shared/sleep-config: more logging and port to extract_first_word()Zbigniew Jędrzejewski-Szmek2020-09-041-32/+33
| | |
| * | Add string_contains_word_strv()Zbigniew Jędrzejewski-Szmek2020-09-046-9/+52
| | | | | | | | | | | | | | | | | | I had to move STRV_MAKE to macro.h. There is a circular dependency between extract-word.h, strv.h, and string-util.h that makes it hard to define the inline function otherwise.
| * | sd-login: use string_contains_word()Zbigniew Jędrzejewski-Szmek2020-09-041-15/+11
| | |
| * | basic: add string_contains_word()Zbigniew Jędrzejewski-Szmek2020-09-043-0/+75
| | | | | | | | | | | | | | | This wraps the common pattern of using extract_first_word() in a loop to look for a matching word.
| * | test-string-util,test-extract-word: add log headersZbigniew Jędrzejewski-Szmek2020-09-042-8/+68
| | |
* | | Merge pull request #16972 from wusto/ambient-and-keep-caps-correctionsLennart Poettering2020-09-091-12/+11
|\ \ \ | | | | | | | | Ambient capabilities documenation and keep-caps usage corrections