1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00
Commit Graph

21773 Commits

Author SHA1 Message Date
Tom Gundersen
1c76020aa5 Merge pull request #1030 from zonque/resolve
resolve: minor cleanups
2015-08-25 14:33:41 +02:00
Daniel Mack
eff91ee007 resolved: allow dns_cache_put() without a question
Currently, dns_cache_put() does a number of things:

1) It unconditionally removes all keys contained in the passed
   question before adding keys from the newly arrived answers.

2) It puts positive entries into the cache for all RRs contained
   in the answer.

3) It creates negative entries in the cache for all keys in the
   question that are not answered.

Allow passing q = NULL in the parameters and skip 1) and 3), so
we can use that function for mDNS responses. In this case, the
question is irrelevant, we are interested in all answers we got.
2015-08-25 14:26:18 +02:00
Daniel Mack
a7e5da6e33 sd-network: make LLMNR specific config parser generic
Rename the enum, the lookup functions and the parser for LLMNRSupport so
the type can be reused for mDNS.
2015-08-25 14:26:01 +02:00
Daniel Mack
9c56a6f3e2 resolved: move assertion
Make a scope with invalid protocol state fail as soon as possible.
2015-08-25 14:25:58 +02:00
Daniel Mack
106784ebb7 resolved: use switch-case statements for protocol details
With more protocols to come, switch repetitive if-else blocks with a
switch-case statements.
2015-08-25 14:25:56 +02:00
Daniel Mack
8326c7f789 resolved: remove runtime check for previously asserted condition 2015-08-25 10:18:45 +02:00
Tom Gundersen
dd42560795 Merge pull request #1023 from poettering/resolved-fixes
A variety of resolved fixes
2015-08-25 10:18:16 +02:00
Lennart Poettering
9318cdd374 resolved: change error code when trying to resolve direct LLMNR PTR RRs
If we try to resoolve an LLMNR PTR RR we shall connect via TCP directly
to the specified IP address. We already refuse to do this if the address
to resolve is of a different address family as the transaction's scope.
The error returned was EAFNOSUPPORT. Let's change this to ESRCH which is
how we indicate "not server available" when connecting for LLMNR or DNS,
since that's what this really is: we have no server we could connect to
in this address family.

This allows us to ensure that no server errors are always handled the same
way.
2015-08-24 23:47:28 +02:00
Lennart Poettering
3fa4999b5d resolve-host: support parsing numeric interface names
If the user specifies an interface by its ifindex we should handle this
nicely. Hence let's try to parse the ifindex as a number before we try
to resolve it as an interface name.
2015-08-24 23:46:24 +02:00
Lennart Poettering
d634711b26 resolved: remove duplicate handling of "no servers" query result
So far we handled immediate "no server" query results differently from
"no server" results we ran into during operation: the former would cause
the dns_query_go() call to fail with ESRCH, the later would result in
the query completion callback to be called.

Remove the duplicate codepaths, by always going through the completion
callback. This allows us to remove quite a number of lines for handling
the ESRCH.

This commit should not alter behaviour at all.
2015-08-24 23:44:33 +02:00
Lennart Poettering
da0c630e14 resolved: replace transaction list by hashmap
Right now we keep track of ongoing transactions in a linked listed for
each scope. Replace this by a hashmap that is indexed by the RR key.
Given that all ongoing transactions will be placed in pretty much the
same scopes usually this should optimize behaviour.

We used to require a list here, since we wanted to do "superset" query
checks, but this became obsolete since transactions are now single-key
instead of multi-key.
2015-08-24 23:15:51 +02:00
Tom Gundersen
53496ca9ad Merge pull request #1012 from gentoo-root/master
sd-device: fix enumeration of devices without subsystem
2015-08-24 18:37:02 +02:00
David Herrmann
1105ea51a8 sd-bus: don't list activators as proper peers
If a connection passed KDBUS_HELLO_ACTIVATOR, it cannot do I/O on the
bus. Hence, we should not treat it as proper peer. To actually query it,
you have to explicitly ask for activators.

This makes kdbus in-line with what dbus-daemon does.
2015-08-24 13:41:03 +02:00
David Herrmann
f2196cf2e2 Revert "sd-bus: include queried path in GetManagedObjects"
This reverts commit 92d16a53e3. As it turns
out, this is not how ObjectManager is supposed to work. It is just a
special behavior of BlueZ, but no-one else implements it this way.

