]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agotest: add test for new sd-bus refcnt logic 11472/head
Lennart Poettering [Thu, 17 Jan 2019 18:45:12 +0000 (19:45 +0100)] 
test: add test for new sd-bus refcnt logic

6 years agosd-bus: use "queue" message references for managing r/w message queues in connection...
Lennart Poettering [Thu, 17 Jan 2019 17:31:59 +0000 (18:31 +0100)] 
sd-bus: use "queue" message references for managing r/w message queues in connection objects

Let's make use of the new concept the previous commit added.

See: #4846

6 years agobus-message: introduce two kinds of references to bus messages
Lennart Poettering [Thu, 17 Jan 2019 17:18:54 +0000 (18:18 +0100)] 
bus-message: introduce two kinds of references to bus messages

Before this commit bus messages had a single reference count: when it
reached zero the message would be freed. This simple approach meant a
cyclic dependency was typically seen: a message that was enqueued in a
bus connection object would reference the bus connection object but also
itself be referenced by the bus connection object. So far out strategy
to avoid cases like this was: make sure to process the bus connection
regularly so that messages don#t stay queued, and at exit flush/close
the connection so that the message queued would be emptied, and thus the
cyclic dependencies resolved. Im many cases this isn't done properly
however.

With this change, let's address the issue more systematically: let's
break the reference cycle. Specifically, there are now two types of
references to a bus message:

1. A regular one, which keeps both the message and the bus object it is
   associated with pinned.

2. A "queue" reference, which is weaker: it pins the message, but not
   the bus object it is associated with.

The idea is then that regular user handling uses regular references, but
when a message is enqueued on its connection, then this takes a "queue"
reference instead. This then means that a queued message doesn't imply
the connection itself remains pinned, only regular references to the
connection or a message associated with it do. Thus, if we end up in the
situation where a user allocates a bus and a message and enqueues the
latter in the former and drops all refs to both, then this will detect
this case and free both.

Note that this scheme isn't perfect, it only covers references between
messages and the busses they are associated with. If OTOH a bus message
is enqueued on a different bus than it is associated with cyclic deps
cannot be recognized with this simple algorithm, and thus if you enqueue
a message associated with a bus A on a bus B, and another message
associated with bus B on a bus A, a cyclic ref will be in effect and not
be discovered. However, given that this is an exotic case (though one
that happens, consider systemd-bus-stdio-bridge), it should be OK not to
cover with this, and people have to explicit flush all queues on exit in
that case.

Note that this commit only establishes the separate reference counters
per message. A follow-up commit will start making use of this from the
bus connection object.

6 years agosd-bus: always go through sd_bus_unref() to free messages
Lennart Poettering [Thu, 17 Jan 2019 20:07:42 +0000 (21:07 +0100)] 
sd-bus: always go through sd_bus_unref() to free messages

Don't try to be smart, don't bypass the ref counting logic if there's no
real reason to.

This matters if we want to tweak the ref counting logic later.

6 years agosd-bus: drop two inappropriate empty lines
Lennart Poettering [Thu, 17 Jan 2019 17:18:18 +0000 (18:18 +0100)] 
sd-bus: drop two inappropriate empty lines

6 years agosd-bus: make sure dispatch_rqueue() initializes return parameter on all types of...
Lennart Poettering [Thu, 17 Jan 2019 17:15:37 +0000 (18:15 +0100)] 
sd-bus: make sure dispatch_rqueue() initializes return parameter on all types of success

Let's make sure our own code follows coding style and initializes all
return values on all types of success (and leaves it uninitialized in
all types of failure).

6 years agosd-bus: reorder bus ref and bus message ref handling
Lennart Poettering [Thu, 17 Jan 2019 17:14:17 +0000 (18:14 +0100)] 
sd-bus: reorder bus ref and bus message ref handling

Let's always place handling of these references together, so that all
reference counting during allocation is at a single place.

6 years agosd-bus: make rqueue/wqueue sizes of type size_t
Lennart Poettering [Thu, 17 Jan 2019 17:13:03 +0000 (18:13 +0100)] 
sd-bus: make rqueue/wqueue sizes of type size_t

Let's do this like we usually do and size arrays with size_t.

