• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/netifd/examples/proto/ppp.sh

  1 #!/bin/sh
  2 NETIFD_MAIN_DIR=../../scripts
  3 . $NETIFD_MAIN_DIR/netifd-proto.sh
  4 
  5 init_proto "$@"
  6 
  7 ppp_generic_init_config() {
  8         proto_config_add_string "username"
  9         proto_config_add_string "password"
 10         proto_config_add_int "keepalive"
 11 }
 12 
 13 proto_ppp_init_config() {
 14         no_device=1
 15         available=1
 16         ppp_generic_init_config
 17 }
 18 
 19 proto_ppp_setup() {
 20         echo "ppp_setup($1): $2"
 21 }
 22 
 23 proto_ppp_teardown() {
 24         return
 25 }
 26 
 27 add_protocol ppp
 28 
 29 proto_pppoe_init_config() {
 30         ppp_generic_init_config
 31 }
 32 
 33 proto_pppoe_setup() {
 34         local interface="$1"
 35         local device="$2"
 36 
 37         json_get_var username username
 38         json_get_var password password
 39         echo "pppoe_setup($interface, $device), username=$username, password=$password"
 40         proto_init_update pppoe-$interface 1
 41         proto_set_keep 1
 42         proto_add_ipv4_address "192.168.2.1" 32
 43         proto_add_dns_server "192.168.2.2"
 44         proto_add_ipv4_route "0.0.0.0" 0 192.168.2.2
 45         proto_add_data
 46         json_add_string "ppp-type" "pppoe"
 47         proto_close_data
 48         proto_send_update "$interface"
 49 
 50         proto_init_update pppoe-$interface 1
 51         proto_set_keep 1
 52         proto_add_ipv6_address "fe80::2" 64
 53         proto_add_ipv6_route "::0" 0 "fe80::1"
 54         proto_add_data
 55         json_add_string "ppp-type" "pppoe"
 56         proto_close_data
 57         proto_send_update "$interface"
 58 
 59         proto_run_command "$interface" sleep 30
 60 }
 61 
 62 proto_pppoe_teardown() {
 63         [ "$ERROR" = 9 ] && {
 64                 proto_notify_error "$interface" PROCESS_KILLED
 65                 proto_block_restart "$interface"
 66         }
 67         proto_kill_command "$interface"
 68         return
 69 }
 70 
 71 add_protocol pppoe

This page was automatically generated by LXR 0.3.1.  •  OpenWrt