From daea3a698527486986fcdc44f30125310b1545ab Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Mon, 21 Aug 2023 19:27:56 -0700 Subject: [PATCH] apply upstream fixes --- lib/tapnet.pm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/tapnet.pm b/lib/tapnet.pm index 379fe462..28864f46 100644 --- a/lib/tapnet.pm +++ b/lib/tapnet.pm @@ -56,14 +56,12 @@ sub setup_tap_static { } sub get_host_dns { - # get DNS server addresses from the host - my @forwards; - open(FH, '<', "/etc/resolv.conf"); - while () { - if ($_ =~ m/^nameserver +(.+)/) { - push @forwards, $1; - } - } + # get DNS server addresses from the host. Assumes host uses + # systemd-resolved and doesn't use IPv6, for now + my $result = `/usr/bin/resolvectl status | grep Servers | tail -1 | cut -d: -f2-`; + # FIXME this is gonna break when we have IPv6 DNS servers on the + # worker hosts + my @forwards = split(' ', $result); return @forwards; }