[LEDE-DEV] [OpenWrt-Devel] [PATCH netifd 2/3] interface: Only teardown interfaces having no proto task when l3_dev link lost

Hans Dedecker dedeckeh at gmail.com
Thu Jul 14 04:28:51 PDT 2016


On Thu, Jul 14, 2016 at 12:01 PM, Yousong Zhou <yszhou4tech at gmail.com> wrote:
> On 14 July 2016 at 16:14, Hans Dedecker <dedeckeh at gmail.com> wrote:
>> Commit c6858766 adds teardown support when l3_dev link is lost especially for shell protocols
>> that have no proto task. However shell protocols which have a proto task running like ppp will
>> also be teared down which is not always the expected action.
>> As an example the PPP daemon can be put into persist state trying to re-establish the link via
>> a hold off mechanism which is not possible when the daemon is terminated by the proto shell
>> teardown.
>> Therefore restrict the teardown action for shell protocols having no proto task.
>>
>
> How about adding an extra flag like managed-link, persistent-link,
> on-demand-link?  It looks to me doing teardown at link-down is more
> common a case.
Initially I was thinking about adding another flag like you propose
but then I was doubting if the change in behavior for shell protocols
having a proto task task was on purpose or not. In case of PPP and
link failure you don't want an immediate restart by netifd in some
cases (see https://github.com/lede-project/source/pull/200) as PPP
daemon can take care of the link re-negotiation based on a holdoff
timeout.
Additionally if the wan link loses connectivity a link down
notification will be received on the main device which will teardown
the protocol. Anyway I'm open for suggestions which way to go forward.

Hans
>
> Regards,
>                 yousong
>
>
>> Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
>> ---
>>  interface.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/interface.c b/interface.c
>> index 7b18cef..8d9dc9c 100644
>> --- a/interface.c
>> +++ b/interface.c
>> @@ -408,7 +408,8 @@ interface_l3_dev_cb(struct device_user *dep, enum device_event ev)
>>
>>         switch (ev) {
>>         case DEV_EVENT_LINK_DOWN:
>> -               interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, false);
>> +               if (iface->proto->handler->flags & PROTO_FLAG_NO_TASK)
>> +                       interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, false);
>>                 break;
>>         default:
>>                 break;
>> --
>> 1.9.1
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the Lede-dev mailing list