]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
8 years agolz4: fix size check which had no chance of working on big-endian 2084/head
Zbigniew Jędrzejewski-Szmek [Wed, 2 Dec 2015 03:53:23 +0000 (22:53 -0500)] 
lz4: fix size check which had no chance of working on big-endian

8 years agotests: fix newlines in skip message
Zbigniew Jędrzejewski-Szmek [Wed, 2 Dec 2015 04:44:27 +0000 (23:44 -0500)] 
tests: fix newlines in skip message

8 years agotests: turn check if manager cannot be intialized into macro
Zbigniew Jędrzejewski-Szmek [Wed, 2 Dec 2015 03:35:16 +0000 (22:35 -0500)] 
tests: turn check if manager cannot be intialized into macro

We need to check the same thing in multiple tests. Use a shared
macro to make it easier to update the list of errnos.

Change the errno code for "unitialized cgroup fs" for ENOMEDIUM.
Exec format error looks like something more serious.

This fixes test-execute invocation in mock.

8 years agobasic/virt: add missing includes to compile on ppc64
Zbigniew Jędrzejewski-Szmek [Wed, 2 Dec 2015 03:54:26 +0000 (22:54 -0500)] 
basic/virt: add missing includes to compile on ppc64

8 years agoMerge pull request #2082 from phomes/basic-sort-includes
Tom Gundersen [Tue, 1 Dec 2015 23:27:02 +0000 (00:27 +0100)] 
Merge pull request #2082 from phomes/basic-sort-includes

basic: re-sort includes

8 years agobasic: re-sort includes 2082/head
Thomas Hindoe Paaboel Andersen [Tue, 1 Dec 2015 22:22:03 +0000 (23:22 +0100)] 
basic: re-sort includes

My previous patch to only include what we use accidentially placed
the added inlcudes in non-sorted order.

8 years agoMerge pull request #2074 from keszybz/test-acl-util-fix
Tom Gundersen [Mon, 30 Nov 2015 23:25:47 +0000 (00:25 +0100)] 
Merge pull request #2074 from keszybz/test-acl-util-fix

test-acl-util: fix two issues from review

8 years agoMerge pull request #2075 from phomes/includes-cleanup-basic
Tom Gundersen [Mon, 30 Nov 2015 23:25:07 +0000 (00:25 +0100)] 
Merge pull request #2075 from phomes/includes-cleanup-basic

basic: include only what we use

8 years agobasic: include only what we use 2075/head
Thomas Hindoe Paaboel Andersen [Mon, 30 Nov 2015 20:43:37 +0000 (21:43 +0100)] 
basic: include only what we use

This is a cleaned up result of running iwyu but without forward
declarations on src/basic.

8 years agotest-acl-util: fix two issues from review 2074/head
Zbigniew Jędrzejewski-Szmek [Mon, 30 Nov 2015 20:45:39 +0000 (15:45 -0500)] 
test-acl-util: fix two issues from review

https://github.com/systemd/systemd/pull/2063

8 years agoMerge pull request #2068 from grawity/cgls-error-v2
Lennart Poettering [Mon, 30 Nov 2015 18:32:19 +0000 (19:32 +0100)] 
Merge pull request #2068 from grawity/cgls-error-v2

cgls: add a better error message for missing cgroupfs [v2]

8 years agoMerge pull request #2053 from poettering/selinux-fix
David Herrmann [Mon, 30 Nov 2015 18:30:03 +0000 (19:30 +0100)] 
Merge pull request #2053 from poettering/selinux-fix

Two unrelated fixes

8 years agocgls: add a better error message for missing cgroupfs 2068/head
Mantas Mikulėnas [Mon, 30 Nov 2015 06:48:29 +0000 (08:48 +0200)] 
cgls: add a better error message for missing cgroupfs

8 years agoMerge pull request #2063 from keszybz/issue-1977-2
Lennart Poettering [Mon, 30 Nov 2015 16:53:39 +0000 (17:53 +0100)] 
Merge pull request #2063 from keszybz/issue-1977-2

journal: clean up permission setting and acl adjustements on user journals

8 years agotmpfiles: set acls on system.journal explicitly 2063/head
Zbigniew Jędrzejewski-Szmek [Sun, 29 Nov 2015 23:48:40 +0000 (18:48 -0500)] 
tmpfiles: set acls on system.journal explicitly

https://github.com/systemd/systemd/issues/1397

8 years agotmpfiles: also set acls on /var/log/journal
Zbigniew Jędrzejewski-Szmek [Sun, 29 Nov 2015 23:37:01 +0000 (18:37 -0500)] 
tmpfiles: also set acls on /var/log/journal

This way, directories created later for containers or for
journald-remote, will be readable by adm & wheel groups by default,
similarly to /var/log/journal/%m itself.

