summaryrefslogtreecommitdiff
path: root/src/etc/ppp/ip-up.d
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-11-15 14:12:09 +0100
committerGitHub <noreply@github.com>2022-11-15 14:12:09 +0100
commit6d90375db4dd0c9beb2815e8ceae2d6214465f99 (patch)
tree050292e6ba92248a02948c430ec5da778e90833d /src/etc/ppp/ip-up.d
parentb3e524c29e9f5c8e7536ba86de9097be70fe5fb6 (diff)
parentff901a52bb9acd4bdd0e3a96033c896e4667a6af (diff)
downloadvyos-1x-6d90375db4dd0c9beb2815e8ceae2d6214465f99.tar.gz
vyos-1x-6d90375db4dd0c9beb2815e8ceae2d6214465f99.zip
Merge pull request #1659 from vfreex/fix-ns-config-equuleus
backport: T4815: Fix various name server config issues
Diffstat (limited to 'src/etc/ppp/ip-up.d')
-rwxr-xr-xsrc/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers23
1 files changed, 23 insertions, 0 deletions
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