diff options
-rw-r--r-- | hwdb/60-keyboard.hwdb | 6 | ||||
-rw-r--r-- | hwdb/70-pointingstick.hwdb | 5 | ||||
-rw-r--r-- | man/systemd-resolved.service.xml | 5 | ||||
-rw-r--r-- | man/systemd.network.xml | 4 | ||||
-rw-r--r-- | src/network/networkd-network-gperf.gperf | 1 | ||||
-rw-r--r-- | src/resolve/resolved-etc-hosts.c | 6 | ||||
-rwxr-xr-x | test/networkd-test.py | 55 |
7 files changed, 72 insertions, 10 deletions
diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb index fff3b9a6ea..114d9c6651 100644 --- a/hwdb/60-keyboard.hwdb +++ b/hwdb/60-keyboard.hwdb @@ -18,17 +18,19 @@ # ZZZZ is the bus-id (see /usr/include/linux/input.h BUS_*), YYYY, XXXX and # WWW are the 4-digit hex uppercase vendor, product and version ID and VVVV # is an arbitrary length input-modalias describing the device capabilities. +# The vendor, product and version ID for a device node "eventX" is listed +# in /sys/class/input/eventX/device/id. # # - AT keyboard DMI data matches: # evdev:atkbd:dmi:bvn*:bvr*:bd*:svn<vendor>:pn<product>:pvr* # <vendor> and <product> are the firmware-provided strings -# exported by the kernel DMI modalias. +# exported by the kernel DMI modalias, see /sys/class/dmi/id/modalias # # - Input driver device name and DMI data match: # evdev:name:<input device name>:dmi:bvn*:bvr*:bd*:svn<vendor>:pn* # <input device name> is the name device specified by the # driver, <vendor> is the firmware-provided string exported -# by the kernel DMI modalias. +# by the kernel DMI modalias, see /sys/class/dmi/id/modalias # # Scan codes are specified as: # KEYBOARD_KEY_<hex scan code>=<key code identifier> diff --git a/hwdb/70-pointingstick.hwdb b/hwdb/70-pointingstick.hwdb index 117f99455c..fa23563192 100644 --- a/hwdb/70-pointingstick.hwdb +++ b/hwdb/70-pointingstick.hwdb @@ -18,11 +18,14 @@ # ZZZZ is the bus-id (see /usr/include/linux/input.h BUS_*), YYYY, XXXX and # WWW are the 4-digit hex uppercase vendor, product and version ID and VVVV # is an arbitrary length input-modalias describing the device capabilities. +# The vendor, product and version ID for a device node "eventX" is listed +# in /sys/class/input/eventX/device/id. # # - Input driver device name and DMI data match: # evdev:name:<input device name>:dmi:bvn*:bvr*:bd*:svn<vendor>:pn* # <input device name> is the name device specified by the driver, -# <vendor> is the firmware-provided string from the kernel DMI modalias. +# <vendor> is the firmware-provided string from the kernel DMI modalias, +# see /sys/class/dmi/id/modalias # # To add local entries, create a new file # /etc/udev/hwdb.d/71-pointingstick-local.hwdb diff --git a/man/systemd-resolved.service.xml b/man/systemd-resolved.service.xml index 56f67960ce..6465193cc5 100644 --- a/man/systemd-resolved.service.xml +++ b/man/systemd-resolved.service.xml @@ -116,8 +116,9 @@ current gateway, useful for referencing it independently of the current network configuration state.</para></listitem> - <listitem><para>The mappings defined in <filename>/etc/hosts</filename> are resolved to their configured - addresses and back.</para></listitem> + <listitem><para>The mappings defined in <filename>/etc/hosts</filename> are resolved + to their configured addresses and back, but they will not affect lookups for + non-address types (like MX).</para></listitem> </itemizedlist> <para>Lookup requests are routed to the available DNS servers diff --git a/man/systemd.network.xml b/man/systemd.network.xml index c7083a4fe6..ea9cdeae88 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -603,8 +603,8 @@ </para></listitem> </varlistentry> <varlistentry> - <term><varname>ProxyARP=</varname></term> - <listitem><para>A boolean. Configures proxy ARP. Proxy ARP is the technique in which one host, + <term><varname>IPv4ProxyARP=</varname></term> + <listitem><para>A boolean. Configures proxy ARP for IPv4. Proxy ARP is the technique in which one host, usually a router, answers ARP requests intended for another machine. By "faking" its identity, the router accepts responsibility for routing packets to the "real" destination. (see <ulink url="https://tools.ietf.org/html/rfc1027">RFC 1027</ulink>. diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 4fa17e8452..862cfad1ff 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -67,6 +67,7 @@ Network.IPv6AcceptRouterAdvertisements, config_parse_tristate, Network.IPv6DuplicateAddressDetection, config_parse_int, 0, offsetof(Network, ipv6_dad_transmits) Network.IPv6HopLimit, config_parse_int, 0, offsetof(Network, ipv6_hop_limit) Network.ProxyARP, config_parse_tristate, 0, offsetof(Network, proxy_arp) +Network.IPv4ProxyARP, config_parse_tristate, 0, offsetof(Network, proxy_arp) Network.BindCarrier, config_parse_strv, 0, offsetof(Network, bind_carrier) Address.Address, config_parse_address, 0, 0 Address.Peer, config_parse_address, 0, 0 diff --git a/src/resolve/resolved-etc-hosts.c b/src/resolve/resolved-etc-hosts.c index 40d650949d..0a284825a1 100644 --- a/src/resolve/resolved-etc-hosts.c +++ b/src/resolve/resolved-etc-hosts.c @@ -431,8 +431,8 @@ int manager_etc_hosts_lookup(Manager *m, DnsQuestion* q, DnsAnswer **answer) { for (i = 0; i < bn->n_items; i++) { _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL; - if ((found_a && bn->items[i]->family != AF_INET) && - (found_aaaa && bn->items[i]->family != AF_INET6)) + if ((!found_a && bn->items[i]->family == AF_INET) || + (!found_aaaa && bn->items[i]->family == AF_INET6)) continue; r = dns_resource_record_new_address(&rr, bn->items[i]->family, &bn->items[i]->address, bn->name); @@ -444,5 +444,5 @@ int manager_etc_hosts_lookup(Manager *m, DnsQuestion* q, DnsAnswer **answer) { return r; } - return 1; + return found_a || found_aaaa; } diff --git a/test/networkd-test.py b/test/networkd-test.py index 39bd4f5b1b..f178a144f0 100755 --- a/test/networkd-test.py +++ b/test/networkd-test.py @@ -504,6 +504,61 @@ Domains= ~company ~lab''') self.assertRegex(general_log, 'query.*megasearch.net') self.assertNotIn('megasearch.net', vpn_log) + def test_resolved_etc_hosts(self): + '''resolved queries to /etc/hosts''' + + # FIXME: -t MX query fails with enabled DNSSEC (even when using + # the known negative trust anchor .internal instead of .example) + conf = '/run/systemd/resolved.conf.d/test-disable-dnssec.conf' + os.makedirs(os.path.dirname(conf), exist_ok=True) + with open(conf, 'w') as f: + f.write('[Resolve]\nDNSSEC=no') + self.addCleanup(os.remove, conf) + + # create /etc/hosts bind mount which resolves my.example for IPv4 + hosts = os.path.join(self.workdir, 'hosts') + with open(hosts, 'w') as f: + f.write('172.16.99.99 my.example\n') + subprocess.check_call(['mount', '--bind', hosts, '/etc/hosts']) + self.addCleanup(subprocess.call, ['umount', '/etc/hosts']) + subprocess.check_call(['systemctl', 'stop', 'systemd-resolved.service']) + + # note: different IPv4 address here, so that it's easy to tell apart + # what resolved the query + self.create_iface(dnsmasq_opts=['--host-record=my.example,172.16.99.1,2600::99:99', + '--host-record=other.example,172.16.0.42,2600::42', + '--mx-host=example,mail.example'], + ipv6=True) + self.do_test(coldplug=None, ipv6=True) + + try: + # family specific queries + out = subprocess.check_output(['systemd-resolve', '-4', 'my.example']) + self.assertIn(b'my.example: 172.16.99.99', out) + # we don't expect an IPv6 answer; if /etc/hosts has any IP address, + # it's considered a sufficient source + self.assertNotEqual(subprocess.call(['systemd-resolve', '-6', 'my.example']), 0) + # "any family" query; IPv4 should come from /etc/hosts + out = subprocess.check_output(['systemd-resolve', 'my.example']) + self.assertIn(b'my.example: 172.16.99.99', out) + # IP → name lookup; again, takes the /etc/hosts one + out = subprocess.check_output(['systemd-resolve', '172.16.99.99']) + self.assertIn(b'172.16.99.99: my.example', out) + + # non-address RRs should fall back to DNS + out = subprocess.check_output(['systemd-resolve', '--type=MX', 'example']) + self.assertIn(b'example IN MX 1 mail.example', out) + + # other domains query DNS + out = subprocess.check_output(['systemd-resolve', 'other.example']) + self.assertIn(b'172.16.0.42', out) + out = subprocess.check_output(['systemd-resolve', '172.16.0.42']) + self.assertIn(b'172.16.0.42: other.example', out) + except (AssertionError, subprocess.CalledProcessError): + self.show_journal('systemd-resolved.service') + self.print_server_log() + raise + def test_transient_hostname(self): '''networkd sets transient hostname from DHCP''' |