From 2cc1190666ddfb2dc2a5fbf4febe7a4579d0c2f5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 15 Mar 2012 01:54:09 +0100 Subject: [PATCH] add shell functions for adding tunnel data in proto notify --- dummy/netifd-proto.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dummy/netifd-proto.sh b/dummy/netifd-proto.sh index b04bc89..69aa27d 100755 --- a/dummy/netifd-proto.sh +++ b/dummy/netifd-proto.sh @@ -44,6 +44,7 @@ proto_init_update() { local external="$3" PROTO_INIT=1 + PROTO_TUNNEL_OPEN= PROTO_IPADDR= PROTO_IP6ADDR= PROTO_ROUTE= @@ -57,6 +58,19 @@ proto_init_update() { [ -n "$3" ] && json_add_boolean "address-external" "$external" } +proto_add_tunnel() { + proto_close_tunnel + + PROTO_TUNNEL_OPEN=1 + json_add_object "tunnel" +} + +proto_close_tunnel() { + [ -n "$PROTO_TUNNEL_OPEN" ] || return + json_close_object + PROTO_TUNNEL_OPEN= +} + proto_add_dns_server() { local address="$1" @@ -138,6 +152,7 @@ _proto_notify() { proto_send_update() { local interface="$1" + proto_close_tunnel _proto_push_array "ipaddr" "$PROTO_IPADDR" _proto_push_ip _proto_push_array "ip6addr" "$PROTO_IP6ADDR" _proto_push_ip _proto_push_array "routes" "$PROTO_ROUTE" _proto_push_route -- 2.25.1