summaryrefslogtreecommitdiffhomepage
path: root/dummy/netifd-proto.sh
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-10 02:02:29 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-10 02:02:29 +0200
commite8a8f555aac97b47bd036264b598affec66f96d5 (patch)
tree03df0af00597c372b3ce1d639c25be0e8915a681 /dummy/netifd-proto.sh
parentef6ded206fcebd9852df1f649139afd05db60985 (diff)
add wrappers to parse setup/teardown data
Diffstat (limited to 'dummy/netifd-proto.sh')
-rwxr-xr-xdummy/netifd-proto.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/dummy/netifd-proto.sh b/dummy/netifd-proto.sh
index d15505c..104edc7 100755
--- a/dummy/netifd-proto.sh
+++ b/dummy/netifd-proto.sh
@@ -26,6 +26,16 @@ add_default_handler() {
esac
}
+_proto_do_teardown() {
+ json_load "$data"
+ eval "$1_teardown \"$interface\" \"$ifname\""
+}
+
+_proto_do_setup() {
+ json_load "$data"
+ eval "$1_setup \"$interface\" \"$ifname\""
+}
+
proto="$1"; shift
cmd="$1"; shift
interface="$1"; shift
@@ -56,8 +66,8 @@ case "$cmd" in
[[ "$proto" == "$1" ]] || return 0
case "$cmd" in
- setup) eval "$1_setup \"\$interface\" \"\$data\" \"\$ifname\"" ;;
- teardown) eval "$1_teardown \"\$interface\" \"\$data\" \"\$ifname\"" ;;
+ setup) _proto_do_setup "$1";;
+ teardown) _proto_do_teardown "$1" ;;
*) return 1 ;;
esac
}