We already do this for the "allocated" counter correctly, and externally
we expose the queue sizes as uint64_t anyway, hence there's really no
point in usigned "unsigned" internally.

6 years agosd-bus: initialize mutex after we allocated the wqueue
Lennart Poettering [Thu, 17 Jan 2019 20:06:30 +0000 (21:06 +0100)] 
sd-bus: initialize mutex after we allocated the wqueue

That way the mutex doesn't have to be destroyed when we exit early due
to OOM.

6 years agotest: fix indenting off by one
Lennart Poettering [Thu, 17 Jan 2019 18:42:59 +0000 (19:42 +0100)] 
test: fix indenting off by one

6 years agoMerge pull request #11701 from poettering/discover-bls
Lennart Poettering [Fri, 1 Mar 2019 14:02:09 +0000 (15:02 +0100)] 
Merge pull request #11701 from poettering/discover-bls

sd-boot,bootctl,gpt-auto: support Extended Boot Loader Partition

6 years agoupdate TODO 11701/head
Lennart Poettering [Mon, 28 Jan 2019 18:54:09 +0000 (19:54 +0100)] 
update TODO

6 years agoman: document XBOOTLDR partition logic in bootctl's man page
Lennart Poettering [Tue, 12 Feb 2019 15:22:31 +0000 (16:22 +0100)] 
man: document XBOOTLDR partition logic in bootctl's man page

6 years agoman: document XBOOTLDR search logic for sd-boot
Lennart Poettering [Tue, 12 Feb 2019 15:13:57 +0000 (16:13 +0100)] 
man: document XBOOTLDR search logic for sd-boot

6 years agoman: extend systemd-gpt-auto-generator with XBOOTLDR info
Lennart Poettering [Tue, 12 Feb 2019 15:06:21 +0000 (16:06 +0100)] 
man: extend systemd-gpt-auto-generator with XBOOTLDR info

6 years agodocs: enclose all uuids in ``
Lennart Poettering [Tue, 12 Feb 2019 15:05:55 +0000 (16:05 +0100)] 
docs: enclose all uuids in ``

6 years agomeson: sort header list again
Lennart Poettering [Tue, 12 Feb 2019 13:39:34 +0000 (14:39 +0100)] 
meson: sort header list again

6 years agomkosi: let's update the boot loader also in /efi
Lennart Poettering [Fri, 8 Feb 2019 16:19:15 +0000 (17:19 +0100)] 
mkosi: let's update the boot loader also in /efi

This is after all where we preferable mount the ESP today.

6 years agobootspec: stat() on an autofs mount point doesn't trigger it, let's hence do it expli...
Lennart Poettering [Fri, 8 Feb 2019 16:18:48 +0000 (17:18 +0100)] 
bootspec: stat() on an autofs mount point doesn't trigger it, let's hence do it explicitly

6 years agostub: don't override LoaderDevicePartUUID EFI var
Lennart Poettering [Fri, 8 Feb 2019 15:51:58 +0000 (16:51 +0100)] 
stub: don't override LoaderDevicePartUUID EFI var

We document and all our code assumes that LoaderDevicePartUUID is
initialized to the ESP's UUID. Let's hence not override the variable if
it is already set, in order to not confuse userspace if the kernel's EFI
image is run from a different partition than the ESP.

This matches behaviour for all other variables set by the EFI stub, in
particular the closely related LoaderImageIdentifier variable.

6 years agostub: don't ask for variable data we actually don't care about
Lennart Poettering [Fri, 8 Feb 2019 15:49:09 +0000 (16:49 +0100)] 
stub: don't ask for variable data we actually don't care about

Let's take benefit of the fact that efivar_get_xyz() take NULL pointers
for the return data: let's shorten the code a bit.

6 years agostub: fix GUID to check EFI vars in
Lennart Poettering [Fri, 8 Feb 2019 15:46:51 +0000 (16:46 +0100)] 
stub: fix GUID to check EFI vars in

