From 00ec496877453cc37ceec0633821a47f128d9f4f Mon Sep 17 00:00:00 2001 From: Yuxiang Zhu Date: Mon, 14 Nov 2022 10:23:46 +0800 Subject: T4815: Fix various name server config issues 1. When a PPPoE session is connected, `pppd` will update `/etc/resolv.conf` regardless of `system name-server` option unless `no-peer-dns` is set. This is because `pppd` vendors scripts `/etc/ppp/ip-up.d/0000usepeerdns` and `/etc/ppp/ip-down.d/0000usepeerdns`, which updates `/etc/resolv.conf` on PPPoE connection and reverts the change on disconnection. This PR removes those scripts and adds custom scripts to update name server entries through `vyos-hostsd` instead. 2. There is a typo in `/etc/dhcp/dhclient-enter-hooks.d/04-vyos-resolvconf, which misspells variable name `new_dhcp6_name_servers` as `new_dhcpv6_name_servers`. This causes IPv6 name server entries in `vyos-hostsd` not updated when dhclient receives nameservers from DHCPv6. 3. Regular expressions in scripts under `/etc/dhcp/dhclient-enter-hooks.d` and `/etc/dhcp/dhclient-exit-hooks.d/` are not enclosed in `^$`, so those IPv4 related branches (like `BOUND`) could be mistakenly executed when an IPv6 reason (like `BOUND6`) is given. --- .../ppp/ip-up.d/98-vyos-pppoe-setup-nameservers | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers (limited to 'src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers') 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 100644 index 000000000..0fcedbedc --- /dev/null +++ b/src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers @@ -0,0 +1,24 @@ +#!/bin/bash +### Autogenerated by interfaces-pppoe.py ### + +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 -- cgit v1.2.3 From b8a4442c898727eaf7def8c42ee850fbb9dd60be Mon Sep 17 00:00:00 2001 From: Yuxiang Zhu Date: Tue, 15 Nov 2022 13:52:14 +0800 Subject: T4815: ip-up/down scripts needs the executable bit ip-up/down scripts added in https://github.com/vyos/vyos-1x/pull/1656 need the executable bit. --- src/etc/ppp/ip-down.d/98-vyos-pppoe-cleanup-nameservers | 0 src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 src/etc/ppp/ip-down.d/98-vyos-pppoe-cleanup-nameservers mode change 100644 => 100755 src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers (limited to 'src/etc/ppp/ip-up.d/98-vyos-pppoe-setup-nameservers') 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 old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 -- cgit v1.2.3