From e7dbda3d64e98276570cba3b0c0f94461f77d645 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Thu, 11 Aug 2016 15:53:25 +0200 Subject: proto-shell: Support teardown on layer 3 link loss Commit c6858766 added interface teardown support on layer 3 device link loss mainly for shell protocols who have no proto task like xl2tp. However for shell protocols having a proto task it is not always the correct action to teardown the interface; as an example the PPP daemon can be put into persist state trying to re-establish the link via a hold-off mechanism if layer 3 link loss is detected. Therefore shell handlers can enable via TEARDOWN_ON_L3_LINK_DOWN a proto flag which will teardown the interface when layer 3 link loss is detected Signed-off-by: Hans Dedecker --- proto-shell.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'proto-shell.c') diff --git a/proto-shell.c b/proto-shell.c index 25dec00..4391cdd 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -906,6 +906,10 @@ proto_shell_add_handler(const char *script, const char *name, json_object *obj) if (tmp && json_object_get_boolean(tmp)) handler->proto.flags |= PROTO_FLAG_LASTERROR; + tmp = json_get_field(obj, "teardown-on-l3-link-down", json_type_boolean); + if (tmp && json_object_get_boolean(tmp)) + handler->proto.flags |= PROTO_FLAG_TEARDOWN_ON_L3_LINK_DOWN; + config = json_get_field(obj, "config", json_type_array); if (config) handler->config_buf = netifd_handler_parse_config(&handler->config, config); -- cgit v1.2.3