Revert the patch as discussed on github, and as such revert to the
previous behavior (as described in the spec).
2015-08-24 12:56:37 +02:00
Daniel Mack
1667eda96f Merge pull request #1014 from whot/hwdb-updates
hwdb: add more DPI entries
2015-08-24 10:46:59 +02:00
Peter Hutterer
fb8ab3c895 hwdb: add more DPI entries
Provided by Francois Marier
2015-08-24 15:30:46 +10:00
Maxim Mikityanskiy
9a9c7dc2cb sd-device: fix enumeration of devices without subsystem
Prior to commit c32eb440ba, libudev's
function udev_enumerate_scan_devices() had behaved differently. If
parent match was added with udev_enumerate_add_match_parent(),
udev_enumerate_scan_devices() did not return error if some child devices
had no subsystem symlink in sysfs. An example of such devices is USB
endpoints /sys/bus/usb/devices/*/ep_*. If there was a parent match
against USB device, old implementation of udev_enumerate_scan_devices()
did not treat ep_* device directories without subsystem symlink as error
and just ignored them, but new implementation returns -ENOENT (also
ignoring these devices) though correctly enumerates all other matching
devices.

To compare, you could look at 96df036fe3,
in src/libudev/libudev-enumerate.c, function parent_add_child():

    if (!match_subsystem(enumerate, udev_device_get_subsystem(dev)))
            goto nomatch;

udev_device_get_subsystem() was returning NULL, match_subsystem() was
returning false, and USB endpoint device was ignored.

New parent_add_child() from src/libsystemd/sd-device/device-enumerator.c
checks return value of sd_device_get_subsystem() and fails if subsystem
was not found. Absence of subsystem symlink should not be really treated
as error because all enumerations of children of USB devices will fail
with -ENOENT. This new behavior also breaks system-config-printer.

So restore old behavior and treat absence of subsystem symlink as no
match.
2015-08-22 11:33:32 +03:00
Tom Gundersen
72aa2c2a20 Merge pull request #1010 from poettering/resolved-question-key
only maintain one question RR key per transaction and other fixes
2015-08-22 01:57:58 +02:00
Lennart Poettering
28b967a87b Merge pull request #1009 from phomes/master
remove unused variables
2015-08-21 23:07:49 +02:00
Lennart Poettering
26b1c471cd resolved: always split up questions into per-RR transactions
We do so for Unicast DNS and LLMNR anyway, let's also do this for mDNS,
and simplify things.
2015-08-21 23:01:42 +02:00
Lennart Poettering
f52e61da04 resolved: only maintain one question RR key per transaction
Let's simplify things and only maintain a single RR key per transaction
object, instead of a full DnsQuestion. Unicast DNS and LLMNR don't
support multiple questions per packet anway, and Multicast DNS suggests
coalescing questions beyond a single dns query, across the whole system.
2015-08-21 22:55:01 +02:00
Lennart Poettering
9e08a6e0ce resolved: add extra check for family when doing LLMNR TCP connections
It shouldn't happen that we try to resolve IPv4 addresses via LLMNR on
IPv6 and vice versa, but let's explicitly verify that we don't turn an
IPv4 LLMNR lookup into an IPv6 TCP connection.
2015-08-21 22:51:05 +02:00
Lennart Poettering
0a18f3e59f resolved: add reference to negative caching RFC 2015-08-21 22:47:06 +02:00
Thomas Hindoe Paaboel Andersen
62f176068c remove unused variables 2015-08-21 22:19:10 +02:00
Tom Gundersen
932b06b8ff Merge pull request #1005 from poettering/resolved-refuse-compression
Don't do name compression when passing RRs across the bus
2015-08-21 16:23:02 +02:00
Tom Gundersen
37ebef9873 Merge pull request #1004 from poettering/systemd-run-man
man: rework systemd-run man page a bit
2015-08-21 16:21:21 +02:00
Lennart Poettering
09b1fe142b resolve-host: Minor wording improvement 2015-08-21 16:06:25 +02:00
Lennart Poettering
f6a5fec6b9 resolved: when passing RRs across the bus, make sure not to use name compression
We explicitly need to turn off name compression when marshalling or
demarshalling RRs for bus transfer, since they otherwise refer to packet
offsets that reference packets that are not transmitted themselves.
2015-08-21 16:04:59 +02:00
Lennart Poettering
dec896f851 man: rework systemd-run man page a bit 2015-08-21 16:04:16 +02:00
Daniel Mack
8621a8b535 Merge pull request #1003 from poettering/kmod-log-debug
core: downgrade "Module inserted" message for kmod to DEBUG
2015-08-21 15:37:44 +02:00
Lennart Poettering
149730fc75 core: downgrade "Module inserted" message for kmod to DEBUG
Closes #919.
2015-08-21 15:28:01 +02:00
Tom Gundersen
ef7051360a Merge pull request #1002 from poettering/resolved-various
resolved: synthesize more RRs locally and other fixes
2015-08-21 15:26:45 +02:00
Lennart Poettering
78c6a153c4 resolved: rework synthesizing logic
With this change we'll now also generate synthesized RRs for the local
LLMNR hostname (first label of system hostname), the local mDNS hostname
(first label of system hostname suffixed with .local), the "gateway"
hostname and all the reverse PTRs. This hence takes over part of what
nss-myhostname already implemented.

Local hostnames resolve to the set of local IP addresses. Since the
addresses are possibly on different interfaces it is necessary to change
the internal DnsAnswer object to track per-RR interface indexes, and to
change the bus API to always return the interface per-address rather than
per-reply. This change also patches  the existing clients for resolved
accordingly (nss-resolve + systemd-resolve-host).

This also changes the routing logic for queries slightly: we now ensure
that the local hostname is never resolved via LLMNR, thus making it
trustable on the local system.
2015-08-21 12:41:08 +02:00
Lennart Poettering
8013e860b6 resolved: make DnsQuestion logic handle NULL arrays as empty arrays
Following our usual logic of treating NULL arrays as empty arrays (for
example, see strv.c) do the same for questions too.
2015-08-21 12:41:08 +02:00
Lennart Poettering
a8f6397f53 resolved: minor typo comment fix 2015-08-21 12:41:08 +02:00
Lennart Poettering
9ca45586e6 dns-domain: add call for concatenating two domain names
This is specifically useful for appending the mDNS ".local" suffix to a
single-label hostname in the most correct way. (used in later commit)
2015-08-21 12:41:07 +02:00
Tom Gundersen
6b8b67e7ae Merge pull request #924 from pfl/systemd-dhcp6
sd-dhcpv6: support DNS and NTP information
2015-08-21 12:22:38 +02:00
Tom Gundersen
c7f19d8da8 Merge pull request #1001 from major/add-bonding-docs
man: networkd - adding bonding examples for systemd-networkd
2015-08-21 12:17:27 +02:00
Lennart Poettering
46a5e0e742 hostname-util: introduce new is_gateway_hostname() call
This moves is_gateway() from nss-myhostname into the basic APIs, and
makes it more like is_localhost(). Also, we rename it to
is_gateway_hostname() to make it more expressive.

Sharing this function in src/basic/ allows us to reuse the function for
routing name requests in resolved (in a later commit).
2015-08-21 12:07:13 +02:00
Patrik Flykt
07bdc70d16 network: Save DNS and NTP data for a DHCPv6 link
Append DNS and NTP data obtained via DHCPv6 when the Link is saved.
2015-08-21 11:23:22 +03:00
Patrik Flykt
b729fa14aa network: Add function to serialize an IPv6 address 2015-08-21 11:23:22 +03:00
Patrik Flykt
bc152ff879 test-dhcp6-client: Add tests for DNS and NTP options
Test option setting and getting in test_advertise_option(). Verify
that the information provided in DHCPv6 Reply messages is also
available in the Information and Solicit callbacks.
2015-08-21 11:23:22 +03:00
Patrik Flykt
41e4615d4f sd-dhcp6: Support deprecated SNTP Configuration Option
Although the SNTP option specified in RFC 4075 has been deprecated, some
servers are still sending NTP information with this option. Use the SNTP
information provided only if the NTP option is not present.

Update the test case as SNTP information is also requested.
2015-08-21 11:23:22 +03:00
Patrik Flykt
6599680e2d sd-dhcp6: Add support for DHCPv6 NTP Server Option
Support NTP server and multicast addresses and NTP server domain names
as specified in RFC 5908.
2015-08-21 11:23:22 +03:00
Patrik Flykt
5da1b97f3c sd-dhcp6: Add support for DHCPv6 DNS Domain Search List option
Support DHCPv6 DNS search list option as specified in RFC 3646. This
option contains a list of DNS search domains encoded without compression
as specified in Section 8. of RFC 3315.
2015-08-21 11:23:22 +03:00
Patrik Flykt
7bd8e95d44 sd-dhcp6: Add support for DHCPv6 DNS Recursive Name Server option
Support DHCPv6 DNS server option as specified in RFC 3646. This option
contains a list of IPv6 DNS server addresses.
2015-08-21 11:23:21 +03:00
Patrik Flykt
f96ccab7e0 dhcp6-option: Add helper function for uncompressed domain names
Add a helper function containing a modified version of dns_packet_read_name()
that does not use DnsPacket to extract a string array of domain names from
the provided option data. The domain names are stored uncompressed as defined
in Section 8. of RFC 3315.
2015-08-21 11:23:21 +03:00
Patrik Flykt
b553817ccf dhcp6-option: Add helper function for fetching IPv6 addresses
Add a helper function that extracts a block of IPv6 addresses from
the provided option data.
2015-08-21 11:23:21 +03:00
Patrik Flykt
9d89d1ae71 sd-dhcp6-client: Save a DHCPv6 lease also with Information Reply
As the lease structure contains interesting information, save it also
for the Information Reply.
2015-08-21 11:23:21 +03:00
Patrik Flykt
4e3e6679e8 sd-dhcp6-client: Fix unreferencing DHCPv6 lease on client reset
When the DHCPv6 client is started by the library user or stopped for
any reason, unref the DHCPv6 lease when resetting the DHCPv6 client
data structure. This makes the DHCPv6 client always start from a clean
state and not keep unnecessary an lease structure around when stopped.

If this is not done, a previously existing lease information can be
interpreted to be from another server when restarting DHCPv6.
2015-08-21 11:23:21 +03:00