Set config state to remove for dynamic interfaces in the following cases :
-interface is set as not available
-interface is set as down
-interface is set as having no link state
This will trigger an interface delete upon the next call of interface_handle_config_change
Before this change you could end up with lingering inactive dynamic
interfaces in case the aliased interface went down as before a dynamic
interface was only removed when set down via ubus
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
+static inline void
+__set_config_state(struct interface *iface, enum interface_config_state s)
+{
+ iface->config_state = s;
+}
+
static void
__interface_set_down(struct interface *iface, bool force)
{
static void
__interface_set_down(struct interface *iface, bool force)
{
case IFS_UP:
case IFS_SETUP:
iface->state = IFS_TEARDOWN;
case IFS_UP:
case IFS_SETUP:
iface->state = IFS_TEARDOWN;
+ if (iface->dynamic)
+ __set_config_state(iface, IFC_REMOVE);
+
if (state == IFS_UP)
interface_event(iface, IFEV_DOWN);
if (state == IFS_UP)
interface_event(iface, IFEV_DOWN);
case IFS_SETUP:
if (!iface->enabled || !link_state) {
interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, false);
case IFS_SETUP:
if (!iface->enabled || !link_state) {
interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, false);
+ if (iface->dynamic)
+ __set_config_state(iface, IFC_REMOVE);
+
mark_interface_down(iface);
}
break;
mark_interface_down(iface);
}
break;
}
if (iface->autostart)
interface_set_up(iface);
}
if (iface->autostart)
interface_set_up(iface);
- else if (iface->dynamic)
- set_config_state(iface, IFC_REMOVE);
static void
set_config_state(struct interface *iface, enum interface_config_state s)
{
static void
set_config_state(struct interface *iface, enum interface_config_state s)
{
- iface->config_state = s;
+ __set_config_state(iface, s);
if (iface->state == IFS_DOWN)
interface_handle_config_change(iface);
else
if (iface->state == IFS_DOWN)
interface_handle_config_change(iface);
else