Commit Graph

47299 Commits

Author SHA1 Message Date
Frantisek Sumsal 44e66de0f2 coccinelle: introduce drop-braces transformation
to drop braces around single-line if statements. Also, prefix it with
zz- so it runs as the last one, so it's able to fix stuff tweaked by
previous transformations.
2020-10-09 15:02:20 +02:00
Frantisek Sumsal 7e97526421 coccinelle: check for invalid errno comparisons
Prompted by #15868
2020-10-09 14:48:44 +02:00
Frantisek Sumsal 447643130c coccinelle: correctly resolve our own macros
Coccinelle can't do this automagically and requires we supply it
respective header files. Unfortunately, the option for this
(--macro-file=) can be used only once, so let's create our own
macro file by collecting macros needed for the semantic parser
to be happy.
2020-10-09 14:48:40 +02:00
Lennart Poettering d156a4fa0f
Merge pull request #17289 from keszybz/two-coverity-fixes
Two coverity-inspired fixes
2020-10-09 11:56:15 +02:00
Lennart Poettering 2a155c53ab ratelimit: add ratelimit_configured() helper
This helper alone doesn't make too much sense, but it's preparatory work
for #17274, and I guess it can't hurt to land it early, it does make the
ratelimit code a tiny bit prettier after all.
2020-10-09 08:58:59 +02:00
Lennart Poettering 15c689d77f sd-event: check return value of syscals directly, avoid redundant variable assignment
And while we are at it, fix one incorrect error propagation.
2020-10-09 08:58:23 +02:00
Zbigniew Jędrzejewski-Szmek 081b300976 networkd: add assert to appease coverity
The code was OK, but not obviously so. Let's add an assert to help a
human or nonhuman reader figure it out.

Coverity CID#1433224.
2020-10-09 08:14:54 +02:00
Zbigniew Jędrzejewski-Szmek b4c527f4ec systemctl: fix reversed arguments in function call
This is confusing, but had no effect because the arguments were consistently
switched.

Coverity CID#1433223.
2020-10-09 08:04:25 +02:00
Lennart Poettering ba28df775d missing-syscall: fix copypasta
As noticed by @mbiebl:

5134e18eed (r43033443)
2020-10-08 13:52:44 +02:00
Michael Biebl cd20659891 basic/missing_syscall: fix syscall numbers for mips*
Thanks Christian Brauner @brauner
Fixes: #17261
2020-10-08 10:25:15 +02:00
Lennart Poettering e7bcecf0e4
Merge pull request #17279 from poettering/systemctl-split-up
systemctl: split huge .c file into smaller bits
2020-10-08 10:17:29 +02:00
Yu Watanabe 45a536980c
Merge pull request #17271 from yuwata/network-route-improve-multipath-route-support
network: improve multipath route support
2020-10-08 15:55:35 +09:00
Lennart Poettering daf71ef61c systemctl: split up humungous systemctl.c file
This is just some refactoring: shifting around of code, not change in
codeflow.

This splits up the way too huge systemctl.c in multiple more easily
digestable files. It roughly follows the rule that each family of verbs
gets its own .c/.h file pair, and so do all the compat executable names
we support. Plus three extra files for sysv compat (which existed before
already, but I renamed slightly, to get the systemctl- prefix lik
everything else), a -util file with generic stuff everything uses, and a
-logind file with everything that talks directly to logind instead of
PID1.

systemctl is still a bit too complex for my taste, but I think this way
itc omes in a more digestable bits at least.

