Commit graph

830 commits

Author SHA1 Message Date
Lennart Poettering 94831eaeec resolved: in the ResolveHostname() bus call, accept IP addresses with scope
When we get a literal IP address as string that includes a zone suffix, process
this properly and return the parsed ifindex back to the client, and include it
in the canonical name in case of a link-local IP address.
2016-06-14 23:37:16 +02:00
Lennart Poettering 97ebebbc9c resolved: make sure we initialize the ifindex of direct zone answers properly
Previously, after checking the local zone for a reply and finding one we'd not
initialize the answer ifindex from that. Let's fix that.
2016-06-14 23:28:54 +02:00
Lennart Poettering 145fab1eae resolve: port resolve tool to in_addr_ifindex_{from_string_auto|to_string}()
We can reuse some code here, so let's do it.
2016-06-14 23:27:30 +02:00
Zbigniew Jędrzejewski-Szmek aac57b3539 resolved: use single message for both dbus and signal calls (#3515)
Follow-up for #3502.
2016-06-13 16:24:48 +02:00
Lennart Poettering 04b764bf76 resolved: move verification that link is unmanaged into the proper bus calls
Previously, we checked only for the various SetLinkXYZ() calls on the Manager
object exposed on the bus if the specified interface is managed/unmanaged by
networkd (as we don't permit overriding DNS configuration via bus calls if
networkd owns the device), but the equivalent SetXYZ() calls on the Link object
did not have such a check. Fix that by moving the appropriate check into the
latter, as the former just calls that anyway.
2016-06-10 23:26:53 +02:00
Lennart Poettering ba35662fbd resolved: also add a way to flush all caches via the bus
And expose it in "resolve-tool --flush-caches".
2016-06-10 23:26:53 +02:00
Lennart Poettering bc81447ea5 resolved: flush all caches if SIGUSR2 is received 2016-06-10 23:26:53 +02:00
Lennart Poettering 7207052d25 resolved: also rewrite private /etc/resolv.conf when configuration is changed via bus calls
This also moves log message generation into manager_write_resolv_conf(), so
that it is shorter to invoke the function, given that we have to invoke it at a
couple of additional places now.

Fixes: #3225
2016-06-06 19:17:38 +02:00
Lennart Poettering 2817157bb7 resolved: support IPv6 DNS servers on the local link
Make sure we can parse DNS server addresses that use the "zone id" syntax for
local link addresses, i.e. "fe80::c256:27ff:febb:12f%wlp3s0", when reading
/etc/resolv.conf.

Also make sure we spit this out correctly again when writing /etc/resolv.conf
and via the bus.

Fixes: #3359
2016-06-06 19:17:38 +02:00
Zbigniew Jędrzejewski-Szmek 20f8477be5 Merge pull request #3392 from poettering/assorted-stuff
Assorted stuff
2016-06-04 18:47:56 -04:00
Martin Pitt d2bc125132 resolved: fix comments in resolve.conf for search domain overflows (#3422)
Write comments about "too many search domains" and "Total length of all search
domains is too long" just once. Also put it on a separate line, as
resolv.conf(5) only specifies comments in a line by themselves.

This is ugly to do if write_resolv_conf_search() gets called once for every
search domain. So change it to receive the complete OrderedSet instead and do
the iteration by itself.

Add test cases to networkd-test.py.

https://launchpad.net/bugs/1588229
2016-06-03 11:15:44 +02:00
Lennart Poettering 3c6f7c3402 util-lib: make localed's nonempty() generic, rename it to empty_to_null() and make use of it everywhere 2016-05-30 17:59:43 +02:00
John Paul Adrian Glaubitz aa91232040 resolve/test-dns-packet: Fix unaligned access in test_packet_from_file(). 2016-05-26 23:32:25 +02:00
Evgeny Vereshchagin f134289ac5 resolved: don't stop handle messages after receiving a zero length UDP packet (#3323)
Fixes:

-bash-4.3# ss --udp -l -p
State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port
UNCONN     0      0          *:5355                     *:* users:(("systemd-resolve",pid=601,fd=12))
UNCONN     0      0         :::5355                    :::* users:(("systemd-resolve",pid=601,fd=14))

-bash-4.3# nping --udp -p 5355 --data-length 0 -c 1 localhost

-bash-4.3# journalctl -u systemd-resolved -b --no-hostname
...
May 21 14:59:22 systemd-resolved[601]: Event source llmnr-ipv4-udp (type io) returned error, disabling: Input/output error
...

-bash-4.3# nping --udp -p 5355 --data-length 1000 -c 1 localhost

-bash-4.3# ss --udp -l
State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port
UNCONN     2304   0          *:5355                     *:*
UNCONN     0      0         :::5355                    :::*
2016-05-23 10:19:14 +02:00
Zbigniew Jędrzejewski-Szmek 0e3e1aefeb resolved: fix accounting of dns serves on a link (#3291)
After a few link up/down events I got this warning:
May 17 22:05:10 laptop systemd-resolved[2983]: Failed to read DNS servers for interface wlp3s0, ignoring: Argument list too long
2016-05-20 15:11:58 +02:00
Torstein Husebø f8e2f4d6a0 treewide: fix typos (#3187) 2016-05-04 11:26:17 +02:00
Lennart Poettering 4bbc06cc9e resolved: work around broken DNS zones set up by incapdns.net
incapdns.net returns NXDOMAIN for the SOA of the zone itself but is not a
terminal. This is against the specs, but we really should be able to deal with
this.

Previously, when verifying whether an NXDOMAIN response for a SOA/NS lookup is
rightfully unsigned we'd issue a SOA lookup for the parent's domain, to derive
the state from that. If the parent SOA would get an NXDOMAIN, we'd continue
upwards, until we hit a signed top-level domain, which suggests that the domain
actually exists.

With this change whenver we need to authenticate an NXDOMAIN SOA reply, we'll
request the DS RR for the zone first, and use for validation, since that this
must be from the parent's zone, not the incorrect lower zone.

Fixes: #2894
2016-05-02 18:29:28 +02:00
Zbigniew Jędrzejewski-Szmek ccddd104fc tree-wide: use mdash instead of a two minuses 2016-04-21 23:00:13 -04:00
Zbigniew Jędrzejewski-Szmek 81d621034b tree-wide: remove useless NULLs from strjoina
The coccinelle patch didn't work in some places, I have no idea why.
2016-04-13 08:56:44 -04:00
Lennart Poettering 0bed31c103 test-dnssec: drop unused variable 2016-04-12 13:51:28 +02:00
Zbigniew Jędrzejewski-Szmek 6d10d308c6 Do not report masked units as changed (#2921)
* core/unit: extract checking of stat paths into helper function

The same code was repeated three times.

* core: treat masked files as "unchanged"

systemctl prints the "unit file changed on disk" warning
for a masked unit. I think it's better to print nothing in that
case.

When a masked unit is loaded, set mtime as 0. When checking
if a unit with mtime of 0 needs reload, check that the mask
is still in place.

* test-dnssec: fix build without gcrypt

Also reorder the test functions to follow the way they are called
from main().
2016-04-12 11:10:57 +02:00
Zbigniew Jędrzejewski-Szmek 164d025dd3 resolved: handle oom properly
CID #1349699-1349700.
2016-04-08 21:08:15 -04:00
Zbigniew Jędrzejewski-Szmek b68f10bf1f build-sys: fix build with libgrcypt disabled
- Move gcrypt.h include inside grcrypt-util.h.
- Allow gcrypt-util.[ch] to be compiled even without gcrypt.
This allows the logic in files using gcrypt to be simplified.

- Fix compilation of systemd-resolve without gcrypt.
systemd-resolved already supported that.

Fixes #2711.
2016-03-27 21:51:44 -04:00
Alexander Kuleshov 5883ff6017 tree-wide: use SET_FLAG() macro to make code more clear 2016-03-05 18:26:01 +06:00
Zbigniew Jędrzejewski-Szmek c3dacc8bbf selinux: always try to load the full selinux db
https://github.com/systemd/systemd/pull/2508#issuecomment-190901170
Maybe fixes https://bugzilla.redhat.com/show_bug.cgi?id=1308771.
2016-03-01 20:39:30 -05:00
Zbigniew Jędrzejewski-Szmek 6014237390 Merge pull request #2702 from poettering/resolved-iterate-fix
resolved iteration fix
2016-02-29 23:18:16 -05:00
Torstein Husebø 96d4901149 treewide: fix typos and then/that use 2016-02-24 11:56:11 +01:00
Steven Siloti a915abf35a dnssec: only run tests that require gcrypt if we have it 2016-02-23 20:28:52 -08:00
Zbigniew Jędrzejewski-Szmek 03e6b71c06 Merge pull request #2724 from vcaputo/minor-formatting-cleanups
tree-wide: minor formatting inconsistency cleanups
2016-02-23 18:48:37 -05:00
Vito Caputo 9ed794a32d tree-wide: minor formatting inconsistency cleanups 2016-02-23 14:20:34 -08:00
Thomas Hindoe Paaboel Andersen 662ea1b14a tree-wide: remove unused variables 2016-02-23 20:40:51 +01:00
Vito Caputo 313cefa1d9 tree-wide: make ++/-- usage consistent WRT spacing
Throughout the tree there's spurious use of spaces separating ++ and --
operators from their respective operands.  Make ++ and -- operator
consistent with the majority of existing uses; discard the spaces.
2016-02-22 20:32:04 -08:00
Lennart Poettering 35aa04e9ed resolved: fix notification iteration logic when transactions are completed
When a transaction is complete, and we notify its owners, make sure we deal
correctly with the requesters removing themselves from the list of owners while
we continue iterating.

This was previously already dealt with with transactions that require other
transactions for DNSSEC purposes, fix this for other possibly transaction
owners too now.

Since iterating through "Set" objects is not safe regarding removal of entries
from it, rework the logic to use two Sets, and move each entry we notified from
one set to the other set before we dispatch the notification. This move operation
requires no additional memory, and enables us to ensure that we don't notify
any object twice.

Fixes: #2676
2016-02-22 23:24:47 +01:00
Lennart Poettering 0ef6f45425 tree-wide: place #pragma once at the same place everywhere
Usually, we place the #pragma once before the copyright blurb in header files,
but in a few cases we didn't. Move those around, so that we do the same thing
everywhere.
2016-02-20 22:42:29 +01:00
Samuel Tardieu 0ea929d52f systemd-resolved: fix typo on log message 2016-02-20 08:55:17 +01:00
Zbigniew Jędrzejewski-Szmek cde0cf28a2 Merge pull request #2666 from keszybz/coverity-fixes
Coverity fixes
2016-02-19 15:18:40 -05:00
Zbigniew Jędrzejewski-Szmek 18665d1f67 resolved: fix NULL dereference in debug stmt
CID #1351544, #1351545.
2016-02-19 07:27:43 -05:00
Martin Pitt e4d86881d5 Merge pull request #2648 from keszybz/dnssec-work
Better support for DANE, shell completion
2016-02-19 07:50:50 +01:00
Zbigniew Jędrzejewski-Szmek e1caa6e09b resolve: also allow SSHFP payload to be exported 2016-02-18 11:41:40 -05:00
Zbigniew Jędrzejewski-Szmek 236d312b8d resolve: print TLSA packets in hexadecimal
https://tools.ietf.org/html/rfc6698#section-2.2 says:
> The certificate association data field MUST be represented as a string
> of hexadecimal characters. Whitespace is allowed within the string of
> hexadecimal characters
2016-02-18 11:41:40 -05:00
Zbigniew Jędrzejewski-Szmek 82d1d24093 systemd-resolve: easy querying of TLSA records
$ systemd-resolve --tlsa fedoraproject.org
_443._tcp.fedoraproject.org IN TLSA 0 0 1 GUAL5bejH7czkXcAeJ0vCiRxwMnVBsDlBMBsFtfLF8A=
        -- Cert. usage: CA constraint
        -- Selector: Full Certificate
        -- Matching type: SHA-256

$ systemd-resolve --tlsa=tcp fedoraproject.org:443
_443._tcp.fedoraproject.org IN TLSA 0 0 1 GUAL5bejH7czkXcAeJ0vCiRxwMnVBsDlBMBsFtfLF8A=
        ...

$ systemd-resolve --tlsa=udp fedoraproject.org
_443._udp.fedoraproject.org: resolve call failed: '_443._udp.fedoraproject.org' not found

v2:
- use uint16_t
- refuse port 0
2016-02-18 11:41:40 -05:00
Lennart Poettering 5031c4e21b Merge pull request #2640 from keszybz/dnssec-work-3
resolve: dumping of binary packets
2016-02-17 12:45:31 +01:00
Zbigniew Jędrzejewski-Szmek 5259c0559c test-resolve-tables: verify that dns type/class length is within limits
DNS_TYPE_STRING_MAX causes a problem with the table autogeneration code,
change to _DNS_TYPE_STRING_MAX.
2016-02-16 19:55:51 -05:00
Zbigniew Jędrzejewski-Szmek 202b76ae1a Use provided buffer in dns_resource_key_to_string
When the buffer is allocated on the stack we do not have to check for
failure everywhere. This is especially useful in debug statements, because
we can put dns_resource_key_to_string() call in the debug statement, and
we do not need a seperate if (log_level >= LOG_DEBUG) for the conversion.

dns_resource_key_to_string() is changed not to provide any whitespace
padding. Most callers were stripping the whitespace with strstrip(),
and it did not look to well anyway. systemd-resolve output is not column
aligned anymore.

The result of the conversion is not stored in DnsTransaction object
anymore. It is used only for debugging, so it seems fine to generate it
when needed.

Various debug statements are extended to provide more information.
2016-02-16 19:55:51 -05:00
Zbigniew Jędrzejewski-Szmek 1c02e7ba55 Replace DNS_RESOURCE_KEY_NAME with a version which always returns "." for root
This fixes formatting of root domain in debug messages:
Old:
systemd-resolved[10049]: Requesting DS to validate transaction 19313 (., DNSKEY with key tag: 19036).
New:
systemd-resolved[10049]: Requesting DS to validate transaction 19313 (, DNSKEY with key tag: 19036).
2016-02-16 19:55:51 -05:00
Zbigniew Jędrzejewski-Szmek c690b20a85 systemd-resolved: split out inner loop
With two nested loops and a switch statements, it's quite hard to
understand what break and continue mean.
2016-02-16 19:55:51 -05:00
Zbigniew Jędrzejewski-Szmek dab48ea63a systemd-resolve: allow whole packets to be dumped in binary form 2016-02-16 19:55:50 -05:00
Zbigniew Jędrzejewski-Szmek 2e74028a5c systemd-resolve: allow keys to be dumped in binary form
$ systemd-resolve --raw --openpgp zbyszek@fedoraproject.org | pgpdump /dev/stdin
2016-02-16 19:24:07 -05:00
Zbigniew Jędrzejewski-Szmek 1ace2438c6 systemd-resolve: reword --help output
The output didn't specify if the default for --cname/--search/--legend and
other options was yes or no. Change the description to be explicit about that.

Also make the --help output and man page closer.
2016-02-16 19:10:25 -05:00
Zbigniew Jędrzejewski-Szmek 2c45295e47 Merge pull request #2623 from poettering/networkd-fixes
Networkd, resolved, build-sys fixes
2016-02-16 18:36:42 -05:00