X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=dummy%2Fproto%2Fppp.sh;h=9f0c05095867cbb9197550f29582bab83e69f9e5;hp=cd57145c2bb124266bdff221ebeceb4f01de09ee;hb=3bafc1916e60745ebef60f1de678195824a1f351;hpb=ef6ded206fcebd9852df1f649139afd05db60985 diff --git a/dummy/proto/ppp.sh b/dummy/proto/ppp.sh index cd57145..9f0c050 100755 --- a/dummy/proto/ppp.sh +++ b/dummy/proto/ppp.sh @@ -1,41 +1,58 @@ #!/bin/sh . ../netifd-proto.sh +init_proto "$@" -ppp_init_config() { +ppp_generic_init_config() { proto_config_add_string "username" proto_config_add_string "password" proto_config_add_int "keepalive" } -ppp_setup() { - echo "ppp_setup($1): $2" -} - -ppp_teardown() { - return -} - -ppp_init() { +proto_ppp_init_config() { no_device=1 available=1 + ppp_generic_init_config } -add_protocol ppp - -pppoe_init_config() { - ppp_init_config +proto_ppp_setup() { + echo "ppp_setup($1): $2" } -pppoe_init() { +proto_ppp_teardown() { return } -pppoe_setup() { - echo "pppoe_setup($1, $3): $2" -} +add_protocol ppp -pppoe_teardown() { +proto_pppoe_init_config() { + ppp_generic_init_config +} + +proto_pppoe_setup() { + local interface="$1" + local device="$2" + + json_get_var username username + json_get_var password password + echo "pppoe_setup($interface, $device), username=$username, password=$password" + proto_init_update ppp0 1 + proto_add_ipv4_address "192.168.2.1" 32 + proto_add_dns_server "192.168.2.2" + proto_add_ipv4_route "0.0.0.0" 0 192.168.2.2 + proto_add_data + json_add_string "ppp-type" "pppoe" + proto_close_data + proto_send_update "$interface" + proto_run_command "$interface" sleep 30 +} + +proto_pppoe_teardown() { + [ "$ERROR" = 9 ] && { + proto_notify_error "$interface" PROCESS_KILLED + proto_block_restart "$interface" + } + proto_kill_command "$interface" return }