netifd-proto.sh: implement proto_add_host_dependency()
authorFelix Fietkau <nbd@openwrt.org>
Sat, 5 May 2012 12:43:00 +0000 (14:43 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 5 May 2012 12:43:00 +0000 (14:43 +0200)
dummy/netifd-proto.sh

index 31af6970b1bf26a4d0ef740f81842b63e3a1f366..74265818218847a20dba28fbb8fd10f466ad150b 100755 (executable)
@@ -164,7 +164,8 @@ _proto_push_array() {
 
 _proto_notify() {
        local interface="$1"
-       ubus call network.interface."$interface" notify_proto "$(json_dump)"
+       local options="$2"
+       ubus $options call network.interface."$interface" notify_proto "$(json_dump)"
 }
 
 proto_send_update() {
@@ -249,6 +250,16 @@ proto_set_available() {
        _proto_notify "$interface"
 }
 
+proto_add_host_dependency() {
+       local interface="$1"
+       local host="$2"
+
+       json_init
+       json_add_int action 6
+       json_add_string host "$host"
+       _proto_notify "$interface" -S
+}
+
 init_proto() {
        proto="$1"; shift
        cmd="$1"; shift