return NULL;
}
+void reload_services(struct interface *iface)
+{
+ if (iface->ifflags & IFF_RUNNING) {
+ syslog(LOG_DEBUG, "Enabling services with %s running", iface->ifname);
+ router_setup_interface(iface, iface->ra != MODE_DISABLED);
+ dhcpv6_setup_interface(iface, iface->dhcpv6 != MODE_DISABLED);
+ ndp_setup_interface(iface, iface->ndp != MODE_DISABLED);
+#ifdef DHCPV4_SUPPORT
+ dhcpv4_setup_interface(iface, iface->dhcpv4 != MODE_DISABLED);
+#endif
+ } else {
+ syslog(LOG_DEBUG, "Disabling services with %s not running", iface->ifname);
+ router_setup_interface(iface, false);
+ dhcpv6_setup_interface(iface, false);
+ ndp_setup_interface(iface, false);
+#ifdef DHCPV4_SUPPORT
+ dhcpv4_setup_interface(iface, false);
+#endif
+ }
+}
+
void odhcpd_reload(void)
{
struct uci_context *uci = uci_alloc_context();
i->ndp = (master && master->ndp == MODE_RELAY) ?
MODE_RELAY : MODE_DISABLED;
- router_setup_interface(i, i->ra != MODE_DISABLED);
- dhcpv6_setup_interface(i, i->dhcpv6 != MODE_DISABLED);
- ndp_setup_interface(i, i->ndp != MODE_DISABLED);
-#ifdef DHCPV4_SUPPORT
- dhcpv4_setup_interface(i, i->dhcpv4 != MODE_DISABLED);
-#endif
+ reload_services(i);
} else
close_interface(i);
}
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;
int router_setup_interface(struct interface *iface, bool enable);
int dhcpv6_setup_interface(struct interface *iface, bool enable);
int ndp_setup_interface(struct interface *iface, bool enable);
+void reload_services(struct interface *iface);
void odhcpd_reload(void);