config: fix feature for enabling service only when interface RUNNING
[project/odhcpd.git] / src / netlink.c
index 0a2da03bbc165c1fb34012e22923cfa98b908f0c..9b9fdb862b0aef8343478ebb4095e2fbe384b88d 100644 (file)
@@ -313,8 +313,15 @@ static int handle_rtm_link(struct nlmsghdr *hdr)
 
                iface->ifflags = ifi->ifi_flags;
 
-               if (iface->ifindex == ifi->ifi_index)
+               /*
+                * Assume for link event of the same index, that link changed
+                * and reload services to enable or disable them based on the
+                * RUNNING state of the interface.
+                */
+               if (iface->ifindex == ifi->ifi_index) {
+                       reload_services(iface);
                        continue;
+               }
 
                iface->ifindex = ifi->ifi_index;
                event_info.iface = iface;