summaryrefslogtreecommitdiff
path: root/src/network/networkd-dhcp4.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-06-07 15:04:11 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-06-07 16:22:00 +0900
commit3ab7ed3f12c7aaad9ded66a64b8a9ac20b0e9793 (patch)
treea4acd4b2729087ad322d2d715955d6f9449d5eaf /src/network/networkd-dhcp4.c
parenta2f684904c688fc09ddf60cc637b8734993e383a (diff)
downloadsystemd-3ab7ed3f12c7aaad9ded66a64b8a9ac20b0e9793.tar.gz
systemd-3ab7ed3f12c7aaad9ded66a64b8a9ac20b0e9793.tar.bz2
systemd-3ab7ed3f12c7aaad9ded66a64b8a9ac20b0e9793.zip
network: ignore callback calls when link is in failed state
Diffstat (limited to 'src/network/networkd-dhcp4.c')
-rw-r--r--src/network/networkd-dhcp4.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 0ca58721b9..ce1e77429b 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -21,10 +21,14 @@ static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *li
link->dhcp4_messages--;
+ if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
+ return 1;
+
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error_errno(link, r, "Could not set DHCPv4 route: %m");
link_enter_failed(link);
+ return 1;
}
if (link->dhcp4_messages == 0) {
@@ -379,12 +383,17 @@ static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *
assert(link);
+ if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
+ return 1;
+
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error_errno(link, r, "Could not set DHCPv4 address: %m");
link_enter_failed(link);
- } else if (r >= 0)
- manager_rtnl_process_address(rtnl, m, link->manager);
+ return 1;
+ }
+
+ manager_rtnl_process_address(rtnl, m, link->manager);
r = link_set_dhcp_routes(link);
if (r < 0) {