Our own variables are in the the "loader" GUID namespace, but our code
so far checked the "global" GUID namespace (i.e. EFI's own), before
setting the variables. Correct that, so that we always check the right
namespace for existing variables before we write them.

6 years agoefi: beef up efivar_get_xyz() to accept NULL return values
Lennart Poettering [Fri, 8 Feb 2019 15:23:40 +0000 (16:23 +0100)] 
efi: beef up efivar_get_xyz() to accept NULL return values

6 years agosd-boot: don't print error string where there's no error code known
Lennart Poettering [Fri, 8 Feb 2019 12:05:55 +0000 (13:05 +0100)] 
sd-boot: don't print error string where there's no error code known

6 years agosd-boot: also look for boot loader entries in the XBOOTLDR partition
Lennart Poettering [Fri, 8 Feb 2019 12:04:41 +0000 (13:04 +0100)] 
sd-boot: also look for boot loader entries in the XBOOTLDR partition

The specification always said so, let's actually implement this.

Unfortunately UEFI's own APIs don't allow us to search for partition
type GUID, hence we have to implement a minimal GPT parser ourselves.

6 years agosd-boot: don't dereference NULL ptr if loaded_image_path is NULL
Lennart Poettering [Fri, 8 Feb 2019 12:03:26 +0000 (13:03 +0100)] 
sd-boot: don't dereference NULL ptr if loaded_image_path is NULL

In a follow-up commit we'd like to invoke config_entry_add_from_file()
on partitions that are not the ESP, let's prepare fpr that and allow
loaded_image_path to be passed as NULL.

6 years agosd-boot: pass device handle to config_entry_add_linux()
Lennart Poettering [Wed, 6 Feb 2019 17:07:50 +0000 (18:07 +0100)] 
sd-boot: pass device handle to config_entry_add_linux()

This makes the code a bit simpler (after all the call is not interested
in the loaded image, just where it is found), and more like
config_load_entries() which takes the same arguments.

This also makes things easier for us later on, when we add support for
discovering images in $XBOOTLDR partitions.

6 years agobootspec: only sort entries list once
Lennart Poettering [Wed, 6 Feb 2019 16:53:43 +0000 (17:53 +0100)] 
bootspec: only sort entries list once

Instead of re-sorting entries list each time we loaded enrties from a
specific source, let's just sort them once at the end.

6 years agobootspec: also look for boot loader spec type 2 entries (i.e. unified kernel images)
Lennart Poettering [Wed, 6 Feb 2019 16:49:37 +0000 (17:49 +0100)] 
bootspec: also look for boot loader spec type 2 entries (i.e. unified kernel images)

sd-boot reads them, and hence we should from our userspace side too

6 years agobootctl: properly handle readdir() errors
Lennart Poettering [Wed, 6 Feb 2019 16:48:40 +0000 (17:48 +0100)] 
bootctl: properly handle readdir() errors

6 years agobootctl: let's make sure we always add empty line after EFI binary output
Lennart Poettering [Tue, 5 Feb 2019 18:15:21 +0000 (19:15 +0100)] 
bootctl: let's make sure we always add empty line after EFI binary output

Let's make sure we output another "\n", even if we fail this function,
so that the output we started is separated properly from what is
following.

6 years agobootspec: use verify_fsroot_dir() in verify_xbootldr() too
Lennart Poettering [Tue, 5 Feb 2019 18:11:31 +0000 (19:11 +0100)] 
bootspec: use verify_fsroot_dir() in verify_xbootldr() too

Let's share some code between verify_xbootldr() and verify_esp().

6 years agobootspec: also optoinally validate XBOOTLDR partition with udev insteado of blkid
Lennart Poettering [Tue, 5 Feb 2019 18:02:03 +0000 (19:02 +0100)] 
bootspec: also optoinally validate XBOOTLDR partition with udev insteado of blkid

6 years agobootspec: split out code that validates whether directory is top-level dir of fs
Lennart Poettering [Tue, 5 Feb 2019 17:52:24 +0000 (18:52 +0100)] 
bootspec: split out code that validates whether directory is top-level dir of fs

Let's add a new function that checks whether some directory is the
top-level directory inside an fs, splitting out the code for this from
verify_esp().

While we are at it, let's slightly improve the code, so that we can
correctly work if we have no priviliges but the ESP is mounted
unaccessible: if we can't stat() the path "$ESP/.." then manually remove
the last component of $ESP and check that instead. Which is very similar
in behaviour, and hopefully good enough in the unprivileged case.

6 years agobootspec: if unprivileged validate partition data with udev rather than blkid directly
Lennart Poettering [Tue, 5 Feb 2019 17:45:41 +0000 (18:45 +0100)] 
bootspec: if unprivileged validate partition data with udev rather than blkid directly

udev metadata access works unprivileged, which the blkid stuff doesn't
(as that needs raw device node access). Hence let's use udev if we lack
privs, and raw device access only if root.

6 years agobootspec: also split out XBOOTLDR partition blkid code into its own function
Lennart Poettering [Tue, 5 Feb 2019 17:17:01 +0000 (18:17 +0100)] 
bootspec: also split out XBOOTLDR partition blkid code into its own function

6 years agobootspec: split out ESP blkid validation into function of its own
Lennart Poettering [Wed, 30 Jan 2019 17:24:59 +0000 (18:24 +0100)] 
bootspec: split out ESP blkid validation into function of its own

This makes it easier to add an alternative implementation for this that
uses sd-device instead of blkid directly.

6 years agobootspec: add comment explaining verify_esp() return codes
Lennart Poettering [Tue, 29 Jan 2019 11:01:36 +0000 (12:01 +0100)] 
bootspec: add comment explaining verify_esp() return codes

6 years agobootspec: use SYNTHETIC_ERRNO() where appropriate
Lennart Poettering [Mon, 28 Jan 2019 19:08:34 +0000 (20:08 +0100)] 
bootspec: use SYNTHETIC_ERRNO() where appropriate

6 years agoboot-bless: port over to new $BOOT discovery calls
Lennart Poettering [Wed, 23 Jan 2019 16:05:15 +0000 (17:05 +0100)] 
boot-bless: port over to new $BOOT discovery calls

6 years agobootctl: output where we found $BOOT
Lennart Poettering [Wed, 23 Jan 2019 15:59:28 +0000 (16:59 +0100)] 
bootctl: output where we found $BOOT

6 years agobootctl: teach bootctl the new partition type
Lennart Poettering [Wed, 23 Jan 2019 15:18:29 +0000 (16:18 +0100)] 
bootctl: teach bootctl the new partition type

6 years agobootspec: load entries from both the ESP and XBOOTLDR partitions
Lennart Poettering [Mon, 28 Jan 2019 17:56:53 +0000 (18:56 +0100)] 
bootspec: load entries from both the ESP and XBOOTLDR partitions

Let's simply search in both.

6 years agosystemctl: add missing OOM checks
Lennart Poettering [Mon, 28 Jan 2019 18:30:42 +0000 (19:30 +0100)] 
systemctl: add missing OOM checks

6 years agosystemctl: use SYNTHETIC_ERRNO() where appropriate
Lennart Poettering [Mon, 28 Jan 2019 18:30:30 +0000 (19:30 +0100)] 
systemctl: use SYNTHETIC_ERRNO() where appropriate

6 years agosystemctl: drop arg_esp_path variable from systemctl
Lennart Poettering [Mon, 28 Jan 2019 17:47:01 +0000 (18:47 +0100)] 
systemctl: drop arg_esp_path variable from systemctl

It's not set ever (and there's no real need to make it settable, since
users can as well set $SYSTEMD_ESP_PATH to configure this.

6 years agobootspec: store 'root' field in each bootspec entry we load
Lennart Poettering [Mon, 28 Jan 2019 16:57:41 +0000 (17:57 +0100)] 
bootspec: store 'root' field in each bootspec entry we load

This 'root' field contains the root path of the partition we found the
snippet in. The 'kernel', 'initrd', 'efi', … fields are relative to this
path.

This becomes particularly useful later when we add support for loading
snippets from both the ESP and XBOOTLDR, but already simplifies the code
for us a bit in systemctl.

6 years agobootspec: add internal APIs to discover the XBOOTLDR partition
Lennart Poettering [Wed, 23 Jan 2019 13:19:40 +0000 (14:19 +0100)] 
bootspec: add internal APIs to discover the XBOOTLDR partition

6 years agogpt-auto: also load the boot loader partition during regular boots
Lennart Poettering [Wed, 23 Jan 2019 12:19:41 +0000 (13:19 +0100)] 
gpt-auto: also load the boot loader partition during regular boots

6 years agodissect: when mounting an image mount the XBOOTLDR partition to /boot
Lennart Poettering [Wed, 23 Jan 2019 10:53:28 +0000 (11:53 +0100)] 
dissect: when mounting an image mount the XBOOTLDR partition to /boot

Previously, we'd mount the ESP to /efi if that existed and was empty,
falling back to /boot if that existed and was empty.

With this change, the XBOOTLDR partition is mounted to /boot
unconditionally. And the EFI is mounted to /efi if that exists (but it
doesn't have to be empty — after all the name is very indicative of what
this is supposed to be), and to /boot as a fallback but only if it
exists and is empty (we insist on emptiness for that, since it might be
used differently than what we assume).

The net effect is that $BOOT should be reliably found under /boot, and
the ESP is either /efi or /boot.

(Note that this commit only is relevant for nspawn and suchlike, i.e.
the codepaths that mount an image without involving udev during boot.)

6 years agodissect: automatically detect boot loader spec $BOOT partition
Lennart Poettering [Wed, 23 Jan 2019 10:34:31 +0000 (11:34 +0100)] 
dissect: automatically detect boot loader spec $BOOT partition

The boot loader spec supports two places to store boot loader
configuration: the ESP and a generic replacement for it in case the ESP
is not available or not suitable. Let's look for both.

6 years agogpt: add definition for boot loader spec partition
Lennart Poettering [Tue, 22 Jan 2019 19:57:11 +0000 (20:57 +0100)] 
gpt: add definition for boot loader spec partition

As listed in the boot loader spec since a long time:

https://systemd.io/BOOT_LOADER_SPECIFICATION#technical-details

6 years agobootctl: safety check for regular file when reading EFI images
Lennart Poettering [Mon, 28 Jan 2019 16:33:08 +0000 (17:33 +0100)] 
bootctl: safety check for regular file when reading EFI images

6 years agobootctl: use SYNTHETIC_ERRNO() where appropriate
Lennart Poettering [Mon, 28 Jan 2019 16:32:46 +0000 (17:32 +0100)] 
bootctl: use SYNTHETIC_ERRNO() where appropriate

6 years agodissect: use SYNTHETIC_ERRNO() where appropriate
Lennart Poettering [Wed, 23 Jan 2019 15:59:57 +0000 (16:59 +0100)] 
dissect: use SYNTHETIC_ERRNO() where appropriate

6 years agobootspec: use SYNTHETIC_ERRNO() at one more place
Lennart Poettering [Mon, 28 Jan 2019 16:32:04 +0000 (17:32 +0100)] 
bootspec: use SYNTHETIC_ERRNO() at one more place

6 years agobootspec: update log message, to indicate the error is ignored
Lennart Poettering [Mon, 28 Jan 2019 16:34:17 +0000 (17:34 +0100)] 
bootspec: update log message, to indicate the error is ignored

6 years agofs-util: add new helper syncfs_path()
Lennart Poettering [Wed, 23 Jan 2019 15:08:55 +0000 (16:08 +0100)] 
fs-util: add new helper syncfs_path()

6 years agoenv-file: (void)ify an unlink() call
Lennart Poettering [Wed, 6 Feb 2019 16:48:21 +0000 (17:48 +0100)] 
env-file: (void)ify an unlink() call

6 years agojson: don't call va_end() twice in json_build()
Lennart Poettering [Fri, 1 Mar 2019 10:00:06 +0000 (11:00 +0100)] 
json: don't call va_end() twice in json_build()

This was apparently left-over when json_buildv() was added, and
json_build() just became a wrapper for it.

6 years agosemaphoreci: Run subset of autopkgtests in LXC (#11814)
Martin Pitt [Fri, 1 Mar 2019 09:01:09 +0000 (10:01 +0100)] 
semaphoreci: Run subset of autopkgtests in LXC (#11814)

Run build/test in LXC for now, as full nested QEMU is too brittle right
now: https://github.com/semaphoreci/semaphore/issues/37
But this at least runs some tests. It ensures that systemd generally
works in containers, as well as provides some backup results if the main
Ubuntu CI is down.

6 years agoMerge pull request #11852 from keszybz/coverity-memory-issues
Lennart Poettering [Thu, 28 Feb 2019 18:04:04 +0000 (19:04 +0100)] 
Merge pull request #11852 from keszybz/coverity-memory-issues

Two small fixes for memory issues found by coverity

6 years agoMerge pull request #11856 from xtopherwong/new-time-zone-list
Lennart Poettering [Thu, 28 Feb 2019 17:57:26 +0000 (18:57 +0100)] 
Merge pull request #11856 from xtopherwong/new-time-zone-list

Use new time zone list

6 years agoMerge pull request #11857 from rossburton/acrn
Lennart Poettering [Thu, 28 Feb 2019 17:56:48 +0000 (18:56 +0100)] 
Merge pull request #11857 from rossburton/acrn

virt: detect the ACRN hypervisor

6 years agoMerge pull request #11834 from martinpitt/network-test-fixes
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 16:48:41 +0000 (17:48 +0100)] 
Merge pull request #11834 from martinpitt/network-test-fixes

networkd-test fix/improvement

6 years agoman: add ACRN hypervisor 11857/head
Ross Burton [Thu, 28 Feb 2019 15:36:50 +0000 (15:36 +0000)] 
man: add ACRN hypervisor

6 years agoBetter C code formatting of arguments in Emacs
Jörg Sommer [Thu, 28 Feb 2019 14:53:40 +0000 (15:53 +0100)] 
Better C code formatting of arguments in Emacs

In [PR#11696][1] it came up that the formatting of continued arguments should
follow the default Emacs style. To ensure this happens when someone has changed
his setting in her private config, the value should be set by *dir-locals.el*.

[1]: https://github.com/systemd/systemd/pull/11696#pullrequestreview-205463987

6 years agoMerge pull request #11853 from keszybz/man-rules-update
Lennart Poettering [Thu, 28 Feb 2019 15:17:59 +0000 (16:17 +0100)] 
Merge pull request #11853 from keszybz/man-rules-update

man/rules update

6 years agovirt: detect the ACRN hypervisor
Ross Burton [Wed, 30 Jan 2019 16:40:41 +0000 (16:40 +0000)] 
virt: detect the ACRN hypervisor

Add magic string and enumeration for the ACRN hypervisor
(https://projectacrn.org).

6 years agotest-time-util: use standard intro and print timezones read from file 11856/head
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 14:38:16 +0000 (15:38 +0100)] 
test-time-util: use standard intro and print timezones read from file

The asserts are OK, but it's also nice to see the list by eye.

6 years agoREADME: mention that we need tzdata >= 2014f
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 14:37:06 +0000 (15:37 +0100)] 
README: mention that we need tzdata >= 2014f

zone1970.tab was added in that version. Not that it makes sense to use
outdata timezone tables, but people do strange things.

C.f. https://github.com/nodatime/nodatime/issues/319.

6 years agoman/shutdown: Fix grammar
Theo Ouzhinski [Thu, 28 Feb 2019 13:42:28 +0000 (08:42 -0500)] 
man/shutdown: Fix grammar

6 years agoUse new time zone list
Christopher Wong [Thu, 28 Feb 2019 13:22:42 +0000 (14:22 +0100)] 
Use new time zone list

When systemd retrieve the time zone it read what is in the file
/usr/share/zoneinfo/zone.tab provided by the Time Zone Database.
According to the comments in zone.tab its content is for backward-
compatibility aid for older programs. New programs should use
zone1970.tab. This patch replaces zone.tab with zone1970.tab.

6 years agosd-bus: deal with cookie overruns
Lennart Poettering [Mon, 25 Feb 2019 10:02:46 +0000 (11:02 +0100)] 
sd-bus: deal with cookie overruns

Apparently this happens IRL. Let's carefully deal with issues like this:
when we overrun, let's not go back to zero but instead leave the highest
cookie bit set. We use that as indication that we are in "overrun
territory", and then are particularly careful with checking cookies,
i.e. that they haven't been used for still outstanding replies yet. This
should retain the quick cookie generation behaviour we used to have, but
permits dealing with overruns.

Replaces: #11804
Fixes: #11809
6 years agoman: create .so links for sd_bus_close_{unref,unrefp} 11853/head
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 12:09:58 +0000 (13:09 +0100)] 
man: create .so links for sd_bus_close_{unref,unrefp}

Follow-up for bd62b7448623fbe36665e089977731efb55524c0.

6 years agomeson: remove workaround for old meson bug with command quoting
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 12:06:52 +0000 (13:06 +0100)] 
meson: remove workaround for old meson bug with command quoting

