diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-02-19 07:09:28 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-02-19 12:14:27 +0100 |
commit | 825ace96b1076ac367d2962e3979f62954145812 (patch) | |
tree | e424e61265cf88e7fb5a88b1389dfc0c56cf86f0 /src/network/networkd-dhcp4.c | |
parent | man: drop unnecessary parenthesis (diff) | |
download | systemd-825ace96b1076ac367d2962e3979f62954145812.tar.xz systemd-825ace96b1076ac367d2962e3979f62954145812.zip |
network: do not log wrong error cause
If sd_dhcp_lease_get_router() returns a positive value and the first
router is null, then invalid error cause was logged.
Follow-up for f8862395e8f802e4106a07ceaaf02b6a1faa5a6d.
Diffstat (limited to 'src/network/networkd-dhcp4.c')
-rw-r--r-- | src/network/networkd-dhcp4.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 4493da4d59..c8eca66545 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -120,10 +120,12 @@ static int link_set_dhcp_routes(Link *link) { } r = sd_dhcp_lease_get_router(link->dhcp_lease, &router); - if (r < 0 && r != -ENODATA) + if (IN_SET(r, 0, -ENODATA)) + log_link_info(link, "DHCP: No gateway received from DHCP server."); + else if (r < 0) log_link_warning_errno(link, r, "DHCP error: could not get gateway: %m"); - else if (r <= 0 || in4_addr_is_null(&router[0])) - log_link_info_errno(link, r, "DHCP: No gateway received from DHCP server: %m"); + else if (in4_addr_is_null(&router[0])) + log_link_info(link, "DHCP: Received gateway is null."); /* According to RFC 3442: If the DHCP server returns both a Classless Static Routes option and a Router option, the DHCP client MUST ignore the Router option. */ |