Message ID | 20190411130240.10199-1-ms@dev.tdt.de |
---|---|
State | Accepted |
Headers | show |
Series | [OpenWrt-Devel,PATCH/netifd] interface: fix "if-down" hotplug event handling | expand |
Hi, On Thu, Apr 11, 2019 at 3:02 PM Martin Schiller <ms@dev.tdt.de> wrote: > > commit a97297d83e42 ("interface: set interface in TEARDOWN state when checking link state") > broke the if-down hotplug event handling, as the iface->state is now IFS_TEARDOWN when > calling the mark_interface_down() function from the IFPEV_DOWN event. > > Fixes: a97297d83e42 ("interface: set interface in TEARDOWN state when checking link state") > Signed-off-by: Martin Schiller <ms@dev.tdt.de> > --- > interface.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/interface.c b/interface.c > index fd7a826..7c25839 100644 > --- a/interface.c > +++ b/interface.c > @@ -268,7 +268,7 @@ mark_interface_down(struct interface *iface) > iface->link_up_event = false; > iface->state = IFS_DOWN; > switch (state) { > - case IFS_UP: > + case IFS_TEARDOWN: I don't think it's safe to remove the IFS_UP state as mark_interface_down can be called when the interface is either in the IFS_UP or IFS_TEARDOWN state Hans > interface_event(iface, IFEV_DOWN); > break; > case IFS_SETUP: > -- > 2.11.0 >
On 2019-04-11 15:16, Hans Dedecker wrote: > Hi, > > On Thu, Apr 11, 2019 at 3:02 PM Martin Schiller <ms@dev.tdt.de> wrote: >> >> commit a97297d83e42 ("interface: set interface in TEARDOWN state when >> checking link state") >> broke the if-down hotplug event handling, as the iface->state is now >> IFS_TEARDOWN when >> calling the mark_interface_down() function from the IFPEV_DOWN event. >> >> Fixes: a97297d83e42 ("interface: set interface in TEARDOWN state when >> checking link state") >> Signed-off-by: Martin Schiller <ms@dev.tdt.de> >> --- >> interface.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/interface.c b/interface.c >> index fd7a826..7c25839 100644 >> --- a/interface.c >> +++ b/interface.c >> @@ -268,7 +268,7 @@ mark_interface_down(struct interface *iface) >> iface->link_up_event = false; >> iface->state = IFS_DOWN; >> switch (state) { >> - case IFS_UP: >> + case IFS_TEARDOWN: > I don't think it's safe to remove the IFS_UP state as > mark_interface_down can be called when the interface is either in the > IFS_UP or IFS_TEARDOWN state > You are right. I will send a v2 where IFS_UP and IFS_TEARDOWN will be handled. > Hans >> interface_event(iface, IFEV_DOWN); >> break; >> case IFS_SETUP: >> -- >> 2.11.0 >>
diff --git a/interface.c b/interface.c index fd7a826..7c25839 100644 --- a/interface.c +++ b/interface.c @@ -268,7 +268,7 @@ mark_interface_down(struct interface *iface) iface->link_up_event = false; iface->state = IFS_DOWN; switch (state) { - case IFS_UP: + case IFS_TEARDOWN: interface_event(iface, IFEV_DOWN); break; case IFS_SETUP:
commit a97297d83e42 ("interface: set interface in TEARDOWN state when checking link state") broke the if-down hotplug event handling, as the iface->state is now IFS_TEARDOWN when calling the mark_interface_down() function from the IFPEV_DOWN event. Fixes: a97297d83e42 ("interface: set interface in TEARDOWN state when checking link state") Signed-off-by: Martin Schiller <ms@dev.tdt.de> --- interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)