https://github.com/systemd/systemd/issues/1971

8 years agoMerge pull request #2058 from phomes/unused-variable2
Ronny Chevalier [Sun, 29 Nov 2015 14:43:02 +0000 (15:43 +0100)] 
Merge pull request #2058 from phomes/unused-variable2

tree-wide: remove unused variables

8 years agotree-wide: remove unused variables 2058/head
Thomas Hindoe Paaboel Andersen [Sun, 29 Nov 2015 07:58:31 +0000 (08:58 +0100)] 
tree-wide: remove unused variables

8 years agoacl-util: only set the mask if not present
Zbigniew Jędrzejewski-Szmek [Sat, 28 Nov 2015 23:41:08 +0000 (18:41 -0500)] 
acl-util: only set the mask if not present

When we have non-owner user or group entries, we need the mask
for the acl to be valid. But acl_calc_mask() calculates the mask
to include all permissions, even those that were masked before.
Apparently this happens when we inherit *:r-x permissions from
a parent directory — the kernel sets *:r-x, mask:r--, effectively
masking the executable bit. acl_calc_mask() would set the mask:r-x,
effectively enabling the bit. To avoid this, be more conservative when
to add the mask entry: first iterate over all entries, and do nothing
if a mask.

This returns the code closer to J.A.Steffens' original version
in v204-90-g23ad4dd884.

Should fix https://github.com/systemd/systemd/issues/1977.

8 years agotest-acl-util: add new test
Zbigniew Jędrzejewski-Szmek [Sat, 28 Nov 2015 05:04:40 +0000 (00:04 -0500)] 
test-acl-util: add new test

For now, only add_acls_for_user is tested. When run under root, it
actually sets the acls. When run under non-root, it sets the acls for
the user, which does nothing, but at least calls the functions.

8 years agojournal: move the gist of server_fix_perms to acl-util.[hc]
Zbigniew Jędrzejewski-Szmek [Sat, 28 Nov 2015 03:24:33 +0000 (22:24 -0500)] 
journal: move the gist of server_fix_perms to acl-util.[hc]

Most of the function is moved to acl-util.c to make it possible to
add tests in subsequent commit.

Setting of the mode in server_fix_perms is removed:
- we either just created the file ourselves, and the permission be better right,
- or the file was already there, and we should not modify the permissions.

server_fix_perms is renamed to server_fix_acls to better reflect new
meaning, and made static because it is only used in one file.

8 years agolibsystemd: make sure we prefix even the dirty secrets in our API with "_sd_" 2053/head
Lennart Poettering [Fri, 27 Nov 2015 19:29:42 +0000 (20:29 +0100)] 
libsystemd: make sure we prefix even the dirty secrets in our API with "_sd_"

This renames __useless_struct_to_allow_trailing_semicolon__ everywhere
to _sd_useless_struct_to_allow_trailing_semicolon_, to follow our usual
rule of prefixing stuff from public headers that should be considered
internal with "_sd_".

While we are at it, also to be safe: when the struct is used in the C++
protector macros make sure to use two different names depending on
whether it appears in the C++ or C side of things. After all, there
might be compilers that don't consider C++ and C structs the same.

See https://github.com/systemd/systemd/pull/2052#discussion_r46067059

8 years agoselinux: split up mac_selinux_have() from mac_selinux_use()
Lennart Poettering [Fri, 27 Nov 2015 19:22:56 +0000 (20:22 +0100)] 
selinux: split up mac_selinux_have() from mac_selinux_use()

Let's distuingish the cases where our code takes an active role in
selinux management, or just passively reports whatever selinux
properties are set.

mac_selinux_have() now checks whether selinux is around for the passive
stuff, and mac_selinux_use() for the active stuff. The latter checks the
former, plus also checks UID == 0, under the assumption that only when
we run priviliged selinux management really makes sense.

Fixes: #1941
8 years agoMerge pull request #2052 from poettering/export-cleanup
David Herrmann [Fri, 27 Nov 2015 19:26:33 +0000 (20:26 +0100)] 
Merge pull request #2052 from poettering/export-cleanup

Make gcc cleanup helper calls public in most of our sd-xyz APIs

8 years agoMerge pull request #2043 from teg/resolved-edns0-5
Lennart Poettering [Fri, 27 Nov 2015 18:29:04 +0000 (19:29 +0100)] 
Merge pull request #2043 from teg/resolved-edns0-5

resolved: add edns0 support

8 years agoresolved: add one more comment with a link to the matching RFC 2052/head
Lennart Poettering [Fri, 27 Nov 2015 18:22:35 +0000 (19:22 +0100)] 
resolved: add one more comment with a link to the matching RFC

