summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/network/networkd-json.c44
-rw-r--r--src/network/networkd-state-file.c32
2 files changed, 38 insertions, 38 deletions
diff --git a/src/network/networkd-json.c b/src/network/networkd-json.c
index 07d52c96c0..fd2b709d9d 100644
--- a/src/network/networkd-json.c
+++ b/src/network/networkd-json.c
@@ -561,18 +561,16 @@ static int dnr_append_json(Link *link, sd_json_variant **v) {
return r;
n_dnr = sd_dhcp_lease_get_dnr(link->dhcp_lease, &dnr);
- if (n_dnr < 0)
- return 0;
-
- FOREACH_ARRAY(res, dnr, n_dnr) {
- r = dnr_append_json_one(link,
- res,
- NETWORK_CONFIG_SOURCE_DHCP4,
- &s,
- &array);
- if (r < 0)
- return r;
- }
+ if (n_dnr > 0)
+ FOREACH_ARRAY(res, dnr, n_dnr) {
+ r = dnr_append_json_one(link,
+ res,
+ NETWORK_CONFIG_SOURCE_DHCP4,
+ &s,
+ &array);
+ if (r < 0)
+ return r;
+ }
}
if (link->dhcp6_lease && link_get_use_dnr(link, NETWORK_CONFIG_SOURCE_DHCP6)) {
@@ -585,18 +583,16 @@ static int dnr_append_json(Link *link, sd_json_variant **v) {
return r;
n_dnr = sd_dhcp6_lease_get_dnr(link->dhcp6_lease, &dnr);
- if (n_dnr < 0)
- return 0;
-
- FOREACH_ARRAY(res, dnr, n_dnr) {
- r = dnr_append_json_one(link,
- res,
- NETWORK_CONFIG_SOURCE_DHCP6,
- &s,
- &array);
- if (r < 0)
- return r;
- }
+ if (n_dnr > 0)
+ FOREACH_ARRAY(res, dnr, n_dnr) {
+ r = dnr_append_json_one(link,
+ res,
+ NETWORK_CONFIG_SOURCE_DHCP6,
+ &s,
+ &array);
+ if (r < 0)
+ return r;
+ }
}
if (link_get_use_dnr(link, NETWORK_CONFIG_SOURCE_NDISC)) {
diff --git a/src/network/networkd-state-file.c b/src/network/networkd-state-file.c
index 0c9e530128..da917dd897 100644
--- a/src/network/networkd-state-file.c
+++ b/src/network/networkd-state-file.c
@@ -600,14 +600,16 @@ static void serialize_resolvers(
int r;
r = sd_dhcp_lease_get_dnr(lease, &resolvers);
- if (r < 0)
- return (void) log_debug_errno(r, "Failed to get DNR from DHCP lease, ignoring: %m");
+ if (r < 0 && r != -ENODATA)
+ log_warning_errno(r, "Failed to get DNR from DHCP lease, ignoring: %m");
- r = dns_resolvers_to_dot_strv(resolvers, r, &names);
- if (r < 0)
- return (void) log_warning_errno(r, "Failed to get DoT servers from DHCP DNR, ignoring: %m");
- if (r > 0)
- fputstrv(f, names, NULL, space);
+ if (r > 0) {
+ r = dns_resolvers_to_dot_strv(resolvers, r, &names);
+ if (r < 0)
+ return (void) log_warning_errno(r, "Failed to get DoT servers from DHCP DNR, ignoring: %m");
+ if (r > 0)
+ fputstrv(f, names, NULL, space);
+ }
}
if (lease6 && conditional6) {
@@ -616,14 +618,16 @@ static void serialize_resolvers(
int r;
r = sd_dhcp6_lease_get_dnr(lease6, &resolvers);
- if (r < 0)
- return (void) log_debug_errno(r, "Failed to get DNR from DHCPv6 lease, ignoring: %m");
+ if (r < 0 && r != -ENODATA)
+ log_warning_errno(r, "Failed to get DNR from DHCPv6 lease, ignoring: %m");
- r = dns_resolvers_to_dot_strv(resolvers, r, &names);
- if (r < 0)
- return (void) log_warning_errno(r, "Failed to get DoT servers from DHCPv6 DNR, ignoring: %m");
- if (r > 0)
- fputstrv(f, names, NULL, space);
+ if (r > 0) {
+ r = dns_resolvers_to_dot_strv(resolvers, r, &names);
+ if (r < 0)
+ return (void) log_warning_errno(r, "Failed to get DoT servers from DHCPv6 DNR, ignoring: %m");
+ if (r > 0)
+ fputstrv(f, names, NULL, space);
+ }
}
if (lvalue)