No change of behaviour, just reshuffling of some code.
2020-10-07 23:12:15 +02:00
Lennart Poettering 4dcc0653b5 systemctl: move compare_unit_info() to bus-unit-util.[ch]
It's an auxiliary function to the UnitInfo structures, and very generic.
Let's hence move it over to the other code operating with UnitInfo, even
if it's not used by code outside of systemctl (yet).
2020-10-07 22:19:37 +02:00
Lennart Poettering e2d839d316 pretty-print: don't abbreviate needlessly in user-facing string 2020-10-07 22:19:33 +02:00
Lennart Poettering 0f2219bb8f basic: include stddef.h since we use NULL in header 2020-10-07 22:19:10 +02:00
Yu Watanabe ceea6c1aff network: introduce IPV4_ADDRESS_FMT_STR macro
This also moves ADDRESS_FMT_VAL() macro to networkd-address.h, and
renames it to IPV4_ADDRESS_FMT_VAL().
2020-10-08 02:51:23 +09:00
Yu Watanabe d442bb3728 network: make Gateway= in [Route] section accept an empty string 2020-10-08 02:51:23 +09:00
Yu Watanabe d306d1d0ca network: introduce Gateway=_dhcp4 and _dhcp6, and deprecate "_dhcp"
Fixes #17249.
2020-10-08 02:51:23 +09:00
Yu Watanabe d9005dec6e test-network: do not fail when multiple ipv6 default gateways are configured
When multiple ipv6 default gateways are set, kernel seems to merge them
into a multipath route.
2020-10-08 02:51:23 +09:00
Yu Watanabe bff94a84c2 util: make local_gateways() support RT_VIA and RT_MULTIPATH
Then, `networkctl status` correctly shows gateways.
2020-10-08 02:51:23 +09:00
Yu Watanabe f9bb333832 network: manage multipath routes separately 2020-10-08 02:51:23 +09:00
Yu Watanabe de52a83cb7 sd-netlink: introduce sd_netlink_message_read_data() 2020-10-08 02:51:23 +09:00
Yu Watanabe 2fe1d557e5 sd-netlink: introduce rtattr_read_nexthop() 2020-10-08 02:51:23 +09:00
Yu Watanabe d6ad41e27d network: free Route object when route_remove() fails
When route_remove() succeeds, the Route object will be freed later by
manager_rtnl_process_route().
2020-10-08 02:51:23 +09:00
Yu Watanabe 423c249c2e network: constify arguments 2020-10-08 02:51:23 +09:00
Yu Watanabe 297f9d86fe test-network: add a test case for IPv4 route with IPv6 gateway 2020-10-08 02:51:13 +09:00
Renaud Métrich 5177cb0a9a unit: don't emit PropertiesChanged signal if adding a dependency to a unit is a no-op 2020-10-07 18:16:08 +02:00
Yu Watanabe 6dd5398137 network: support IPv4 route with IPv6 gateway 2020-10-08 00:06:19 +09:00
Yu Watanabe 2c59a8a624 sd-netlink: fix type of RTA_VIA 2020-10-07 15:22:10 +02:00
Yu Watanabe ad208fac73 network: also manage routes without RTA_OIF attribute 2020-10-07 15:22:10 +02:00
Yu Watanabe fd7701bf31 network: ignore Scope= for IPv6 routes as it will not be used 2020-10-07 15:22:10 +02:00
Yu Watanabe 0a2808a208 test-network: drop meaningless Scope= settings in the config 2020-10-07 15:22:10 +02:00
Yu Watanabe 8973df5c42 network: set default priority for IPv6 routes
See inet6_rtm_newroute() in kernel's net/ipv6/route.c.
2020-10-07 15:22:09 +02:00
Yu Watanabe b2f61e0da0 basic: import linux/ipv6_route.h 2020-10-07 15:22:09 +02:00
Yu Watanabe 473a64e569 meson: add missing files 2020-10-07 15:22:09 +02:00
Lennart Poettering b8aaceb9b5 systemctl: drop unsused variable original_stdout_is_tty
Unused since de9a8fe18e.
2020-10-07 14:13:19 +02:00
Lennart Poettering 816d460a7c update TODO 2020-10-07 14:12:19 +02:00
Lennart Poettering 1378ac6989
Merge pull request #17231 from poettering/event-source-exit-on-failure
sd-event: add "exit-on-failure" feature for event source
2020-10-07 12:55:56 +02:00
Zbigniew Jędrzejewski-Szmek 206178a9d2 Document some reasonable DNS servers in the example config file
We have an option to set the fallback list, so we don't know what the contents
are. It may in fact be empty. Let's add some examples to make it easy for a user
stranded without any DNS to fill in something that would work. As a bonus, this
also gives names to the entries we provide by default.
(I added google and cloudflare because that's what we have currently, and quad9
because it seems to be a good privacy-concious and fast choice and was requested
in #12499. As a minimum, things we should include should be well-known global
services with a documented privacy policy and both IPv4 and IPv6 support and
decent response times.)
2020-10-07 11:38:07 +02:00
Lennart Poettering 85585b767d
Merge pull request #17238 from keszybz/man-tmp-noexec
Say that noexec should not be used for /tmp
2020-10-07 09:45:58 +02:00
Lennart Poettering cbda8bd5fb udev: make use of NULL callback in IO handlers 2020-10-07 09:40:32 +02:00
Lennart Poettering b9350e70aa sd-event: support callback=NULL in IO/child/inotify/defer event sources, too
Also, document this functionality more prominently, including with a
reference from sd_event_exit().

This is mostly to make things complete, as previously we supported NULL
callbacks only in _add_time() and _add_signal(). However, I think this
makes snese for IO event sources too (think: when some fd such as a pipe
end sees SIGHUP or so, exit), as well as defer or post event sources (i.e. exit
once we got nothing else to do). This also adds support for inotify
event sources, simply to complete things (I can't see the immediate use,
but maybe someone else comes up with it).

The only event source type that doesn't allow callback=NULL now are exit
callbacks, but for them they make little sense, as the event loop is
exiting then anyway.
2020-10-07 09:40:16 +02:00
Lennart Poettering bac0bfc1d0 udev-util: make use of sd-event's NULL callback support 2020-10-07 09:40:12 +02:00
Lennart Poettering 463f9ce3bc test: add test that validates that PTR_TO_INT(INT_TO_PTR()) covers whole int range 2020-10-07 09:40:09 +02:00
Lennart Poettering ccaa30c199 socket-proxy: port to new sd_event_source_set_exit_on_failure() API 2020-10-07 09:40:05 +02:00
Lennart Poettering 76c59537f3 socket-proxy: close correct fd, log at right log level 2020-10-07 09:40:02 +02:00
Lennart Poettering 647f2ee259 man: add docs for sd_event_source_set_exit_on_failure() 2020-10-07 09:39:39 +02:00
Lennart Poettering b778cba4bf sd-event: optionally, if an event source fails, exit the event loop
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.
2020-10-07 09:38:41 +02:00
Yu Watanabe ab582fda48
Merge pull request #17240 from yuwata/network-cleanup
network: several cleanups and fix IPv4DAD and IP Masqurade
2020-10-07 07:42:40 +09:00