summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/netifd-proto.sh13
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\""