Those bugs were fixed a long time ago. Let's take advantage of this and use the
usual $() syntax.

6 years agoMerge pull request #11840 from yuwata/network-route-onlink
Lennart Poettering [Thu, 28 Feb 2019 11:02:08 +0000 (12:02 +0100)] 
Merge pull request #11840 from yuwata/network-route-onlink

network: enable GatewayOnLink= if no static address is configured

6 years agoudev-builtin-usb_id: guard against overflow when reading descriptor data 11852/head
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 10:57:51 +0000 (11:57 +0100)] 
udev-builtin-usb_id: guard against overflow when reading descriptor data

CID#996458. Coverity warns that we trust desc->bLength as read in
the input data to adjust our position in the buffer. This value could
be anything, leading to overflow. It's unlikely that the kernel feeds
us invalid data, but let's me more careful.

If any error is encountered, more logs are given.

6 years agoudev-builtin-usb_id: use strjoina to simplify code
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 10:40:44 +0000 (11:40 +0100)] 
udev-builtin-usb_id: use strjoina to simplify code

6 years agoshared/install: do not use a temporary variable outside of its scope
Zbigniew Jędrzejewski-Szmek [Thu, 28 Feb 2019 10:29:38 +0000 (11:29 +0100)] 
shared/install: do not use a temporary variable outside of its scope

