Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH 2/2] netconfig: Allow to override IPv6 DHCP DNSs with static addresses
Date: Thu, 03 Oct 2019 13:48:51 -0700	[thread overview]
Message-ID: <20191003204851.9781-2-tim.a.kourt@linux.intel.com> (raw)
In-Reply-To: <20191003204851.9781-1-tim.a.kourt@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]

---
 src/netconfig.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/netconfig.c b/src/netconfig.c
index 51d06ce1..7513c5b9 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -346,23 +346,14 @@ static char **netconfig_ipv6_get_dns(struct netconfig *netconfig, uint8_t proto)
 	char **dns_list;
 	char **p;
 
-	switch (proto) {
-	case RTPROT_STATIC:
-		p = dns_list =
-			l_settings_get_string_list(netconfig->active_settings,
+	p = dns_list = l_settings_get_string_list(netconfig->active_settings,
 							"IPv6", "dns", ' ');
-
-		if (!dns_list || !*dns_list) {
-			l_strv_free(dns_list);
-
-			return NULL;
-		}
-
+	if (dns_list && *dns_list) {
 		for (; *p; p++) {
 			if (inet_pton(AF_INET6, *p, &in6_addr) == 1)
 				continue;
 
-			l_error("netconfig: Invalid IPv6 DNS address %s is "
+			l_error("netconfig: Invalid IPv6 DNS address '%s' is "
 				"provided in network configuration file.", *p);
 
 			l_strv_free(dns_list);
@@ -370,9 +361,18 @@ static char **netconfig_ipv6_get_dns(struct netconfig *netconfig, uint8_t proto)
 			return NULL;
 		}
 
+		/* Allow to override the DHCP DNSs with static addressing. */
 		return dns_list;
+	} else if (dns_list) {
+		l_error("netconfig: No IPv6 DNS address is provided in network "
+							"configuration file.");
 
-	case RTPROT_DHCP:
+		l_strv_free(dns_list);
+
+		return NULL;
+	}
+
+	if (proto == RTPROT_DHCP) {
 		/* TODO */
 
 		return NULL;
-- 
2.13.6

  reply	other threads:[~2019-10-03 20:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 20:48 [PATCH 1/2] netconfig: Allow to override IPv4 DHCP DNSs with static addresses Tim Kourt
2019-10-03 20:48 ` Tim Kourt [this message]
2019-10-04 17:14 ` Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191003204851.9781-2-tim.a.kourt@linux.intel.com \
    --to=tim.a.kourt@linux.intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox