summaryrefslogtreecommitdiff
path: root/proto-shell.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2015-04-08 16:20:22 +0200
committerJohn Crispin <blogic@openwrt.org>2015-04-03 10:44:54 +0200
commit92d2aea918f650f309f753349457028032d53280 (patch)
treee221bfb22d1cfe3980b5881bd2c66810118b84ca /proto-shell.c
parent3a0f953722698eab6f3f623a1d6ec5a1b7102b77 (diff)
downloadnetifd-92d2aea918f650f309f753349457028032d53280.tar.gz
netifd: Interface last error support
Adds interface last error support which preserves the last reported error reported by the protocol handler till the interface is up; e.g. survives network reload and interface restarts. This is mainly usefull for tracking down why an interface fails to establish; eg auth failure/traffic limit for PPP interfaces Protocol handlers register last error support by setting lasterror=1 in the proto_init function Signed-off-by: Johan Peeters <johan.peeters111@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'proto-shell.c')
-rw-r--r--proto-shell.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/proto-shell.c b/proto-shell.c
index 977cdbc..7a1896b 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -819,6 +819,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_RENEW_AVAILABLE;
+ tmp = json_get_field(obj, "lasterror", json_type_boolean);
+ if (tmp && json_object_get_boolean(tmp))
+ handler->proto.flags |= PROTO_FLAG_LASTERROR;
+
config = json_get_field(obj, "config", json_type_array);
if (config)
handler->config_buf = netifd_handler_parse_config(&handler->config, config);