Coverity says:
> Pointer to local outside scope (RETURN_LOCAL)9.
> use_invalid: Using dirs, which points to an out-of-scope temporary variable of type char const *[5].

And indeed, the switch statement forms a scope. Let's use an if to
avoid creating a scope.

6 years agofuzz: do not assume the existence of /sys/class/net/lo
Yu Watanabe [Thu, 28 Feb 2019 05:02:33 +0000 (14:02 +0900)] 
fuzz: do not assume the existence of /sys/class/net/lo

Hopefully fixes oss-fuzz#13440.

6 years agonetwork: wrap long lines 11840/head
Yu Watanabe [Thu, 28 Feb 2019 01:57:20 +0000 (10:57 +0900)] 
network: wrap long lines

6 years agonetwork: simplify config_parse_lifetime()
Yu Watanabe [Thu, 28 Feb 2019 01:56:33 +0000 (10:56 +0900)] 
network: simplify config_parse_lifetime()

6 years agonetwork: avoid address section freed
Yu Watanabe [Thu, 28 Feb 2019 01:54:17 +0000 (10:54 +0900)] 
network: avoid address section freed

Otherwise, if HomeAddress= or friends are specified at the first line of
a section, then its assignment will be ignored.

6 years agonetwork: cleanup logging in route related config parsers
Yu Watanabe [Thu, 28 Feb 2019 01:39:14 +0000 (10:39 +0900)] 
network: cleanup logging in route related config parsers

