ppp-up 890 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. PPP_IPPARAM="$6"
  3. . /lib/netifd/netifd-proto.sh
  4. proto_init_update "$IFNAME" 1 1
  5. proto_set_keep 1
  6. [ -n "$PPP_IPPARAM" ] && {
  7. [ -n "$IPLOCAL" ] && proto_add_ipv4_address "$IPLOCAL" 32 "" "${IPREMOTE:-2.2.2.2}"
  8. [ -n "$IPREMOTE" ] && proto_add_ipv4_route 0.0.0.0 0 "$IPREMOTE"
  9. [ -n "$LLLOCAL" ] && proto_add_ipv6_address "$LLLOCAL" 128
  10. [ -n "$DNS1" ] && proto_add_dns_server "$DNS1"
  11. [ -n "$DNS2" -a "$DNS1" != "$DNS2" ] && proto_add_dns_server "$DNS2"
  12. }
  13. proto_send_update "$PPP_IPPARAM"
  14. [ -d /etc/ppp/ip-up.d ] && {
  15. for SCRIPT in /etc/ppp/ip-up.d/*
  16. do
  17. [ -x "$SCRIPT" ] && "$SCRIPT" "$@"
  18. done
  19. }
  20. if [ -n "$AUTOIPV6" ]; then
  21. json_init
  22. json_add_string name "${PPP_IPPARAM}_6"
  23. json_add_string ifname "@$PPP_IPPARAM"
  24. json_add_string proto "dhcpv6"
  25. [ -n "$EXTENDPREFIX" ] && json_add_string extendprefix 1
  26. json_close_object
  27. ubus call network add_dynamic "$(json_dump)"
  28. fi