X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=dummy%2Fnetifd-proto.sh;h=c50d776a6b0f4fa7d8a036709a0a9dcfc1e0a074;hp=85e86983b0fa07a1907ff9b0f3118cfb9bfdcfd0;hb=10c7565766962a876844c71dd3a230aefeaf193b;hpb=3085170188cc5bf04f4cfb6f07c292e06d2b40a8 diff --git a/dummy/netifd-proto.sh b/dummy/netifd-proto.sh index 85e8698..c50d776 100755 --- a/dummy/netifd-proto.sh +++ b/dummy/netifd-proto.sh @@ -47,6 +47,7 @@ proto_init_update() { PROTO_ROUTE= PROTO_ROUTE6= json_init + json_add_int action 0 json_add_string "ifname" "$ifname" json_add_boolean "link-up" "$up" [ -n "$3" ] && json_add_boolean "address-external" "$external" @@ -113,6 +114,10 @@ _proto_push_array() { json_close_array } +_proto_notify() { + ubus call network.interface."$interface" notify_proto "$(json_dump)" +} + proto_send_update() { local interface="$1" @@ -120,7 +125,18 @@ proto_send_update() { _proto_push_array "ip6addr" "$PROTO_IP6ADDR" _proto_push_ip _proto_push_array "route" "$PROTO_ROUTE" _proto_push_route _proto_push_array "route6" "$PROTO_ROUTE6" _proto_push_route - ubus call network.interface."$interface" notify_proto "$(json_dump)" & + _proto_notify +} + +proto_run_command() { + json_init + json_add_int action 1 + json_add_array command + while [ $# -gt 0 ]; do + json_add_string "" "$1" + shift + done + _proto_notify } init_proto() {