6 years agonetwork: do not override previously specified family
Yu Watanabe [Thu, 28 Feb 2019 01:37:58 +0000 (10:37 +0900)] 
network: do not override previously specified family

6 years agotest-network: add testcase for #1850
Yu Watanabe [Wed, 27 Feb 2019 10:10:47 +0000 (19:10 +0900)] 
test-network: add testcase for #1850

6 years agonetwork: enable GatewayOnLink= if Gateway= without static address configured
Yu Watanabe [Wed, 27 Feb 2019 09:41:49 +0000 (18:41 +0900)] 
network: enable GatewayOnLink= if Gateway= without static address configured

And warn about that.

But this only done if GatewayOnLink= is not specified. When it is
explicitly disabled, then the flag will not be set.

6 years agonetwork: save GatewayOnLink= value as tristate in Route
Yu Watanabe [Thu, 28 Feb 2019 01:10:38 +0000 (10:10 +0900)] 
network: save GatewayOnLink= value as tristate in Route

This should not change any behavior. But used in the later commit.

6 years agonetwork: relax the .network file check
Yu Watanabe [Wed, 27 Feb 2019 09:22:40 +0000 (18:22 +0900)] 
network: relax the .network file check

Previously, if a .networ file contains invalid [Address] or [Route]
section, then the file is completely dropped. This makes networkd
just drops invalid sections.

