diff options
author | Yuxiang Zhu <vfreex@gmail.com> | 2022-11-14 10:23:46 +0800 |
---|---|---|
committer | Yuxiang Zhu <vfreex@gmail.com> | 2022-11-15 13:56:56 +0800 |
commit | ff901a52bb9acd4bdd0e3a96033c896e4667a6af (patch) | |
tree | 050292e6ba92248a02948c430ec5da778e90833d /src/etc/ppp | |
parent | b3e524c29e9f5c8e7536ba86de9097be70fe5fb6 (diff) | |
download | vyos-1x-ff901a52bb9acd4bdd0e3a96033c896e4667a6af.tar.gz vyos-1x-ff901a52bb9acd4bdd0e3a96033c896e4667a6af.zip |
backport: T4815: Fix various name server config issues
This is a backport of https://github.com/vyos/vyos-1x/pull/1656.
Note I also changed `ip-down.script.tmpl` to not wait for `systemctl
stop dhcp6c@$iface.service`, because that command is slow and pppd will
kill the ip-down script if it times out.
I didn't see `ip-down.script.tmpl` or its equivalent in the 1.4 branch.
Not sure if there is another mechanism to handle that functionality or
it is missed.
Diffstat (limited to 'src/etc/ppp')
-rwxr-xr-x | src/etc/ppp/ip-down.d/98-vyos-pppoe-cleanup-nameservers | 14 | ||||
-rwxr-xr-x | src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers | 23 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/etc/ppp/ip-down.d/98-vyos-pppoe-cleanup-nameservers b/src/etc/ppp/ip-down.d/98-vyos-pppoe-cleanup-nameservers new file mode 100755 index 000000000..5157469f4 --- /dev/null +++ b/src/etc/ppp/ip-down.d/98-vyos-pppoe-cleanup-nameservers @@ -0,0 +1,14 @@ +#!/bin/bash + +interface=$6 +if [ -z "$interface" ]; then + exit +fi + +if ! /usr/bin/systemctl -q is-active vyos-hostsd; then + exit # vyos-hostsd is not running +fi + +hostsd_client="/usr/bin/vyos-hostsd-client" +$hostsd_client --delete-name-servers --tag "dhcp-$interface" +$hostsd_client --apply diff --git a/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers b/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers new file mode 100755 index 000000000..4affaeb5c --- /dev/null +++ b/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers @@ -0,0 +1,23 @@ +#!/bin/bash + +interface=$6 +if [ -z "$interface" ]; then + exit +fi + +if ! /usr/bin/systemctl -q is-active vyos-hostsd; then + exit # vyos-hostsd is not running +fi + +hostsd_client="/usr/bin/vyos-hostsd-client" + +$hostsd_client --delete-name-servers --tag "dhcp-$interface" + +if [ "$USEPEERDNS" ] && [ -n "$DNS1" ]; then +$hostsd_client --add-name-servers "$DNS1" --tag "dhcp-$interface" +fi +if [ "$USEPEERDNS" ] && [ -n "$DNS2" ]; then +$hostsd_client --add-name-servers "$DNS2" --tag "dhcp-$interface" +fi + +$hostsd_client --apply |