8 years agoutil-lib: move nss-util.h from shared/ to basic/
Lennart Poettering [Fri, 27 Nov 2015 18:21:15 +0000 (19:21 +0100)] 
util-lib: move nss-util.h from shared/ to basic/

The header file defines some helpers for GLIBC NSS and doesn't include
anything else but glibc headers, hence there's little reason to keep it
in shared/.

See: #2008

8 years agotree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
Lennart Poettering [Fri, 27 Nov 2015 18:13:45 +0000 (19:13 +0100)] 
tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy

GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.

With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.

The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).

This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.

Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:

       #define _cleanup_(function) __attribute__((cleanup(function)))

Or similar, to make the gcc feature easier to use.

Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.

See #2008.

8 years agoMerge pull request #2049 from evverx/journal-test-dont-run-on-incomplete-setup
Daniel Mack [Fri, 27 Nov 2015 14:26:21 +0000 (15:26 +0100)] 
Merge pull request #2049 from evverx/journal-test-dont-run-on-incomplete-setup

tests: don't run test on incomplete setup; use sync

8 years agotests: use sync instead of flush 2049/head
Evgeny Vereshchagin [Fri, 27 Nov 2015 13:55:23 +0000 (13:55 +0000)] 
tests: use sync instead of flush

flush doesn't sync a journal -> tests sometimes fail

8 years agoMerge pull request #2048 from poettering/fork-errno
Daniel Mack [Fri, 27 Nov 2015 13:35:56 +0000 (14:35 +0100)] 
Merge pull request #2048 from poettering/fork-errno

core:execute: fix fork() fail handling in exec_spawn()

8 years agotests: don't run test on incomplete setup
Evgeny Vereshchagin [Fri, 27 Nov 2015 13:29:51 +0000 (13:29 +0000)] 
tests: don't run test on incomplete setup

This is a follow-up commit for
https://github.com/systemd/systemd/pull/1937

See https://github.com/systemd/systemd/pull/2030

8 years agocore:execute: fix fork() fail handling in exec_spawn() 2048/head
lc85446 [Thu, 26 Nov 2015 03:46:40 +0000 (11:46 +0800)] 
core:execute: fix fork() fail handling in exec_spawn()

    If pid < 0 after fork(), 0 is always returned because r =
    exec_context_load_environment() has exited successfully.

    This will make the caller of exec_spawn() not able to handle
    the fork() error case and make systemd abort assert() possibly.

8 years agoMerge pull request #1833 from utezduyar/drop-warning-on-preset
Lennart Poettering [Fri, 27 Nov 2015 13:06:36 +0000 (14:06 +0100)] 
Merge pull request #1833 from utezduyar/drop-warning-on-preset

drop warning if setting preset worked anyways

8 years agoMerge pull request #1937 from evverx/fix-stdout-parsing
Lennart Poettering [Fri, 27 Nov 2015 13:03:49 +0000 (14:03 +0100)] 
Merge pull request #1937 from evverx/fix-stdout-parsing

Fix stdout stream parsing

8 years agoMerge pull request #2017 from haraldh/nobinddevice2
Lennart Poettering [Fri, 27 Nov 2015 13:02:25 +0000 (14:02 +0100)] 
Merge pull request #2017 from haraldh/nobinddevice2

core: Do not bind a mount unit to a device, if it was from mountinfo

8 years agoMerge pull request #1828 from fbuihuu/set-property-on-inactive-unit
Lennart Poettering [Fri, 27 Nov 2015 13:00:57 +0000 (14:00 +0100)] 
Merge pull request #1828 from fbuihuu/set-property-on-inactive-unit

core: allow 'SetUnitProperties()' to run on inactive units too

8 years agoMerge pull request #1989 from keszybz/filetriggers-v2
Lennart Poettering [Fri, 27 Nov 2015 12:52:43 +0000 (13:52 +0100)] 
Merge pull request #1989 from keszybz/filetriggers-v2

Return of the file triggers

8 years agoMerge pull request #2040 from keszybz/randomized-delay
Lennart Poettering [Fri, 27 Nov 2015 12:48:12 +0000 (13:48 +0100)] 
Merge pull request #2040 from keszybz/randomized-delay

core: rename Random* to RandomizedDelay*

8 years agoMerge pull request #2046 from evverx/rlimit-parsing
Daniel Mack [Fri, 27 Nov 2015 11:45:04 +0000 (12:45 +0100)] 
Merge pull request #2046 from evverx/rlimit-parsing

Fix rlimit parsing

8 years agocore: dump rlim_cur too 2046/head
Evgeny Vereshchagin [Fri, 27 Nov 2015 09:13:35 +0000 (09:13 +0000)] 
core: dump rlim_cur too

8 years agocore: fix rlimit parsing
Evgeny Vereshchagin [Fri, 27 Nov 2015 08:54:42 +0000 (08:54 +0000)] 
core: fix rlimit parsing