6 years agonetwork: rename GatewayOnlink= to GatewayOnLink=
Yu Watanabe [Wed, 27 Feb 2019 08:43:08 +0000 (17:43 +0900)] 
network: rename GatewayOnlink= to GatewayOnLink=

But still GatewayOnlink= is supported for backward compatibility.

6 years agonetworkd-test: ignore failures of test_route_only_dns* in containers 11834/head
Martin Pitt [Wed, 27 Feb 2019 22:15:31 +0000 (23:15 +0100)] 
networkd-test: ignore failures of test_route_only_dns* in containers

This test exposes a race condition when running in LXC, see issue #11848
for details. Until that is understood and fixed, skip the test as it's
not a recent regression.

6 years agonetworkd-test: specify Address= with prefix length
Martin Pitt [Tue, 26 Feb 2019 22:05:05 +0000 (23:05 +0100)] 
networkd-test: specify Address= with prefix length

This avoids a warning:

    An address '192.168.42.100' is specified without prefix length. The
    behavior of parsing addresses without prefix length will be changed
    in the future release. Please specify prefix length explicitly.

6 years agonetworkd-test: show service journal on startup failure
Martin Pitt [Tue, 26 Feb 2019 22:03:35 +0000 (23:03 +0100)] 
networkd-test: show service journal on startup failure

