]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: ignore nameserver= and domain= kernel command line options without value
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Aug 2023 18:00:34 +0000 (03:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Aug 2023 18:16:03 +0000 (03:16 +0900)
Otherwise, manager_parse_dns_server_string_and_warn() or
manager_parse_search_domains_and_warn() will trigger assertion.

src/resolve/resolved-conf.c

index 3a67a4747e48158f6e66827085ff45e1b32d71ef..94a579275fdefc71bacd18c06e687a459aade89a 100644 (file)
@@ -518,6 +518,10 @@ static int proc_cmdline_callback(const char *key, const char *value, void *data)
          * interpret, for example dracut and SUSE Linux. */
 
         if (proc_cmdline_key_streq(key, "nameserver")) {
+
+                if (proc_cmdline_value_missing(key, value))
+                        return 0;
+
                 if (!info->dns_server_unlinked) {
                         /* The kernel command line overrides any prior configuration */
                         dns_server_unlink_all(manager_get_first_dns_server(info->manager, DNS_SERVER_SYSTEM));
@@ -532,6 +536,9 @@ static int proc_cmdline_callback(const char *key, const char *value, void *data)
 
         } else if (proc_cmdline_key_streq(key, "domain")) {
 
+                if (proc_cmdline_value_missing(key, value))
+                        return 0;
+
                 if (!info->search_domain_unlinked) {
                         dns_search_domain_unlink_all(info->manager->search_domains);
                         info->search_domain_unlinked = true;