* refuse limits if soft > hard
* print an actual value instead of (null)

see https://github.com/systemd/systemd/pull/1994#issuecomment-159999123

8 years agoMerge pull request #2030 from evverx/dont-run-tests-on-incomplete-setup
Daniel Mack [Fri, 27 Nov 2015 11:22:12 +0000 (12:22 +0100)] 
Merge pull request #2030 from evverx/dont-run-tests-on-incomplete-setup

tests: don't run tests on incomplete setup

8 years agoMerge pull request #2044 from grawity/patch-1
David Herrmann [Fri, 27 Nov 2015 09:35:34 +0000 (10:35 +0100)] 
Merge pull request #2044 from grawity/patch-1

resolved: fix typo in in_addr_is_localhost()

8 years agoMerge pull request #2029 from teg/network-fixes
Martin Pitt [Fri, 27 Nov 2015 09:20:18 +0000 (10:20 +0100)] 
Merge pull request #2029 from teg/network-fixes

Network fixes

8 years agoresolved: fix typo in in_addr_is_localhost() 2044/head
Mantas Mikulėnas [Fri, 27 Nov 2015 06:36:37 +0000 (08:36 +0200)] 
resolved: fix typo in in_addr_is_localhost()

8 years agoMerge commit 'pr/2036^^'
Zbigniew Jędrzejewski-Szmek [Fri, 27 Nov 2015 02:24:08 +0000 (21:24 -0500)] 
Merge commit 'pr/2036^^'

8 years agoresolved: announce support for large UDP packets 2043/head
Tom Gundersen [Mon, 6 Jul 2015 14:48:24 +0000 (16:48 +0200)] 
resolved: announce support for large UDP packets

This is often needed for proper DNSSEC support, and even to handle AAAA records
without falling back to TCP.

If the path between the client and server is fully compliant, this should always
work, however, that is not the case, and overlarge packets will get mysteriously
lost in some cases.

For that reason, we use a similar fallback mechanism as we do for palin EDNS0,
EDNS0+DO, etc.:

The large UDP size feature is different from the other supported feature, as we
cannot simply verify that it works based on receiving a reply (as the server
will usually send us much smaller packets than what we claim to support, so
simply receiving a reply does not mean much).

For that reason, we keep track of the largest UDP packet we ever received, as this
is the smallest known good size (defaulting to the standard 512 bytes). If
announcing the default large size of 4096 fails (in the same way as the other
features), we fall back to the known good size. The same logic of retrying after a
grace-period applies.

8 years agoresolved: set the DNSSEC OK (DO) flag
Tom Gundersen [Wed, 24 Jun 2015 13:08:40 +0000 (15:08 +0200)] 
resolved: set the DNSSEC OK (DO) flag

This indicates that we can handle DNSSEC records (per RFC3225), even if
all we do is silently drop them. This feature requires EDNS0 support.

As we do not yet support larger UDP packets, this feature increases the
risk of getting truncated packets.

Similarly to how we fall back to plain UDP if EDNS0 fails, we will fall
back to plain EDNS0 if EDNS0+DO fails (with the same logic of remembering
success and retrying after a grace period after failure).

8 years agoresolved: implement minimal EDNS0 support
Tom Gundersen [Tue, 23 Jun 2015 21:06:09 +0000 (23:06 +0200)] 
resolved: implement minimal EDNS0 support

This is a minimal implementation of RFC6891. Only default values
are used, so in reality this will be a noop.

EDNS0 support is dependent on the current server's feature level,
so appending the OPT pseudo RR is done when the packet is emitted,
rather than when it is assembled. To handle different feature
levels on retransmission, we strip off the OPT RR again after
sending the packet.

Similarly, to how we fall back to TCP if UDP fails, we fall back
to plain UDP if EDNS0 fails (but if EDNS0 ever succeeded we never
fall back again, and after a timeout we will retry EDNS0).

8 years agoresolved: rr - add OPT pseudo-rr support
Tom Gundersen [Sun, 12 Jul 2015 23:51:03 +0000 (01:51 +0200)] 
resolved: rr - add OPT pseudo-rr support

Needed for EDNS0.

8 years agoresolved: degrade the feature level on explicit failure
Tom Gundersen [Thu, 16 Jul 2015 12:39:55 +0000 (14:39 +0200)] 
resolved: degrade the feature level on explicit failure

Previously, we would only degrade on packet loss, but when adding EDNS0 support,
we also have to handle the case where the server replies with an explicit error.

8 years agoresolved: fallback to TCP if UDP fails
Tom Gundersen [Mon, 6 Jul 2015 06:15:25 +0000 (08:15 +0200)] 
resolved: fallback to TCP if UDP fails

This is inspired by the logic in BIND [0], follow-up patches
will implement the reset of that scheme.

