diff options
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 +} |