networkd: Ignore DNS information when uplink is not managed (#7571)
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 8 Dec 2017 12:33:40 +0000 (14:33 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 8 Dec 2017 12:33:40 +0000 (13:33 +0100)
When another networking daemon or configuration is handling the
uplink connection, systemd-networkd won't have a network configuration
associated with the link, and therefore link->network will be NULL.
An assert will be triggered later on in the code when link->network is
NULL.

src/network/networkd-radv.c

index 630e1dc..535454c 100644 (file)
@@ -92,6 +92,11 @@ static int radv_set_dns(Link *link, Link *uplink) {
                 goto set_dns;
 
         if (uplink) {
+                if (uplink->network == NULL) {
+                        log_link_debug(uplink, "Cannot fetch DNS servers as uplink interface is not managed by us");
+                        return 0;
+                }
+
                 r = radv_get_ip6dns(uplink->network, &dns, &n_dns);
                 if (r > 0)
                         goto set_dns;
@@ -125,6 +130,11 @@ static int radv_set_domains(Link *link, Link *uplink) {
                 goto set_domains;
 
         if (uplink) {
+                if (uplink->network == NULL) {
+                        log_link_debug(uplink, "Cannot fetch DNS search domains as uplink interface is not managed by us");
+                        return 0;
+                }
+
                 search_domains = uplink->network->search_domains;
                 if (search_domains)
                         goto set_domains;