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.
 
 
 
 

63 lines
1.2 KiB

  1. #!/bin/sh
  2. set -e
  3. case $reason in
  4. BOUND6|RENEW6|REBIND6)
  5. ;;
  6. *)
  7. exit 0
  8. ;;
  9. esac
  10. # update /etc/resolv.conf based on received values
  11. make_resolv_conf() {
  12. local new_resolv_conf
  13. if [ -n "$new_dhcp6_domain_search" ] || [ -n "$new_dhcp6_name_servers" ]; then
  14. new_resolv_conf=/etc/resolv.conf.dhclient-new
  15. rm -f $new_resolv_conf
  16. if [ -n "$new_dhcp6_domain_search" ]; then
  17. echo "search $new_dhcp6_domain_search" >> $new_resolv_conf
  18. fi
  19. if [ -n "$new_dhcp6_name_servers" ]; then
  20. for nameserver in $new_dhcp6_name_servers; do
  21. echo "nameserver $nameserver" >> $new_resolv_conf
  22. done
  23. else # keep 'old' nameservers
  24. grep -i '^nameserver' /etc/resolv.conf >> $new_resolv_conf
  25. fi
  26. mv $new_resolv_conf /etc/resolv.conf
  27. fi
  28. }
  29. if [ "$new_ip6_address" ] && [ "$new_ip6_prefixlen" ]; then
  30. ip -6 addr add $new_ip6_address/$new_ip6_prefixlen \
  31. dev $interface scope global
  32. fi
  33. make_resolv_conf
  34. i=0
  35. for srv in $new_dhcp6_name_servers; do
  36. echo "nameserver[$i] $srv"
  37. i=$(($i+1))
  38. done
  39. i=0
  40. for srv in $new_dhcp6_domain_search; do
  41. echo "Domain search list[$i] $srv"
  42. i=$(($i+1))
  43. done
  44. i=0
  45. for srv in $new_dhcp6_sntp_servers; do
  46. echo "NTP server[$i] $srv"
  47. i=$(($i+1))
  48. done
  49. echo "end"