You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
858 B

  1. #!/bin/sh
  2. if [ "$ACTION" = ifup ]; then
  3. . /lib/functions.sh
  4. include /lib/network
  5. scan_interfaces
  6. update_tunnel() {
  7. local cfg="$1"
  8. local proto
  9. config_get proto "$cfg" proto
  10. [ "$proto" = tayga ] || return 0
  11. local wandev4
  12. config_get wandev4 "$cfg" wan4_device "$(find_tayga_wanif4)"
  13. local wandev6
  14. config_get wandev6 "$cfg" wan6_device "$(find_tayga_wanif6)"
  15. [ "$wandev4" = "$DEVICE" ] || [ "$wandev6" = "$DEVICE" ] || return 0
  16. local wanip4=$(find_tayga_wanip4 "$wandev4")
  17. local wanip6=$(find_tayga_wanip6 "$wandev6")
  18. [ -n "$wanip4" ] && [ -n "$wanip6" ] && {
  19. uci_set_state network "$cfg" ipv4addr "$wanip4"
  20. uci_set_state network "$cfg" ipv6addr "$wanip6"
  21. logger -t tayga-update "Re-establishing tayga NAT64 due to change on $INTERFACE ($DEVICE)"
  22. ifup "$cfg" &
  23. }
  24. }
  25. config_foreach update_tunnel interface
  26. fi