_proto_do_teardown() {
json_load "$data"
- eval "$1_teardown \"$interface\" \"$ifname\""
+ eval "proto_$1_teardown \"$interface\" \"$ifname\""
}
_proto_do_setup() {
json_load "$data"
_EXPORT_VAR=0
_EXPORT_VARS=
- eval "$1_setup \"$interface\" \"$ifname\""
+ eval "proto_$1_setup \"$interface\" \"$ifname\""
}
proto_init_update() {
PROTO_IP6ADDR=
PROTO_ROUTE=
PROTO_ROUTE6=
+ PROTO_DNS=
+ PROTO_DNS_SEARCH=
json_init
json_add_int action 0
[ -n "$ifname" -a "*" != "$ifname" ] && json_add_string "ifname" "$ifname"
_proto_notify "$interface"
}
+proto_notify_error() {
+ local interface="$1"; shift
+
+ json_init
+ json_add_int action 3
+ json_add_array error
+ while [ $# -gt 0 ]; do
+ json_add_string "" "$1"
+ shift
+ done
+ json_close_array
+ _proto_notify "$interface"
+}
+
+proto_block_restart() {
+ local interface="$1"; shift
+
+ json_init
+ json_add_int action 4
+ _proto_notify "$interface"
+}
+
+proto_set_available() {
+ local interface="$1"
+ local state="$2"
+ json_init
+ json_add_int action 5
+ json_add_boolean available "$state"
+ _proto_notify "$interface"
+}
+
init_proto() {
proto="$1"; shift
cmd="$1"; shift
no_device=0
available=0
- add_default_handler "$1_init_config"
+ add_default_handler "proto_$1_init_config"
json_init
json_add_string "name" "$1"
- eval "$1_init"
- json_add_boolean no-device "$no_device"
- json_add_boolean available "$available"
json_add_array "config"
- eval "$1_init_config"
+ eval "proto_$1_init_config"
json_close_array
+ json_add_boolean no-device "$no_device"
+ json_add_boolean available "$available"
json_dump
}
;;