]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "resolvectl: Add show-multicast verb to show discovered LLMNR/mDNS hosts"
authorLennart Poettering <lennart@poettering.net>
Thu, 4 Feb 2021 15:05:05 +0000 (16:05 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 5 Feb 2021 00:23:05 +0000 (09:23 +0900)
man/org.freedesktop.resolve1.xml
man/resolvectl.xml
mkosi.postinst [deleted file]
src/resolve/resolvectl.c
src/resolve/resolved-bus.c
src/resolve/resolved-dns-cache.c
src/resolve/resolved-dns-cache.h
src/resolve/resolved-dns-scope.c

index 9036f7d11fd4be5e3d76ecf56c9348c8bd63116b..860a14877d19bf89ba2e83de4f7f633164d187a9 100644 (file)
@@ -115,7 +115,6 @@ node /org/freedesktop/resolve1 {
       ResetStatistics();
       FlushCaches();
       ResetServerFeatures();
-      GetMulticastHosts(out a(stiiay) UNNAMED);
     properties:
       readonly s LLMNRHostname = '...';
       @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
@@ -165,8 +164,6 @@ node /org/freedesktop/resolve1 {
 
     <!--method ResetServerFeatures is not documented!-->
 
-    <!--method GetMulticastHosts is not documented!-->
-
     <!--property DNSSECNegativeTrustAnchors is not documented!-->
 
     <!--Autogenerated cross-references for systemd.directives, do not edit-->
@@ -215,8 +212,6 @@ node /org/freedesktop/resolve1 {
 
     <variablelist class="dbus-method" generated="True" extra-ref="ResetServerFeatures()"/>
 
-    <variablelist class="dbus-method" generated="True" extra-ref="GetMulticastHosts()"/>
-
     <variablelist class="dbus-property" generated="True" extra-ref="LLMNRHostname"/>
 
     <variablelist class="dbus-property" generated="True" extra-ref="LLMNR"/>
index c6e9f147a7a1a40e1bd2b0ab8c00e53797f4c1be..fb6cae7b9b6a6bd447c3afdfe02381ddbacaf6d3 100644 (file)
         automatically, an explicit reverting is not necessary in that case.</para></listitem>
       </varlistentry>
 
-      <varlistentry>
-        <term><command>show-multicast</command></term>
-
-        <listitem><para>Display the discovered LLMNR and mDNS hostnames along with their IPv4/IPv6 addresses.
-        </para></listitem>
-      </varlistentry>
-
       <xi:include href="systemctl.xml" xpointer="log-level" />
     </variablelist>
   </refsect1>
diff --git a/mkosi.postinst b/mkosi.postinst
deleted file mode 100755 (executable)
index 1bbb9e4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-set -e
-
-mkdir -p /root/build
-echo "directory /root/build" > ~/.gdbinit
index 77b7b72ed9b8affe7915d386ab5719a7da785839..b1779a6418a43c8a8865f9688893dcde69ab1be8 100644 (file)
@@ -2500,90 +2500,6 @@ static int verb_log_level(int argc, char *argv[], void *userdata) {
         return 0;
 }
 
-static const char *resolve_flags_to_string(uint64_t flags) {
-        return flags & SD_RESOLVED_DNS         ? "DNS" :
-                flags & SD_RESOLVED_LLMNR_IPV4 ? "LLMNR/IPv4" :
-                flags & SD_RESOLVED_LLMNR_IPV6 ? "LLMNR/IPv6" :
-                flags & SD_RESOLVED_MDNS_IPV4  ? "mDNS/IPv4" :
-                flags & SD_RESOLVED_MDNS_IPV6  ? "mDNS/IPv6" :
-                                                 "";
-}
-
-static int verb_show_multicast(int argc, char *argv[], void *userdata) {
-        _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
-        _cleanup_(table_unrefp) Table *table = NULL;
-        sd_bus *bus = userdata;
-        int r;
-
-        assert(bus);
-
-        table = table_new("Hostname", "Address", "Source");
-        if (!table)
-                return log_oom();
-
-        r = bus_call_method(bus, bus_resolve_mgr, "GetMulticastHosts", &error, &reply, NULL);
-        if (r < 0)
-                return log_error_errno(r, "Failed to query systemd-resolved: %s", bus_error_message(&error, r));
-
-        r = sd_bus_message_enter_container(reply, 'a', "(stiiay)");
-        if (r < 0)
-                return bus_log_parse_error(r);
-
-        while ((r = sd_bus_message_enter_container(reply, 'r', "stiiay")) > 0) {
-                char *canonical;
-                uint64_t flags;
-                _cleanup_free_ char *pretty = NULL;
-                int ifindex, family;
-                union in_addr_union a;
-
-                r = sd_bus_message_read(reply, "st", &canonical, &flags);
-                if (r < 0)
-                        return bus_log_parse_error(r);
-
-                r = sd_bus_message_read(reply, "i", &ifindex);
-                if (r < 0)
-                        return bus_log_parse_error(r);
-
-                sd_bus_error_free(&error);
-                r = bus_message_read_in_addr_auto(reply, &error, &family, &a);
-                if (r < 0)
-                        return log_error_errno(
-                                r,
-                                "systemd-resolved returned invalid result: %s",
-                                bus_error_message(&error, r));
-
-                r = sd_bus_message_exit_container(reply);
-                if (r < 0)
-                        return bus_log_parse_error(r);
-
-                r = in_addr_ifindex_to_string(family, &a, ifindex, &pretty);
-                if (r < 0)
-                        return log_error_errno(r, "Failed to print address: %m");
-
-                r = table_add_many(
-                        table,
-                        TABLE_STRING,
-                        canonical,
-                        TABLE_STRING,
-                        pretty,
-                        TABLE_STRING,
-                        resolve_flags_to_string(flags));
-                if (r < 0)
-                        return table_log_add_error(r);
-        }
-
-        r = sd_bus_message_exit_container(reply);
-        if (r < 0)
-                return bus_log_parse_error(r);
-
-        r = table_print(table, NULL);
-        if (r < 0)
-                return table_log_print_error(r);
-
-        return 0;
-}
-
 static void help_protocol_types(void) {
         if (arg_legend)
                 puts("Known protocol types:");
@@ -2693,7 +2609,6 @@ static int native_help(void) {
                "  nta [LINK [DOMAIN...]]       Get/set per-interface DNSSEC NTA\n"
                "  revert LINK                  Revert per-interface configuration\n"
                "  log-level [LEVEL]            Get/set logging threshold for systemd-resolved\n"
-               "  show-multicast               Show domain names discovered via LLMNR/mDNS\n"
                "\nOptions:\n"
                "  -h --help                    Show this help\n"
                "     --version                 Show package version\n"
@@ -3237,7 +3152,7 @@ static int native_parse_argv(int argc, char *argv[]) {
 }
 
 static int native_main(int argc, char *argv[], sd_bus *bus) {
-        /* clang-format off */
+
         static const Verb verbs[] = {
                 { "help",                  VERB_ANY, VERB_ANY, 0,            verb_help             },
                 { "status",                VERB_ANY, VERB_ANY, VERB_DEFAULT, verb_status           },
@@ -3259,10 +3174,8 @@ static int native_main(int argc, char *argv[], sd_bus *bus) {
                 { "nta",                   VERB_ANY, VERB_ANY, 0,            verb_nta              },
                 { "revert",                VERB_ANY, 2,        0,            verb_revert_link      },
                 { "log-level",             VERB_ANY, 2,        0,            verb_log_level        },
-                { "show-multicast",        VERB_ANY, VERB_ANY, 0,            verb_show_multicast   },
                 {}
         };
-        /* clang-format on */
 
         return dispatch_verb(argc, argv, verbs, bus);
 }
index 49e23ae4503fb4e00f8b925e65b43399ca0e1156..dd27c50b498289b82c593efcf49c8ecc2cbd21f4 100644 (file)
@@ -132,17 +132,15 @@ static int reply_query_state(DnsQuery *q) {
         }
 }
 
-static int append_address(sd_bus_message *reply, DnsResourceRecord *rr, int ifindex, bool is_container) {
+static int append_address(sd_bus_message *reply, DnsResourceRecord *rr, int ifindex) {
         int r;
 
         assert(reply);
         assert(rr);
 
-        if (is_container) {
-                r = sd_bus_message_open_container(reply, 'r', "iiay");
-                if (r < 0)
-                        return r;
-        }
+        r = sd_bus_message_open_container(reply, 'r', "iiay");
+        if (r < 0)
+                return r;
 
         r = sd_bus_message_append(reply, "i", ifindex);
         if (r < 0)
@@ -167,11 +165,9 @@ static int append_address(sd_bus_message *reply, DnsResourceRecord *rr, int ifin
         if (r < 0)
                 return r;
 
-        if (is_container) {
-                r = sd_bus_message_close_container(reply);
-                if (r < 0)
-                        return r;
-        }
+        r = sd_bus_message_close_container(reply);
+        if (r < 0)
+                return r;
 
         return 0;
 }
@@ -220,7 +216,7 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) {
                 if (r == 0)
                         continue;
 
-                r = append_address(reply, rr, ifindex, true);
+                r = append_address(reply, rr, ifindex);
                 if (r < 0)
                         goto finish;
 
@@ -855,7 +851,7 @@ static int append_srv(DnsQuery *q, sd_bus_message *reply, DnsResourceRecord *rr)
                                 if (r == 0)
                                         continue;
 
-                                r = append_address(reply, zz, ifindex, true);
+                                r = append_address(reply, zz, ifindex);
                                 if (r < 0)
                                         return r;
                         }
@@ -2004,76 +2000,6 @@ static int bus_method_unregister_service(sd_bus_message *message, void *userdata
         return call_dnssd_method(m, message, bus_dnssd_method_unregister, error);
 }
 
-static int bus_method_get_multicast_hosts(sd_bus_message *message, void *userdata, sd_bus_error *error) {
-        _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
-        DnsScope *s;
-        Manager *m = userdata;
-        int r;
-
-        assert(message);
-        assert(m);
-
-        r = sd_bus_message_new_method_return(message, &reply);
-        if (r < 0)
-                return r;
-
-        r = sd_bus_message_open_container(reply, 'a', "(stiiay)");
-        if (r < 0)
-                return r;
-
-        LIST_FOREACH(scopes, s, m->dns_scopes) {
-                _cleanup_(dns_answer_unrefp) DnsAnswer *answer = NULL;
-                DnsResourceRecord *rr;
-                DnsAnswerFlags flags;
-                int ifindex;
-
-                if (s->protocol == DNS_PROTOCOL_DNS)
-                        continue;
-
-                r = dns_cache_dump_to_answer(&s->cache, &answer);
-                if (r < 0)
-                        return r;
-                if (r == 0)
-                        continue;
-
-                DNS_ANSWER_FOREACH_FULL(rr, ifindex, flags, answer) {
-                        _cleanup_free_ char *normalized = NULL;
-                        bool authenticated = FLAGS_SET(flags, DNS_ANSWER_AUTHENTICATED);
-
-                        r = dns_name_normalize(dns_resource_key_name(rr->key), 0, &normalized);
-                        if (r < 0)
-                                return r;
-
-                        r = sd_bus_message_open_container(reply, 'r', "stiiay");
-                        if (r < 0)
-                                return r;
-
-                        r = sd_bus_message_append(
-                                reply,
-                                "st",
-                                normalized,
-                                SD_RESOLVED_FLAGS_MAKE(s->protocol, s->family, authenticated));
-                        if (r < 0)
-                                return r;
-
-                        r = append_address(reply, rr, ifindex, false);
-                        if (r < 0)
-                                return r;
-
-                        r = sd_bus_message_close_container(reply);
-                        if (r < 0)
-                                return r;
-                }
-        }
-
-        r = sd_bus_message_close_container(reply);
-        if (r < 0)
-                return r;
-
-        return sd_bus_reply(message, reply);
-}
-
-/* clang-format off */
 static const sd_bus_vtable resolve_vtable[] = {
         SD_BUS_VTABLE_START(0),
         SD_BUS_PROPERTY("LLMNRHostname", "s", NULL, offsetof(Manager, llmnr_hostname), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
@@ -2212,14 +2138,9 @@ static const sd_bus_vtable resolve_vtable[] = {
                                 SD_BUS_NO_RESULT,
                                 bus_method_reset_server_features,
                                 SD_BUS_VTABLE_UNPRIVILEGED),
-        SD_BUS_METHOD_WITH_ARGS("GetMulticastHosts",
-                                SD_BUS_NO_ARGS,
-                                SD_BUS_RESULT("a(stiiay)", addresses),
-                                bus_method_get_multicast_hosts,
-                                SD_BUS_VTABLE_UNPRIVILEGED),
+
         SD_BUS_VTABLE_END,
 };
-/* clang-format on */
 
 const BusObjectImplementation manager_object = {
         "/org/freedesktop/resolve1",
index e199e8f00ce0f122d261a318681dabe9cd2fc71c..75f1ccb6498ef9987d272aebd46bce1e8473c3d9 100644 (file)
@@ -1066,55 +1066,7 @@ int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p) {
         return 0;
 }
 
-int dns_cache_dump_to_answer(DnsCache *cache, DnsAnswer **ret) {
-        _cleanup_(dns_answer_unrefp) DnsAnswer *answer = NULL;
-        DnsCacheItem *i;
-        size_t n = 0;
-        int r;
-
-        assert(cache);
-        assert(ret);
-
-        HASHMAP_FOREACH(i, cache->by_key) {
-                DnsCacheItem *j;
-
-                LIST_FOREACH(by_key, j, i) {
-                        if (!j->rr)
-                                continue;
-
-                        n++;
-                }
-        }
-
-        if (n == 0) {
-                *ret = NULL;
-                return 0;
-        }
-
-        answer = dns_answer_new(n);
-        if (!answer)
-                return -ENOMEM;
-
-        HASHMAP_FOREACH(i, cache->by_key) {
-                DnsCacheItem *j;
-
-                LIST_FOREACH(by_key, j, i) {
-                        if (!j->rr)
-                                continue;
-
-                        r = dns_answer_add(
-                                answer, j->rr, j->ifindex, j->authenticated ? DNS_ANSWER_AUTHENTICATED : 0);
-                        if (r < 0)
-                                return r;
-                }
-        }
-
-        *ret = TAKE_PTR(answer);
-
-        return n;
-}
-
-void dns_cache_dump_to_file(DnsCache *cache, FILE *f) {
+void dns_cache_dump(DnsCache *cache, FILE *f) {
         DnsCacheItem *i;
 
         if (!cache)
index 6de44cfd054dd6945adbc283f56ce40721afde68..4ab213dc9cd5317d610f0924f41f187d274de42c 100644 (file)
@@ -27,8 +27,7 @@ int dns_cache_lookup(DnsCache *c, DnsResourceKey *key, bool clamp_ttl, int *rcod
 
 int dns_cache_check_conflicts(DnsCache *cache, DnsResourceRecord *rr, int owner_family, const union in_addr_union *owner_address);
 
-void dns_cache_dump_to_file(DnsCache *cache, FILE *f);
-int dns_cache_dump_to_answer(DnsCache *cache, DnsAnswer **answer);
+void dns_cache_dump(DnsCache *cache, FILE *f);
 bool dns_cache_is_empty(DnsCache *cache);
 
 unsigned dns_cache_size(DnsCache *cache);
index d27a19145fc216ddacc81614ede6b319815f719b..d77e81ae3986d8f92adae43cdd8465dfea1c1696 100644 (file)
@@ -1159,7 +1159,7 @@ void dns_scope_dump(DnsScope *s, FILE *f) {
 
         if (!dns_cache_is_empty(&s->cache)) {
                 fputs("CACHE:\n", f);
-                dns_cache_dump_to_file(&s->cache, f);
+                dns_cache_dump(&s->cache, f);
         }
 }