scripts: reorganize directory layout
[project/netifd.git] / examples / proto / pptp.sh
1 #!/bin/sh
2 . ../../scripts/netifd-proto.sh
3 init_proto "$@"
4
5 proto_pptp_init_config() {
6         no_device=1
7         available=1
8
9         proto_config_add_string "username"
10         proto_config_add_string "password"
11         proto_config_add_string server
12 }
13
14 proto_pptp_setup() {
15         local interface="$1"
16         local device="$2"
17
18         json_get_var server server
19         proto_add_host_dependency "$interface" "$server"
20
21         json_get_var username username
22         json_get_var password password
23         echo "pptp_setup($interface), username=$username, password=$password"
24         proto_init_update "pptp-$interface" 1
25         proto_set_keep 1
26         proto_add_ipv4_address "192.168.9.1" 32
27         proto_add_dns_server "192.168.9.2"
28         proto_add_ipv4_route "0.0.0.0" 0 192.168.9.2
29         proto_add_data
30         json_add_string "ppp-type" "pptp"
31         proto_close_data
32         proto_send_update "$interface"
33
34         proto_run_command "$interface" sleep 30
35 }
36
37 proto_pptp_teardown() {
38         return
39 }
40
41 add_protocol pptp
42