If we get a server error back, or if after several attempts we don't
get a reply at all, we switch from UDP to TCP for the given
server for the current and all subsequent requests. However, if
we ever successfully received a reply over UDP, we never fall
back to TCP, and once a grace-period has passed, we try to upgrade
again to using UDP. The grace-period starts off at five minutes
after the current feature level was verified and then grows
exponentially to six hours. This is to mitigate problems due
to temporary lack of network connectivity, but at the same time
avoid flooding the network with retries when the feature attempted
feature level genuinely does not work.

Note that UDP is likely much more commonly supported than TCP,
but depending on the path between the client and the server, we
may have more luck with TCP in case something is wrong. We really
do prefer UDP though, as that is much more lightweight, that is
why TCP is only the last resort.

[0]: <https://kb.isc.org/article/AA-01219/0/Refinements-to-EDNS-fallback-behavior-can-cause-different-outcomes-in-Recursive-Servers.html>

8 years agoMerge pull request #2042 from poettering/resolved-various-3
Tom Gundersen [Fri, 27 Nov 2015 00:18:38 +0000 (01:18 +0100)] 
Merge pull request #2042 from poettering/resolved-various-3

resolved: Flush caches more agressively, fixes #2038

8 years agoupdate TODO 2042/head
Lennart Poettering [Thu, 26 Nov 2015 23:46:21 +0000 (00:46 +0100)] 
update TODO

8 years agoresolved: never cache RRs originating from localhost
Lennart Poettering [Thu, 26 Nov 2015 23:41:32 +0000 (00:41 +0100)] 
resolved: never cache RRs originating from localhost

After all, this is likely a local DNS forwarder that caches anyway,
hence there's no point in caching twice.

Fixes #2038.

8 years agoresolved: flush the global DNS cache if /etc/resolv.conf is touched
Lennart Poettering [Thu, 26 Nov 2015 23:23:32 +0000 (00:23 +0100)] 
resolved: flush the global DNS cache if /etc/resolv.conf is touched

After all /etc/resolv.conf is usually done when the network
configuration changes, which is a good reason to flush the global cache.

See: #2038

8 years agoresolved: don't clear the server list too eagerly
Lennart Poettering [Thu, 26 Nov 2015 23:15:28 +0000 (00:15 +0100)] 
resolved: don't clear the server list too eagerly

If /etc/resolv.conf is missing, this should not result in the server
list to be cleared, after all the native data from resolved.conf
shouldn't be flushed out then. Hence flush out the data only if
/etc/resolv.conf exists, but we cannot read it for some reason.

8 years agoMerge pull request #2041 from poettering/resolved-various-2
Tom Gundersen [Thu, 26 Nov 2015 23:42:56 +0000 (00:42 +0100)] 
Merge pull request #2041 from poettering/resolved-various-2

various smaller fixes, plus one that makes the build succeed again

8 years agoresolved: fix build 2041/head
Lennart Poettering [Thu, 26 Nov 2015 23:10:29 +0000 (00:10 +0100)] 
resolved: fix build

8 years agoresolved: don't follow the global search list on local scopes
Lennart Poettering [Thu, 26 Nov 2015 23:06:19 +0000 (00:06 +0100)] 
resolved: don't follow the global search list on local scopes

It probably doesn't make sense to mix local and global configuration.
Applying global search lists to local DNS servers appears unnecessary
and creates problems because we'll traverse the search domains
non-simultaneously on multiple scopes.

Also see:

https://github.com/systemd/systemd/pull/2031

8 years agoresolved: handle properly if there are multiple transactions for the same key per...
Lennart Poettering [Thu, 26 Nov 2015 22:51:59 +0000 (23:51 +0100)] 
resolved: handle properly if there are multiple transactions for the same key per scope

When the zone probing code looks for a transaction to reuse it will
refuse to look at transactions that have been answered from cache or the
zone itself, but insist on the network. This has the effect that there
might be multiple transactions around for the same key on the same
scope. Previously we'd track all transactions in a hashmap, indexed by
the key, which implied that there would be only one transaction per key,
per scope. With this change the hashmap will only store the most recent
transaction per key, and a linked list will be used to track all
transactions per scope, allowing multiple per-key per-scope.

Note that the linked list fields for this actually already existed in
the DnsTransaction structure, but were previously unused.

8 years agoresolved: for a transaction, keep track where the answer data came from
Lennart Poettering [Thu, 26 Nov 2015 22:33:55 +0000 (23:33 +0100)] 
resolved: for a transaction, keep track where the answer data came from

Let's track where the data came from: from the network, the cache or the
local zone. This is not only useful for debugging purposes, but is also
useful when the zone probing wants to ensure it's not reusing
transactions that were answered from the cache or the zone itself.

