X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=scripts%2Fnetifd-proto.sh;h=64b3cab92e05e70bbbcf3b7dd51ce623327d7de8;hb=83d3a901d3178a8840092b6e4f7f829b89da4ba0;hp=7f08b1d15c725dd45b85b919712b6bb0d6026fa6;hpb=5e43781680f9f55e0ae7c1b681465d64882e3b8c;p=project%2Fnetifd.git diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh index 7f08b1d..64b3cab 100644 --- a/scripts/netifd-proto.sh +++ b/scripts/netifd-proto.sh @@ -20,6 +20,11 @@ _proto_do_teardown() { eval "proto_$1_teardown \"$interface\" \"$ifname\"" } +_proto_do_renew() { + json_load "$data" + eval "proto_$1_renew \"$interface\" \"$ifname\"" +} + _proto_do_setup() { json_load "$data" _EXPORT_VAR=0 @@ -115,8 +120,10 @@ proto_add_ipv4_route() { local target="$1" local mask="$2" local gw="$3" + local source="$4" + local metric="$5" - append PROTO_ROUTE "$target/$mask/$gw//" + append PROTO_ROUTE "$target/$mask/$gw/$metric///$source" } proto_add_ipv6_route() { @@ -126,8 +133,9 @@ proto_add_ipv6_route() { local metric="$4" local valid="$5" local source="$6" + local table="$7" - append PROTO_ROUTE6 "$target/$mask/$gw/$metric/$valid/$source" + append PROTO_ROUTE6 "$target/$mask/$gw/$metric/$valid/$table/$source" } proto_add_ipv6_prefix() { @@ -205,6 +213,8 @@ _proto_push_route() { str="${str#*/}" local valid="${str%%/*}" str="${str#*/}" + local table="${str%%/*}" + str="${str#*/}" local source="${str}" json_add_object "" @@ -214,6 +224,7 @@ _proto_push_route() { [ -n "$metric" ] && json_add_int metric "$metric" [ -n "$valid" ] && json_add_int valid "$valid" [ -n "$source" ] && json_add_string source "$source" + [ -n "$table" ] && json_add_string table "$table" json_close_object } @@ -351,7 +362,10 @@ init_proto() { dump) add_protocol() { no_device=0 + no_proto_task=0 available=0 + renew_handler=0 + teardown_on_l3_link_down=0 add_default_handler "proto_$1_init_config" @@ -361,11 +375,15 @@ init_proto() { eval "proto_$1_init_config" json_close_array json_add_boolean no-device "$no_device" + json_add_boolean no-proto-task "$no_proto_task" json_add_boolean available "$available" + json_add_boolean renew-handler "$renew_handler" + json_add_boolean lasterror "$lasterror" + json_add_boolean teardown-on-l3-link-down "$teardown_on_l3_link_down" json_dump } ;; - setup|teardown) + setup|teardown|renew) interface="$1"; shift data="$1"; shift ifname="$1"; shift @@ -376,6 +394,7 @@ init_proto() { case "$cmd" in setup) _proto_do_setup "$1";; teardown) _proto_do_teardown "$1" ;; + renew) _proto_do_renew "$1" ;; *) return 1 ;; esac }