Evgeny Vereshchagin [Sun, 5 May 2019 19:28:42 +0000 (19:28 +0000)]
tests: hook up fuzz targets to FuzzBuzz
Zbigniew Jędrzejewski-Szmek [Tue, 7 May 2019 18:03:22 +0000 (20:03 +0200)]
Merge pull request #12475 from yuwata/network-fix-12452
network: add network_ref/_unref() and make Link object take a reference of Network object
Zbigniew Jędrzejewski-Szmek [Tue, 7 May 2019 17:58:40 +0000 (19:58 +0200)]
Merge pull request #12481 from ssahani/dhcp-max-retry
networkd: Allow DHCP4 client to set the number to attempt to configure/reconfigure
Yu Watanabe [Sun, 5 May 2019 15:42:05 +0000 (17:42 +0200)]
test-network: add one more test for LinkLocalAddressing=fallback
Yu Watanabe [Tue, 7 May 2019 13:54:15 +0000 (15:54 +0200)]
network: add error cause in the log
Susant Sahani [Sat, 4 May 2019 11:40:54 +0000 (17:10 +0530)]
networkd: Allow DHCP4 client to set the number to attempt to reconfigure.
Otherwise current value is 6 and after 6 it will give up.
Yu Watanabe [Sat, 4 May 2019 18:14:08 +0000 (20:14 +0200)]
network: use IN_ADDR_NULL and ETHER_ADDR_NULL
The change in manager_rtnl_process_address() may not be necessary,
but for safety, let's initialize the value.
Yu Watanabe [Sat, 4 May 2019 18:03:44 +0000 (20:03 +0200)]
network: fix conditional jump depends on uninitialised value(s)
When address is in IPv4, the remaining buffer in in_addr_union may
not be initialized.
Fixes the following valgrind warning:
```
==13169== Conditional jump or move depends on uninitialised value(s)
==13169== at 0x137FF6: UnknownInlinedFun (networkd-ndisc.c:77)
==13169== by 0x137FF6: UnknownInlinedFun (networkd-ndisc.c:580)
==13169== by 0x137FF6: ndisc_handler.lto_priv.83 (networkd-ndisc.c:597)
==13169== by 0x11BE23: UnknownInlinedFun (sd-ndisc.c:201)
==13169== by 0x11BE23: ndisc_recv.lto_priv.174 (sd-ndisc.c:254)
==13169== by 0x4AA18CF: source_dispatch (sd-event.c:2821)
==13169== by 0x4AA1BC2: sd_event_dispatch (sd-event.c:3234)
==13169== by 0x4AA1D88: sd_event_run (sd-event.c:3291)
==13169== by 0x4AA1FAB: sd_event_loop (sd-event.c:3313)
==13169== by 0x117401: UnknownInlinedFun (networkd.c:113)
==13169== by 0x117401: main (networkd.c:120)
==13169== Uninitialised value was created by a stack allocation
==13169== at 0x1753C8: manager_rtnl_process_address (networkd-manager.c:479)
```
Yu Watanabe [Sat, 4 May 2019 16:08:23 +0000 (18:08 +0200)]
sd-radv: fix memleak
Fixes one memleak found in #12452.
Yu Watanabe [Sat, 4 May 2019 17:43:45 +0000 (19:43 +0200)]
network: fix use-after-free
The function sd_radv_add_prefix() in dhcp6_pd_prefix_assign() may
return -EEXIST, and in that case the sd_radv_prefix object allocated
in dhcp6_pd_prefix_assign() will be freed when the function returns.
Hence, the key value in Manager::dhcp6_prefixes hashmap is lost.
Yu Watanabe [Sat, 4 May 2019 13:59:36 +0000 (15:59 +0200)]
network: fix memleak and double free
Fixes the third issue in #12452.
Yu Watanabe [Sat, 4 May 2019 13:33:17 +0000 (15:33 +0200)]
network: simplify link_free()
Yu Watanabe [Sat, 4 May 2019 11:02:18 +0000 (13:02 +0200)]
network: drop list fields in Network object
Susant Sahani [Thu, 2 May 2019 09:52:03 +0000 (15:22 +0530)]
networkd: manager do not unef netlink and gennetlink early
Because of this the fd is getting closed and we getting errors
like
```
^Ceno1: Could not send rtnetlink message: Bad file descriptor
enp7s0f0: Could not send rtnetlink message: Bad file descriptor
enp7s0f0: Cannot delete unreachable route for DHCPv6 delegated subnet 2a0a:...:fc::/62: Bad file descriptor
Assertion '*_head == _item' failed at ../systemd/src/network/networkd-route.c:126, function route_free(). Aborting.
Aborted
```
Closes one of https://github.com/systemd/systemd/issues/12452
Yu Watanabe [Sat, 4 May 2019 06:05:11 +0000 (08:05 +0200)]
network: make Link objects take references of Network objects
Yu Watanabe [Sat, 4 May 2019 05:52:38 +0000 (07:52 +0200)]
network: introduce reference counter for Network object
Daniele Medri [Tue, 7 May 2019 10:12:46 +0000 (12:12 +0200)]
Italian translations: minor updates (#12494)
Yu Watanabe [Tue, 7 May 2019 03:16:34 +0000 (05:16 +0200)]
Merge pull request #12478 from yuwata/wireguard-fwmark
network: rename WireGuard.FwMark -> FirewallMark
Yu Watanabe [Tue, 7 May 2019 02:33:49 +0000 (04:33 +0200)]
Merge pull request #12487 from mschiu77/acer-series-hwdb
Acer series hwdb
Yu Watanabe [Sun, 5 May 2019 15:10:22 +0000 (17:10 +0200)]
sd-dhcp: store number of trial in sd_dhcp_client::attempt
Calling 2^n as attempt is misleading.
Zbigniew Jędrzejewski-Szmek [Mon, 6 May 2019 15:17:22 +0000 (17:17 +0200)]
Merge pull request #12440 from poettering/realloc-again
another shot at the malloc_usable_size() thing
Mike Gilbert [Wed, 1 May 2019 18:15:44 +0000 (14:15 -0400)]
basic/mountpoint-util: whitelist 'exfat' in fstype_can_uid_gid
Susant Sahani [Mon, 6 May 2019 14:06:50 +0000 (19:36 +0530)]
networkd: stop clients when networkd shuts down (#12463)
We not stopping the clients when networkd stops. They
should shut down cleanly and then we need to clean the DS.
One of requirements to implement
https://github.com/systemd/systemd/issues/10820.
```
^CBus bus-api-network: changing state RUNNING → CLOSED
DHCP SERVER: UNREF
DHCP SERVER: STOPPED
DHCP CLIENT (0x60943df0): STOPPED
veth-test: DHCP lease lost
veth-test: Removing address 192.168.5.31
NDISC: Stopping IPv6 Router Solicitation client
DHCP CLIENT (0x0): FREE
==24308==
==24308== HEAP SUMMARY:
==24308== in use at exit: 8,192 bytes in 2 blocks
==24308== total heap usage: 4,230 allocs, 4,228 frees, 1,209,732 bytes allocated
==24308==
==24308== LEAK SUMMARY:
==24308== definitely lost: 0 bytes in 0 blocks
==24308== indirectly lost: 0 bytes in 0 blocks
==24308== possibly lost: 0 bytes in 0 blocks
==24308== still reachable: 8,192 bytes in 2 blocks
==24308== suppressed: 0 bytes in 0 blocks
==24308== Rerun with --leak-check=full to see details of leaked memory
==24308==
==24308== For lists of detected and suppressed errors, rerun with: -s
==24308== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==24308== could not unlink /tmp/vgdb-pipe-from-vgdb-to-24308-by-sus-on-Zeus
==24308== could not unlink /tmp/vgdb-pipe-to-vgdb-from-24308-by-sus-on-Zeus
==24308== could not unlink /tmp/vgdb-pipe-shared-mem-vgdb-24308-by-sus-on-Zeus
```
pEJipE [Mon, 6 May 2019 13:55:22 +0000 (15:55 +0200)]
hwdb: update the Chuwi HI13 pattern (#12469)
Correct the searching pattern for Chuwi Hi13. Follow-up for
c70b51a7b98c3538aba7bbfee455b850b0aa714e.
Rafael Fontenelle [Sat, 4 May 2019 14:40:04 +0000 (11:40 -0300)]
Update Brazilian Portuguese translation
Daniele Medri [Mon, 6 May 2019 13:27:21 +0000 (15:27 +0200)]
Systemd Catalog, Italian translation: minor updates (#12483)
mpe85 [Mon, 6 May 2019 13:18:26 +0000 (15:18 +0200)]
hwdb: add Medion Akoya E3222 MD62450 to 60-sensor.hwdb (#12485)
Frantisek Sumsal [Mon, 6 May 2019 08:48:12 +0000 (10:48 +0200)]
test: return a non-zero return code when 'nobody' user doesn't exist
Lookup of a non-existing user using getpwnam() is not considered
an error, thus the `errno` is not set appropriately, causing
unexpected fails on systems, where 'nobody' user doesn't exist by
default
Chris Chiu [Thu, 2 May 2019 10:10:22 +0000 (18:10 +0800)]
hwdb: Align airplane mode toggle key mapping for all Acer series
Packard Bell and Gateway are different marketing names from Acer.
The same scan code E0 86 is fired for the airplane mode toggle key.
It was verified in commit
d8d51328fe6db33a2d8cda06f181c55c00d09672.
Signed-off-by: Chris Chiu <chiu@endlessm.com>
Chris Chiu [Thu, 2 May 2019 09:46:45 +0000 (17:46 +0800)]
Revert "hwdb: Apply Acer mappings to all Gateway and Packard Bell models"
This reverts commit
e09dba97b96f877e36cd3f1afdb321922eed064b.
It's reported that the same rules for Acer cause false match and
unexpected response from certain keys on an old PackardBell laptop.
Bug: https://github.com/systemd/systemd/issues/12178
Yu Watanabe [Sat, 4 May 2019 14:21:43 +0000 (16:21 +0200)]
network: rename WireGuard.FwMark -> FirewallMark
For the consistency with FirewallMark= in [RoutingPolicyRule] section.
Yu Watanabe [Sat, 4 May 2019 14:52:07 +0000 (16:52 +0200)]
Merge pull request #12429 from ssahani/link-local-fallback
networkd: Option to use LinkLocalAddressing only when DHCP fails
Yu Watanabe [Fri, 3 May 2019 23:29:45 +0000 (01:29 +0200)]
test-network: add a test for LinkLocalAddressing=fallback
Yu Watanabe [Sat, 4 May 2019 09:25:05 +0000 (11:25 +0200)]
network: warn about Network.IPv4LL= is deprecated
Yu Watanabe [Sat, 4 May 2019 09:16:12 +0000 (11:16 +0200)]
network: disable fallback IPv4ll address assignment when DHCPv4 is disabled
Yu Watanabe [Fri, 3 May 2019 04:46:07 +0000 (06:46 +0200)]
network: use DEFINE_STRING_TABLE_LOOKUP() macro for AddressFamilyBoolean
Yu Watanabe [Sat, 4 May 2019 09:00:33 +0000 (11:00 +0200)]
network: make link_check_ready() handle LinkLocalAddressing=fallback
Yu Watanabe [Fri, 3 May 2019 23:36:51 +0000 (01:36 +0200)]
network: rewrite condition about DHCP in link_check_ready()
Susant Sahani [Wed, 1 May 2019 06:43:23 +0000 (12:13 +0530)]
networkd: Option to use LinkLocalAddressing only when DHCP fails
When LinkLocalAddressing=fallback or LinkLocalAddressing=ipv4-fallback
then IPv4LL will be started only when DHCP fails.
Closes #9648.
Chris Down [Sat, 4 May 2019 03:01:28 +0000 (23:01 -0400)]
Merge pull request #12466 from yuwata/network-fix-issue-12452
network: fix assertion when link get carrier
Chris Down [Fri, 3 May 2019 13:50:47 +0000 (09:50 -0400)]
Merge pull request #12441 from ssahani/bridge-fdb
networkd: add support for bridge fdb destination address.
Wieland Hoffmann [Thu, 2 May 2019 18:10:08 +0000 (20:10 +0200)]
fstab-generator: Prevent double free of reused FILE*
When the .automount unit file already existed for any reason in the
`normal-dir` passed to `systemd-fstab-generator`, but the normal .mount unit
file did not, `f` was closed (but _not_ set to NULL). The call to
`generator_open_unit_file(..., automount_name, &f)` then failed because the
.mount unit file already existed. Now `f` did not point to an open FILE and the
later cleanup from the `_cleanup_fclose_` attribute failed with a double free.
Reset `f` to NULL before reusing it.
Yu Watanabe [Fri, 3 May 2019 04:08:55 +0000 (06:08 +0200)]
test-network: add tests for BridgeFDB.Destination=
Susant Sahani [Tue, 30 Apr 2019 09:23:39 +0000 (14:53 +0530)]
networkd: Add support to configure destination address for bridge FDB
Closes #5145.
Example conf:
```
[Match]
Name=vxlan1309
[BridgeFDB]
MACAddress=00:00:00:00:00:00
Destination=10.0.0.2
[BridgeFDB]
MACAddress=00:00:00:00:00:00
Destination=10.0.0.4
[BridgeFDB]
MACAddress=00:00:00:00:00:00
Destination=10.0.0.5
```
Yu Watanabe [Thu, 2 May 2019 23:13:10 +0000 (01:13 +0200)]
network: fix assertion when link get carrier
This fixes a bug introduced by
bd08ce56156751d58584a44e766ef61340cdae2d.
When link is in LINK_STATE_INITIALIZED, `Link::network` may not be
set yet.
Fixes #12452.
Lennart Poettering [Tue, 30 Apr 2019 08:17:19 +0000 (10:17 +0200)]
test-alloc-util: let's test a few more things around GREEDY_REALLOC()
Lennart Poettering [Tue, 30 Apr 2019 08:13:57 +0000 (10:13 +0200)]
alloc-util: reintroduce malloc_usable_size() into greedy_realloc()
This is another attempt at
d4b604baeadbb2498e4f2c3e260260eed210f5d6 and #12438
Instead of blindly using the extra allocated space, let's do so only
after telling libc about it, via a second realloc(). The second
realloc() should be quick, since it never has to copy memory around.
Zbigniew Jędrzejewski-Szmek [Tue, 30 Apr 2019 06:37:07 +0000 (08:37 +0200)]
udev/cdrom_id: drop unneeded parentheses
Lennart Poettering [Tue, 30 Apr 2019 17:44:17 +0000 (19:44 +0200)]
Merge pull request #12218 from keszybz/use-libmount-more
Use libmount more
Franck Bui [Tue, 30 Apr 2019 14:10:13 +0000 (16:10 +0200)]
meson: make source files including nspawn-settings.h depend on libseccomp
Since nspawn-settings.h includes seccomp.h, any file that includes
nspawn-settings.h should depend on libseccomp so the correct header path where
seccomp.h lives is added to the header search paths.
It's especially important for distros such as openSUSE where seccomp.h is not
shipped in /usr/include but /usr/include/libseccomp.
This patch is similar to
8238423095ca54c48d9408a5da13e0325b31e6f6.
Yu Watanabe [Tue, 30 Apr 2019 16:45:29 +0000 (18:45 +0200)]
udev: drop unnecessary brackets
Follow-up for
ed0cb346821972ec2c505ee11ed3d383aba6256e.
Lennart Poettering [Tue, 30 Apr 2019 09:37:19 +0000 (11:37 +0200)]
Merge pull request #12420 from mrc0mmand/coccinelle-tweaks
Coccinelle improvements
Lennart Poettering [Tue, 30 Apr 2019 09:36:55 +0000 (11:36 +0200)]
Merge pull request #12439 from poettering/simplify-umask-util
simplify RUN_WITH_UMASK()
Lennart Poettering [Tue, 30 Apr 2019 07:53:09 +0000 (09:53 +0200)]
tests: add test for umask-util.h
Lennart Poettering [Tue, 30 Apr 2019 07:52:35 +0000 (09:52 +0200)]
umask-util: simplify RUN_WITH_UMASK()
Why have a struct to store the iteration bit if we actually have plenty
place in mode_t?
Frantisek Sumsal [Mon, 29 Apr 2019 14:12:41 +0000 (16:12 +0200)]
coccinelle: further restrict certain transformations
Some transformations generate results we don't want to keep, so
let's disable such transformations for specific files.
Also, disable const-strlen.cocci everywhere, as the STRLEN macro has a
pretty limited scope, so the transformation generates false positives in
most cases.
Frantisek Sumsal [Mon, 29 Apr 2019 11:15:27 +0000 (13:15 +0200)]
coccinelle: exclude JsonVariant* from the IN_SET transformation
JsonVariant* doesn't work with the current IN_SET implementation, so
let's exclude it from the transformation altogether
Frantisek Sumsal [Mon, 29 Apr 2019 16:22:22 +0000 (18:22 +0200)]
tree-wide: code improvements suggested by Coccinelle
Susant Sahani [Tue, 30 Apr 2019 07:36:10 +0000 (13:06 +0530)]
netword: fdb fix coding style
Zbigniew Jędrzejewski-Szmek [Tue, 30 Apr 2019 06:23:13 +0000 (08:23 +0200)]
Merge pull request #12434 from poettering/rm-rf-children-take-ptr
minor rm_rf_children() modernizations
Aaron Barany [Mon, 29 Apr 2019 22:00:30 +0000 (15:00 -0700)]
alloc-util: don't use malloc_usable_size() to determine allocated size
This reverts commit
d4b604baeadbb2498e4f2c3e260260eed210f5d6.
When realloc() is called, the extra memory between the originally
requested size and the end of malloc_usable_size() isn't copied. (at
least with the version of glibc that currently ships on Arch Linux)
As a result, some elements get lost and use uninitialized memory, most
commonly 0, and can lead to crashes.
fixes #12384
Lennart Poettering [Mon, 29 Apr 2019 19:34:42 +0000 (21:34 +0200)]
Merge pull request #12428 from jwrdegoede/hwdb-logitech-kbds
Hwdb: Add key-mappings for various wireless Logitech keyboards
Yuri Chornoivan [Mon, 29 Apr 2019 16:06:16 +0000 (19:06 +0300)]
Update Ukrainian translation
Lennart Poettering [Mon, 29 Apr 2019 17:07:24 +0000 (19:07 +0200)]
Merge pull request #12414 from keszybz/detect-podman
Detect podman as separate container type
Susant Sahani [Mon, 29 Apr 2019 05:02:34 +0000 (10:32 +0530)]
networkd: Add back static routes after DHCPv4 lease expires.
1. When the DHCPv4 lease expires kernel removes the route. So add it back
when we gain lease again.
Closes https://github.com/systemd/systemd/issues/12426
2. When UseRoutes=false do not remove router
Hans de Goede [Mon, 22 Apr 2019 07:15:40 +0000 (09:15 +0200)]
hwdb: Fix F12 mapping on the Logitech Internet Navigator
Many Logitech keyboards have the following special functions on F9-F12:
F9: file-browser F10: document-browser F11: image-browser F12:
music-browser. These should be bound to:
#define KEY_FILE 144 /* AL Local Machine Browser */
#define KEY_DOCUMENTS 235
#define KEY_IMAGES 0x1ba /* AL Image Browser */
#define KEY_AUDIO 0x188 /* AL Audio Browser */
This commit fixes the wrong binding of F12 to KEY_SOUND (which
translates to XF86AudioPreset) and removes the ?? comments from
both F11 and F12.
Hans de Goede [Sun, 28 Apr 2019 19:21:00 +0000 (21:21 +0200)]
hwdb: Add key mappings for Logitech MX5500 keyboard
Add support for various custom key-codes emitted by the Logitech MX5500
keyboard, both when attached through its Bluetooth-receiver in USB-HID
proxy mode; and when connected as a Bluetooth device.
Hans de Goede [Tue, 2 Apr 2019 15:23:12 +0000 (17:23 +0200)]
hwdb: Add key mappings for Logitech MX5000 keyboard
Add support for various custom key-codes emitted by the Logitech MX5000
keyboard, both when attached through its Bluetooth-receiver in USB-HID
proxy mode; and when connected as a Bluetooth device.
Hans de Goede [Fri, 5 Apr 2019 12:47:04 +0000 (14:47 +0200)]
hwdb: Add key mappings for Logitech 27 MHz S520 keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.
This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the S520 keyboard
(modelnumber Y-RBA97).
Hans de Goede [Fri, 5 Apr 2019 14:18:03 +0000 (16:18 +0200)]
hwdb: Add key mappings for Logitech 27 MHz EX100 keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.
This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the EX100 keyboard
(modelnumber Y-RBH94).
Hans de Goede [Thu, 4 Apr 2019 22:40:40 +0000 (00:40 +0200)]
hwdb: Add key mappings for Logitech 27 MHz MX3200 keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.
This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the MX3200 keyboard
(modelnumber Y-RAV80).
Hans de Goede [Wed, 3 Apr 2019 20:52:06 +0000 (22:52 +0200)]
hwdb: Add key mappings for Logitech 27 MHz MX3000 keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.
This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the MX3000 keyboard
(modelnumber Y-RAM74).
Hans de Goede [Fri, 29 Mar 2019 22:42:56 +0000 (23:42 +0100)]
hwdb: Add key mappings for Logitech 27 MHz "Cordless Rechargeable Desktop" keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.
This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the "Logitech Rechargeable
Desktop" keyboard (modelnumber Y-RK49).
Hans de Goede [Fri, 22 Mar 2019 21:10:32 +0000 (22:10 +0100)]
hwdb: Add key mappings for Logitech 27 MHz "Cordless Access Keyboard"
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.
This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the "Logitech Cordless
Access Keyboard" (modelnumber Y-RH35).
Hans de Goede [Thu, 4 Apr 2019 20:39:24 +0000 (22:39 +0200)]
hwdb: Add generic key mapping for Logitech 27 MHz keyboards
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.
This will allow us to add per model keymappings for the special keys on
these keyboards, which may differ per model.
This commit adds a default / fallback mapping, assigning the most common
meaning of the custom Logitech c10XX keycodes.
Lennart Poettering [Mon, 29 Apr 2019 14:10:51 +0000 (16:10 +0200)]
units: drop reference to sushell man page
sushell was a Fedoraism, and has been removed since. Hence our upstream
unit files shouldn't reference it either.
Ben Boeckel [Sat, 27 Apr 2019 00:22:40 +0000 (20:22 -0400)]
codespell: fix spelling errors
Lennart Poettering [Mon, 29 Apr 2019 14:21:01 +0000 (16:21 +0200)]
rm-rf: simplify rm_rf_children() a bit by using _cleanup_close_
Lennart Poettering [Mon, 29 Apr 2019 13:45:19 +0000 (15:45 +0200)]
switch-root: modernize rm_rf_children() invocation a bit
Frantisek Sumsal [Sun, 28 Apr 2019 18:43:00 +0000 (20:43 +0200)]
coccinelle: exclude certain paths from the transformations
There's no point in running these transformation for certain files,
mainly anything from src/boot/efi and src/shared/linux, as this code
doesn't have access to our internal utility functions
Frantisek Sumsal [Sun, 28 Apr 2019 15:13:29 +0000 (17:13 +0200)]
coccinelle: ignore function transformations causing recursion
For example, following transformation:
- isempty(s) ? NULL : s
+ empty_to_null(s)
would get applied to the empty_to_null function itself as well,
causing an infinite recursion, like:
--- src/basic/string-util.h
+++ /tmp/cocci-output-307-9f76e6-string-util.h
@@ -50,11 +50,11 @@ static inline bool isempty(const char *p
}
static inline const char *empty_to_null(const char *p) {
- return isempty(p) ? NULL : p;
+ return empty_to_null(p);
}
Let's avoid that by checking the current match position
Zbigniew Jędrzejewski-Szmek [Fri, 26 Apr 2019 12:13:53 +0000 (14:13 +0200)]
basic/virt: treat "podman" as separate container type
We would detect podman as container-other. Let's assign a name to it.
Inspired by https://github.com/containers/libpod/issues/2996.
Zbigniew Jędrzejewski-Szmek [Fri, 26 Apr 2019 11:37:31 +0000 (13:37 +0200)]
basic/virt: try the /proc/1/sched hack also for PID1
If a container manager does not set $container, we could end up
in a strange situation when detect-virt returns container-other when
run as non-pid-1 and none when run as pid-1.
Frantisek Sumsal [Sun, 28 Apr 2019 13:03:47 +0000 (15:03 +0200)]
coccinelle: ignore macro transformations in the macros themselves
For example, the following transformation:
- sizeof(s)-1
+ STRLEN(s)
would replace sizeof by STRLEN even in the STRLEN macro definition
itself, which generates following nonsensical patch:
--- src/basic/macro.h
+++ /tmp/cocci-output-8753-b50773-macro.h
@@ -182,7 +182,7 @@ static inline unsigned long ALIGN_POWER2
* Contrary to strlen(), this is a constant expression.
* @x: a string literal.
*/
-#define STRLEN(x) (sizeof(""x"") - 1)
+#define STRLEN(x) (STRLEN("" x ""))
/*
* container_of - cast a member of a structure out to the containing structure
Let's exclude the macro itself from the transformation to avoid this
Yu Watanabe [Sun, 28 Apr 2019 07:06:13 +0000 (09:06 +0200)]
network: drop invalid assertion
The link may not have corresponding .network file.
Note that in that case, link_ipv4ll_enabled() and link_dhcp4_enabled()
returns false. So, it is safe to drop the assertion.
Fixes #12422.
Lennart Poettering [Sun, 28 Apr 2019 15:43:54 +0000 (17:43 +0200)]
Merge pull request #12322 from ljmf00/hwdb-accel-location-patch
Add support for ACCEL_LOCATION udev property to deal with 2 sensors
Frantisek Sumsal [Sun, 28 Apr 2019 12:32:19 +0000 (14:32 +0200)]
tree-wide: drop !! casts to booleans
Done by coccinelle/bool-cast.cocci
Frantisek Sumsal [Sun, 28 Apr 2019 12:28:49 +0000 (14:28 +0200)]
tree-wide: replace explicit NULL checks with their shorter variants
Done by coccinelle/equals-null.cocci
Luís Ferreira [Sat, 13 Apr 2019 18:12:51 +0000 (19:12 +0100)]
hwdb: add ACCEL_LOCATION property to parse_hwdb.py
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Luís Ferreira [Sat, 13 Apr 2019 18:12:45 +0000 (19:12 +0100)]
hwdb: add ACCEL_LOCATION to the allowed properties
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Frantisek Sumsal [Sat, 27 Apr 2019 10:26:22 +0000 (12:26 +0200)]
coccinelle: avoid matching 'errno' as a file descriptor
The `coccinelle/take-fd.cocci` transformation file attempts to rewrite
r = fd;
fd = -1;
to
r = TAKE_FD(fd);
Unfortunately, using `identifier` or `idexpression` as a metavariable
type in this case wouldn't match more complex location descriptions,
like:
x->fd = fd
fd = -1;
Using 'expression' metavariable type generates false positives,
as you can't specify scope of such expression. The only real example
from the current codebase is the global 'errno' variable, which results
in following patch generated by `spatch`:
--- src/basic/errno-util.h
+++ /tmp/cocci-output-28263-971baa-errno-util.h
@@ -15,8 +15,7 @@ static inline void _reset_errno_(int *sa
#define UNPROTECT_ERRNO \
do { \
- errno = _saved_errno_; \
- _saved_errno_ = -1; \
+ errno = TAKE_FD(_saved_errno_); \
} while (false)
static inline int negative_errno(void) {
Let's explicitly state that the matched expression should not equal
'errno' to avoid this. It's not particularly nice, but it should be
enough, at least for now.
Frantisek Sumsal [Fri, 26 Apr 2019 19:42:16 +0000 (21:42 +0200)]
coccinelle: add explicit statement isomorphisms
Coccinelle needs a custom isomorphism file with rules (isomorphisms) how
to correctly rewrite conditions with explicit NULL checks (i.e.
if (ptr == NULL)) to their shorter form (i.e. if (!ptr)). Coccinelle
already contains such isomorphisms in its default .iso file, however,
they're in the opposite direction, which results in useless output from
coccinelle/equals-null.cocci.
With this fix, `spatch` should no longer report patches like:
@@ -628,8 +628,9 @@ static int path_deserialize_item(Unit *u
f = path_result_from_string(value);
if (f < 0)
log_unit_debug(u, "Failed to parse result value: %s", value);
- else if (f != PATH_SUCCESS)
- p->result = f;
+ else {if (f != PATH_SUCCESS)
+ p->result = f;
+ }
} else
log_unit_debug(u, "Unknown serialization key: %s", key);
Lennart Poettering [Fri, 26 Apr 2019 21:43:27 +0000 (23:43 +0200)]
Merge pull request #12407 from keszybz/two-unrelated-cleanups
Two unrelated cleanups
Ben Boeckel [Fri, 26 Apr 2019 19:15:09 +0000 (15:15 -0400)]
nspawn-expose-ports: fix a typo in error message
Yu Watanabe [Wed, 24 Apr 2019 19:52:13 +0000 (21:52 +0200)]
resolve: use bridge or bonding interfaces in degraded-carrier state
Fixes #12285.
Franck Bui [Thu, 25 Apr 2019 05:52:16 +0000 (07:52 +0200)]
sd-bus: bump message queue size again
Simliarly to issue #4068, the current limit turns out to be too small for a
big storage setup that uses many small disks. Let's bump it further.
Franck Bui [Wed, 24 Apr 2019 09:26:42 +0000 (11:26 +0200)]
udevd: notify when max number value of children is reached only once per batch of events
When booting with "udev.log-priority=debug" for example, the output might be
spammed with messages like this:
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
systemd-udevd[23545]: maximum number (248) of children reached
While the message itself is useful, printing it per batch of events should be
enough.
Zbigniew Jędrzejewski-Szmek [Fri, 26 Apr 2019 06:48:28 +0000 (08:48 +0200)]
Merge pull request #12394 from poettering/oncalendar-tweak
systemd-run --on-calendar= follow-up
Lennart Poettering [Tue, 16 Apr 2019 16:44:12 +0000 (18:44 +0200)]
chown-recursive: also check mode before we bypass
Lennart Poettering [Tue, 8 Jan 2019 17:34:38 +0000 (18:34 +0100)]
json: let's not accept embedded NUL bytes when allocating JSON strings
Let's add an additional paranoia check, and not accept embedded NUL
bytes in strings, just in case.