8 years agoresolved: store just the DnsAnswer instead of a DnsPacket as answer in DnsTransaction...
Lennart Poettering [Thu, 26 Nov 2015 21:51:35 +0000 (22:51 +0100)] 
resolved: store just the DnsAnswer instead of a DnsPacket as answer in DnsTransaction objects

Previously we'd only store the DnsPacket in the DnsTransaction, and the
DnsQuery would then take the DnsPacket's DnsAnswer and return it. With
this change we already pull the DnsAnswer out inside the transaction.

We still store the DnsPacket in the transaction, if we have it, since we
still need to determine from which peer a response originates, to
implement caching properly. However, the DnsQuery logic doesn't care
anymore for the packet, it now only looks at answers and rcodes from the
successfuly candidate.

This also has the benefit of unifying how we propagate incoming packets,
data from the local zone or the local cache.

8 years agoresolved: change query flag definitions
Lennart Poettering [Thu, 26 Nov 2015 21:45:42 +0000 (22:45 +0100)] 
resolved: change query flag definitions

Let's use a more useful way to write the flags. Also, leave some space
in the middle for the mDNS flags. After all, these flags are exposed on
the bus, and we should really make sure to expose flags that are going
to be stable, hence allow some room here...

(Not that the room really mattered, except to be nice to one's OCD)

8 years agoMerge pull request #2031 from poettering/resolved-search-domains
Tom Gundersen [Thu, 26 Nov 2015 22:58:45 +0000 (23:58 +0100)] 
Merge pull request #2031 from poettering/resolved-search-domains

resolved. Fully implement search domains for single-label names

8 years agoman: remove repeated words in description of RandomizedDelay 2040/head
Zbigniew Jędrzejewski-Szmek [Thu, 26 Nov 2015 21:44:59 +0000 (16:44 -0500)] 
man: remove repeated words in description of RandomizedDelay

8 years agocore: rename Random* to RandomizedDelay*
Zbigniew Jędrzejewski-Szmek [Thu, 26 Nov 2015 21:32:41 +0000 (16:32 -0500)] 
core: rename Random* to RandomizedDelay*

The name RandomSec is too generic: "Sec" just specifies the default
unit type, and "Random" by itself is not enough. Rename to something
that should give the user general idea what the setting does without
looking at documentation.

8 years agoMerge pull request #1994 from karelzak/rlimits
Lennart Poettering [Thu, 26 Nov 2015 12:17:25 +0000 (13:17 +0100)] 
Merge pull request #1994 from karelzak/rlimits

core: support <soft:hard> ranges for RLIMIT options

8 years agoMerge pull request #2022 from alkino/master
Lennart Poettering [Thu, 26 Nov 2015 12:09:56 +0000 (13:09 +0100)] 
Merge pull request #2022 from alkino/master

man: Add a not that mount unit cannot be templated

8 years agoMerge pull request #2034 from teg/resolved-fix
Daniel Mack [Thu, 26 Nov 2015 09:56:42 +0000 (10:56 +0100)] 
Merge pull request #2034 from teg/resolved-fix

minor resolved fixes

8 years agoMerge pull request #2035 from evverx/man-fix-io-revents
Daniel Mack [Thu, 26 Nov 2015 09:55:29 +0000 (10:55 +0100)] 
Merge pull request #2035 from evverx/man-fix-io-revents

man: fix function name

8 years agoman: fix function name 2035/head
Evgeny Vereshchagin [Thu, 26 Nov 2015 07:54:08 +0000 (07:54 +0000)] 
man: fix function name

8 years agoresolved: bus - follow CNAME chains when resolving addresses 2034/head
Tom Gundersen [Thu, 26 Nov 2015 02:58:08 +0000 (03:58 +0100)] 
resolved: bus - follow CNAME chains when resolving addresses

It may be unexpected to find a CNAME record when doing a reverse lookup, as we
expect to find a PTR record directly. However, it is explicitly supported
according to <https://tools.ietf.org/html/rfc2181#section-10.2>, and there
seems to be no benefit to not supporting it.

8 years agoresolved: do not reject NSEC records with empty bitmaps
Tom Gundersen [Wed, 25 Nov 2015 21:22:38 +0000 (22:22 +0100)] 
resolved: do not reject NSEC records with empty bitmaps

The assumption that no NSEC bitmap could be empty due to the presence of the bit representing
the record itself turns out to be flawed. See (the admittedly experimental) RFC4956 for a
counter example.

8 years agodns-domain: rework dns_label_escape() to not imply memory allocation 2031/head
Lennart Poettering [Wed, 25 Nov 2015 20:56:48 +0000 (21:56 +0100)] 
dns-domain: rework dns_label_escape() to not imply memory allocation

The new dns_label_escape() call now operates on a buffer passed in,
similar to dns_label_unescape(). This should make decoding a bit faster,
and nicer.

8 years agodns-domain: change dns_srv_type_is_valid() return value to bool
Lennart Poettering [Wed, 25 Nov 2015 20:15:07 +0000 (21:15 +0100)] 
dns-domain: change dns_srv_type_is_valid() return value to bool

For similar reasons as dns_name_is_root() got changed in the previous
commit.

8 years agodns-domain: simplify dns_name_is_root() and dns_name_is_single_label()
Lennart Poettering [Wed, 25 Nov 2015 20:07:17 +0000 (21:07 +0100)] 
dns-domain: simplify dns_name_is_root() and dns_name_is_single_label()

Let's change the return value to bool. If we encounter an error while
parsing, return "false" instead of the actual parsing error, after all
the specified hostname does not qualify for what the function is
supposed to test.

Dealing with the additional error codes was always cumbersome, and
easily misused, like for example in the DHCP code.

Let's also rename the functions from dns_name_root() to
dns_name_is_root(), to indicate that this function checks something and
returns a bool. Similar for dns_name_is_signal_label().

8 years agoresolved: fully support DNS search domains
Lennart Poettering [Wed, 25 Nov 2015 19:47:27 +0000 (20:47 +0100)] 
resolved: fully support DNS search domains

This adds support for searching single-label hostnames in a set of
configured search domains.

A new object DnsQueryCandidate is added that links queries to scopes.
It keeps track of the search domain last used for a query on a specific
link. Whenever a host name was unsuccessfuly resolved on a scope all its
transactions are flushed out and replaced by a new set, with the next
search domain appended.

This also adds a new flag SD_RESOLVED_NO_SEARCH to disable search domain
behaviour. The "systemd-resolve-host" tool is updated to make this
configurable via --search=.

Fixes #1697

8 years agoresolved: expose some properties on the bus
Lennart Poettering [Tue, 24 Nov 2015 21:49:15 +0000 (22:49 +0100)] 
resolved: expose some properties on the bus

For now, let's just expose the LLMNR hostname currently in use;  a
combined list of all dns servers with their interface indexes; a
combined list of all search domains with their interface indexes.

8 years agoresolved: split out calls to compile full list of dns servers and search domains
Lennart Poettering [Tue, 24 Nov 2015 20:55:00 +0000 (21:55 +0100)] 
resolved: split out calls to compile full list of dns servers and search domains

Let's split this out from the resolv.conf parser, so that this becomes
generically useful.

8 years agoutil-lib: add ordered_set_ensure_allocated()
Lennart Poettering [Tue, 24 Nov 2015 20:54:22 +0000 (21:54 +0100)] 
util-lib: add ordered_set_ensure_allocated()

ordered_set_ensure_allocated() does for an OrderedSet, what
set_ensure_allicated() does for a Set.

8 years agoresolved: enforce a maximum limit on both dns servers and search domains
Lennart Poettering [Tue, 24 Nov 2015 20:39:14 +0000 (21:39 +0100)] 
resolved: enforce a maximum limit on both dns servers and search domains

8 years agoresolved: unify DnsServer handling code between Link and Manager
Lennart Poettering [Tue, 24 Nov 2015 20:27:29 +0000 (21:27 +0100)] 
resolved: unify DnsServer handling code between Link and Manager

This copies concepts we introduced for the DnsSearchDomain stuff, and
reworks the operations on lists of dns servers to be reusable and
generic for use both with the Link and the Manager object.

8 years agoresolved: add a generic DnsSearchDomain concept
Lennart Poettering [Tue, 24 Nov 2015 20:12:51 +0000 (21:12 +0100)] 
resolved: add a generic DnsSearchDomain concept

With this change, we add a new object to resolved, "DnsSearchDomain="
which wraps a search domain. This is then used to introduce a global
search domain list, in addition to the existing per-link search domain
list which is reword to make use of this new object too.

This is preparation for implement proper unicast DNS search domain
support.

8 years agoresolved: make sure order of dns servers is stable
Lennart Poettering [Tue, 24 Nov 2015 19:50:37 +0000 (20:50 +0100)] 
resolved: make sure order of dns servers is stable

Previously, we'd keep adding new dns servers we discover to the end of
our linked list of servers. When we encountered a pre-existing server,
we'd just leave it where it was. In essence that meant that old servers
ended up at the front, and new servers at the end, but not in an order
that would reflect the configuration.

With this change we ensure that every pre-existing server we want to add
again we move to the back of the linked list, so that the order is
stable and in sync with the requested configuration.

8 years agoresolved: drop unused enum type
Lennart Poettering [Tue, 24 Nov 2015 17:12:13 +0000 (18:12 +0100)] 
resolved: drop unused enum type

8 years agoresolved: make sure FallbackDNS= overrides built-in servers, doesn't extend them
Lennart Poettering [Tue, 24 Nov 2015 17:08:35 +0000 (18:08 +0100)] 
resolved: make sure FallbackDNS= overrides built-in servers, doesn't extend them

Closes #342.

8 years agoresolved: rework dns server lifecycle logic
Lennart Poettering [Tue, 24 Nov 2015 16:59:40 +0000 (17:59 +0100)] 
resolved: rework dns server lifecycle logic

Previously, there was a chance of memory corruption, because when
switching to the next DNS server we didn't care whether they linked list
of DNS servers was still valid.

Clean up lifecycle of the dns server logic:

- When a DnsServer object is still in the linked list of DnsServers for
  a link or the manager, indicate so with a "linked" boolean field, and
  never follow the linked list if that boolean is not set.

- When picking a DnsServer to use for a link ot manager, always
  explicitly take a reference.

This also rearranges some logic, to make the tracking of dns servers by
link and globally more alike.

8 years agoresolved: move dns server picking code from resolved-manager.c to resolved-dns-server.c
Lennart Poettering [Tue, 24 Nov 2015 16:03:12 +0000 (17:03 +0100)] 
resolved: move dns server picking code from resolved-manager.c to resolved-dns-server.c

8 years agoresolved: indent less, by exiting earlier
Lennart Poettering [Tue, 24 Nov 2015 16:01:09 +0000 (17:01 +0100)] 
resolved: indent less, by exiting earlier

8 years agoresolved: split out all code dealing with /etc/resolv.conf into its own .c file
Lennart Poettering [Tue, 24 Nov 2015 15:55:30 +0000 (16:55 +0100)] 
resolved: split out all code dealing with /etc/resolv.conf into its own .c file

No functional changes.

8 years agoresolved: unify code for parsing dns server information
Lennart Poettering [Tue, 24 Nov 2015 15:48:13 +0000 (16:48 +0100)] 
resolved: unify code for parsing dns server information

Let's use the same parser when parsing dns server information from
/etc/resolv.conf and our native configuration file.

Also, move all code that manages lists of dns servers to a single place.
resolved-dns-server.c

8 years agoresolved: /etc/resolved.conf missing is not an error
Lennart Poettering [Tue, 24 Nov 2015 15:47:20 +0000 (16:47 +0100)] 
resolved: /etc/resolved.conf missing is not an error

Don't propagate any error in this case, it's really not an error.

8 years agodns-domain: remove prototype for function that doesn't exist
Lennart Poettering [Tue, 24 Nov 2015 15:45:12 +0000 (16:45 +0100)] 
dns-domain: remove prototype for function that doesn't exist

8 years agoman: fix documentation how /etc/resolv.conf is read
Lennart Poettering [Tue, 24 Nov 2015 15:44:02 +0000 (16:44 +0100)] 
man: fix documentation how /etc/resolv.conf is read

/etc/resolv.conf is only read when the DNS= setting does not appear at
all in resolved.conf, regardless if set to the empty list or anything
else. Correct that in the man page.

8 years agoresolved: don't claim DnsQuestion have to have the same names
Lennart Poettering [Tue, 24 Nov 2015 00:25:24 +0000 (01:25 +0100)] 
resolved: don't claim DnsQuestion have to have the same names

Wen DnsQuestion objects are used for DnsQuery objects all contained keys
have to share the same name, but otherwise they generally don't have to,
and this can actually happen in real-life because DnsPacket objects for
mDNS use DnsQuestion for the question section.

Hence, rename:

dns_question_is_valid() to dns_question_is_valid_for_query(), since the
name uniqueness check it does is only relevant when used for a query.

Similar, rename dns_question_name() to dns_question_first_name(),
to be more accurate, as this difference matters if we keys don#t have to
share the same name.

8 years agofstab-gen: post can't be NULL
Franck Bui [Wed, 25 Nov 2015 20:21:44 +0000 (21:21 +0100)] 
fstab-gen: post can't be NULL

8 years agoMerge pull request #2024 from eworm-de/net
Tom Gundersen [Wed, 25 Nov 2015 19:56:46 +0000 (20:56 +0100)] 
Merge pull request #2024 from eworm-de/net

networkd: link - do not drop config for loopback device

8 years agonetworkd: link - do not drop config for loopback device 2024/head
Christian Hesse [Wed, 25 Nov 2015 07:46:43 +0000 (08:46 +0100)] 
networkd: link - do not drop config for loopback device

Commit 5e5b137a (networkd: link - drop foreign config when configuring
link) introduced a regression where addresses (including 127.0.0.1) are
removed from loopback device.
Do not handle loopback device when removing foreign configs.

Signed-off-by: Christian Hesse <mail@eworm.de>