diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-02-13 17:32:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-13 17:32:18 +0100 |
commit | 13bc01034d287ffdf1249138ddfbdbb1866b5a93 (patch) | |
tree | 755a97aa42b8e98699927543ffe7766f5b847a0f /src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf | |
parent | 233c463b4cf6f8ca4d3e2a1a3a30e5c62ce42061 (diff) | |
parent | e39f2ead18c17fa4a8fdfe35437202fb202e983a (diff) | |
download | vyos-1x-13bc01034d287ffdf1249138ddfbdbb1866b5a93.tar.gz vyos-1x-13bc01034d287ffdf1249138ddfbdbb1866b5a93.zip |
Merge pull request #218 from zdc/T1987
dhclient-script: T1987: Multiple fixes in dhclient-script
Diffstat (limited to 'src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf')
-rw-r--r-- | src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf b/src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf new file mode 100644 index 000000000..ea5562ea8 --- /dev/null +++ b/src/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf @@ -0,0 +1,39 @@ +# modified make_resolv_conf () for Vyatta system below +make_resolv_conf() { + if [ -n "$new_domain_name" ]; then + logmsg info "Adding search-domain \"$new_domain_name\" via vyos-hostsd-client" + /usr/bin/vyos-hostsd-client --set-host-name --search-domain $new_domain_name + fi + + if [ -n "$new_dhcp6_domain_search" ]; then + logmsg info "Adding search-domain \"$new_dhcp6_domain_search\" via vyos-hostsd-client" + /usr/bin/vyos-hostsd-client --set-host-name --search-domain $new_dhcp6_domain_search + fi + + if [ -n "$new_domain_name_servers" ] && ! cli-shell-api existsEffective system disable-dhcp-nameservers && [ "$new_domain_name_servers" != "$old_domain_name_servers" ] ; then + logmsg info "Deleting nameservers with tag \"dhcp-$interface\" via vyos-hostsd-client" + vyos-hostsd-client --delete-name-servers --tag dhcp-$interface + NEW_SERVERS="" + for nameserver in $new_domain_name_servers; do + NEW_SERVERS="$NEW_SERVERS --name-server $nameserver" + done + logmsg info "Adding nameservers \"$NEW_SERVERS\" with tag \"dhcp-$interface\" via vyos-hostsd-client" + /usr/bin/vyos-hostsd-client --add-name-servers $NEW_SERVERS --tag dhcp-$interface + fi + + if [ -n "$new_dhcp6_name_servers" ] && ! cli-shell-api existsEffective system disable-dhcp-nameservers && [ "$new_dhcp6_name_servers" != "$old_dhcp6_name_servers" ] ; then + logmsg info "Deleting nameservers with tag \"dhcpv6-$interface\" via vyos-hostsd-client" + vyos-hostsd-client --delete-name-servers --tag dhcpv6-$interface + NEW_SERVERS="" + for nameserver in $new_dhcp6_name_servers; do + NEW_SERVERS="$NEW_SERVERS --name-server $nameserver" + done + logmsg info "Adding nameservers \"$NEW_SERVERS\" with tag \"dhcpv6-$interface\" via vyos-hostsd-client" + /usr/bin/vyos-hostsd-client --add-name-servers $NEW_SERVERS --tag dhcpv6-$interface + fi + + if cli-shell-api existsEffective service dns forwarding; then + logmsg info "Enabling DNS forwarding" + /usr/libexec/vyos/conf_mode/dns_forwarding.py --dhclient + fi +} |