This provides easier evaluation of failed tests.

6 years agoMerge pull request #11795 from yuwata/fix-network-routing-policy-11280
Lennart Poettering [Wed, 27 Feb 2019 17:43:56 +0000 (18:43 +0100)] 
Merge pull request #11795 from yuwata/fix-network-routing-policy-11280

network: fix routing policy rule issue #11280

6 years agojournalctl: New option --cursor-file
Jörg Sommer [Mon, 11 Feb 2019 23:19:13 +0000 (00:19 +0100)] 
journalctl: New option --cursor-file

The option cursor-file takes a filename as argument. If the file exists and
contains a valid cursor, this is used to start the output after this position.
At the end, the last cursor gets written to the file.

This allows for an easy implementation of a timer that regularly looks in the
journal for some messages.

    journalctl --cursor-file err-cursor -b -p err
    journalctl --cursor-file audit-cursor -t audit --grep DENIED

Or you might want to walk the journal in steps of 10 messages:

    journalctl --cursor-file ./curs -n10 --since=today -t systemd

6 years agoMerge pull request #11844 from keszybz/networkd-fuzzer-fixes
Lennart Poettering [Wed, 27 Feb 2019 16:45:55 +0000 (17:45 +0100)] 
Merge pull request #11844 from keszybz/networkd-fuzzer-fixes

Networkd fuzzer fixes

6 years agoMerge pull request #11807 from yuwata/test-vlan-mtu
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 16:15:29 +0000 (17:15 +0100)] 
Merge pull request #11807 from yuwata/test-vlan-mtu

network: increase MTU if VLAN= or MACVLAN= requests higher value

6 years agoanalyze security: check for ProtectHostname=yes
Topi Miettinen [Wed, 27 Feb 2019 13:26:43 +0000 (15:26 +0200)] 
analyze security: check for ProtectHostname=yes

6 years agonetworkd: refuse more than 128 NTP servers 11844/head
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 13:45:29 +0000 (14:45 +0100)] 
networkd: refuse more than 128 NTP servers

This test case is a bit silly, but it shows that our code is unprepared to
handle so many network servers, with quadratic complexity in various places.
I don't think there are any valid reasons to have hundres of NTP servers
configured, so let's just emit a warning and cut the list short.

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13354