diff options
author | Marcin Jurkowski <marcin1j@gmail.com> | 2016-10-26 03:04:01 +0200 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2016-10-27 11:58:42 +0200 |
commit | 1615fc93b878eb28af434a7093631109197c7197 (patch) | |
tree | bf36bcf010719d34e2737cbc2314f0a0161fe892 /scripts/netifd-proto.sh | |
parent | 5479d6f1eefd1e5a7258b9eedbf92214a95db819 (diff) |
proto-shell: add helpers for generic options in proto handlers
Adding helpers for virtual interfaces generic options in ncm, qmi, mbim
and directip protocols as suggested by Felix in
https://lists.openwrt.org/pipermail/openwrt-devel/2016-February/039794.html
Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
Diffstat (limited to 'scripts/netifd-proto.sh')
-rw-r--r-- | scripts/netifd-proto.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh index 64b3cab..cc7031a 100644 --- a/scripts/netifd-proto.sh +++ b/scripts/netifd-proto.sh @@ -1,4 +1,5 @@ NETIFD_MAIN_DIR="${NETIFD_MAIN_DIR:-/lib/netifd}" +PROTO_DEFAULT_OPTIONS="defaultroute peerdns metric" . /usr/share/libubox/jshn.sh . $NETIFD_MAIN_DIR/utils.sh @@ -15,6 +16,18 @@ proto_config_add_boolean() { config_add_boolean "$@" } +proto_config_add_defaults() { + proto_config_add_boolean "defaultroute" + proto_config_add_boolean "peerdns" + proto_config_add_int "metric" +} + +proto_add_dynamic_defaults() { + [ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute" + [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns" + [ -n "$metric" ] && json_add_int metric "$metric" +} + _proto_do_teardown() { json_load "$data" eval "proto_$1_teardown \"$interface\" \"$ifname\"" |