Change in openvpn[master]: Add information-gathering about DNS resolvers configured to t_client....
A message that is not in the archive (sent off-list or not yet received): gerrit.1746440138000.I9cae7314203424e4a604073c5445559260172477@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/961?usp=email
to review the following change.
Change subject: Add information-gathering about DNS resolvers configured to t_client.sh(.in)
......................................................................
Add information-gathering about DNS resolvers configured to t_client.sh(.in)
With the patchsets to add DNS configuration on Unix+MacOS systems, and the addition of test stanzas to excercise and verify the OS specific "dns-updown" script, it becomes important to trace test failures ("did it not ping because the DNS was not installed, or did something else fail?") and also verify that DNS config is properly restored at the end of each test.
Linux is probed with "resolvectl status", if available, and "cat resolv.conf" if not. MacOS uses scutil --dns.
All other platforms use "cat resolv.conf" for now (because even if "a tool to maintain DNS config" is available, in the end resolv.conf is always where the final config lands).
Include a bit of restructuring to handle linux iproute2 testing in the "Linux" branch, and make the control flow more amenable to having a second case / esac block.
---
M tests/t_client.sh.in
1 file changed, 41 insertions(+), 23 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/961/1
tests/t_client.sh.in +41 -23
@@ -166,53 +166,71 @@ # this is higly system dependent... get_ifconfig_route() { - # linux / iproute2? (-> if configure got a path) - if [ -n "@IPROUTE@" ] - then - echo "-- linux iproute2 --" - @IPROUTE@ addr show | grep -v valid_lft - @IPROUTE@ route show - @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' - return - fi - - # try uname - case `uname -s` in + UNAME=`uname -s` + case $UNAME in Linux) - echo "-- linux / ifconfig --" - LANG=C @IFCONFIG@ -a |egrep "( addr:|encap:)" - LANG=C @NETSTAT@ -rn -4 -6 - return - ;; + # linux / iproute2? (-> if configure got a path) + if [ -n "@IPROUTE@" ] + then + echo "-- linux iproute2 --" + @IPROUTE@ addr show | grep -v valid_lft + @IPROUTE@ route show + @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' + else + echo "-- linux / ifconfig --" + LANG=C @IFCONFIG@ -a |egrep "( addr:|encap:)" + LANG=C @NETSTAT@ -rn -4 -6 + fi + ;; FreeBSD|NetBSD|Darwin) echo "-- FreeBSD/NetBSD/Darwin [MacOS X] --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }' - return ;; OpenBSD) echo "-- OpenBSD --" @IFCONFIG@ -a | egrep "(flags=|inet)" | \ sed -e 's/pltime [0-9]*//' -e 's/vltime [0-9]*//' @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }' - return ;; SunOS) echo "-- Solaris --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$6 }' - return ;; AIX) echo "-- AIX --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$6 }' - return ;; + *) + echo "get_ifconfig_route(): no idea how to get info on your OS (`uname -s`). FAIL." >&2 + exit 20 + ;; esac - echo "get_ifconfig_route(): no idea how to get info on your OS. FAIL." >&2 - exit 20 + # another round of per-platform information gathering, for DNS info + # for most of the platforms "cat /etc/resolv.conf" is good enough + # except Linux and MacOS + case $UNAME in + Linux) + if [ -x /usr/bin/resolvectl ] ; then + echo "-- linux resolvectl --" + resolvectl status + else + echo "-- linux resolv.conf --" + cat /etc/resolv.conf + fi + ;; + Darwin) + echo "-- MacOS scutil --dns" + scutil --dns + ;; + *) + echo "-- resolv.conf --" + cat /etc/resolv.conf + ;; + esac } # ----------------------------------------------------------
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/961?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9cae7314203424e4a604073c5445559260172477
Gerrit-Change-Number: 961
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: cron2, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/961?usp=email )
Change subject: Add information-gathering about DNS resolvers configured to t_client.sh(.in)
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/961?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9cae7314203424e4a604073c5445559260172477
Gerrit-Change-Number: 961
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Mon, 05 May 2025 13:45:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v3 1/1 Add information-gathering about DNS resolvers configured to t_client.sh(.in)
In reply to a message not in the archiveWith the patchsets to add DNS configuration on Unix+MacOS systems, and the addition of test stanzas to excercise and verify the OS specific "dns-updown" script, it becomes important to trace test failures ("did it not ping because the DNS was not installed, or did something else fail?") and also verify that DNS config is properly restored at the end of each test.
Linux is probed with "resolvectl status", if available, and "cat resolv.conf" if not. MacOS uses scutil --dns.
All other platforms use "cat resolv.conf" for now (because even if "a tool to maintain DNS config" is available, in the end resolv.conf is always where the final config lands).
Include a bit of restructuring to handle linux iproute2 testing in the "Linux" branch, and make the control flow more amenable to having a second case / esac block.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/961
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
tests/t_client.sh.in +41 -23
@@ -166,53 +166,71 @@ # this is higly system dependent... get_ifconfig_route() { - # linux / iproute2? (-> if configure got a path) - if [ -n "@IPROUTE@" ] - then - echo "-- linux iproute2 --" - @IPROUTE@ addr show | grep -v valid_lft - @IPROUTE@ route show - @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' - return - fi - - # try uname - case `uname -s` in + UNAME=`uname -s` + case $UNAME in Linux) - echo "-- linux / ifconfig --" - LANG=C @IFCONFIG@ -a |egrep "( addr:|encap:)" - LANG=C @NETSTAT@ -rn -4 -6 - return - ;; + # linux / iproute2? (-> if configure got a path) + if [ -n "@IPROUTE@" ] + then + echo "-- linux iproute2 --" + @IPROUTE@ addr show | grep -v valid_lft + @IPROUTE@ route show + @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' + else + echo "-- linux / ifconfig --" + LANG=C @IFCONFIG@ -a |egrep "( addr:|encap:)" + LANG=C @NETSTAT@ -rn -4 -6 + fi + ;; FreeBSD|NetBSD|Darwin) echo "-- FreeBSD/NetBSD/Darwin [MacOS X] --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }' - return ;; OpenBSD) echo "-- OpenBSD --" @IFCONFIG@ -a | egrep "(flags=|inet)" | \ sed -e 's/pltime [0-9]*//' -e 's/vltime [0-9]*//' @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }' - return ;; SunOS) echo "-- Solaris --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$6 }' - return ;; AIX) echo "-- AIX --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$6 }' - return ;; + *) + echo "get_ifconfig_route(): no idea how to get info on your OS (`uname -s`). FAIL." >&2 + exit 20 + ;; esac - echo "get_ifconfig_route(): no idea how to get info on your OS. FAIL." >&2 - exit 20 + # another round of per-platform information gathering, for DNS info + # for most of the platforms "cat /etc/resolv.conf" is good enough + # except Linux and MacOS + case $UNAME in + Linux) + if [ -x /usr/bin/resolvectl ] ; then + echo "-- linux resolvectl --" + resolvectl status + else + echo "-- linux resolv.conf --" + cat /etc/resolv.conf + fi + ;; + Darwin) + echo "-- MacOS scutil --dns" + scutil --dns + ;; + *) + echo "-- resolv.conf --" + cat /etc/resolv.conf + ;; + esac } # ----------------------------------------------------------
[Openvpn-devel] [PATCH applied] Re: Add information-gathering about DNS resolvers configured to t_client.sh(.in)
Thanks for the review.
Patch has been tested on ubuntu 20.04 with systemd-resolvd and FreeBSD with resolvconf (cat /etc/resolv.conf), and BB has tested all the other platforms (... to the point that nothing breaks, the DNS stuff is still not in yet).
Patch has been applied to the master branch.
commit b4e31e57bc69819e6ea61ea1bc08ad199b2be272
Author: Gert Doering Date: Mon May 5 16:22:16 2025 +0200
Add information-gathering about DNS resolvers configured to t_client.sh(.in)
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31568.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/961?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: Add information-gathering about DNS resolvers configured to t_client.sh(.in)
......................................................................
Add information-gathering about DNS resolvers configured to t_client.sh(.in)
With the patchsets to add DNS configuration on Unix+MacOS systems, and the addition of test stanzas to excercise and verify the OS specific "dns-updown" script, it becomes important to trace test failures ("did it not ping because the DNS was not installed, or did something else fail?") and also verify that DNS config is properly restored at the end of each test.
Linux is probed with "resolvectl status", if available, and "cat resolv.conf" if not. MacOS uses scutil --dns.
All other platforms use "cat resolv.conf" for now (because even if "a tool to maintain DNS config" is available, in the end resolv.conf is always where the final config lands).
Include a bit of restructuring to handle linux iproute2 testing in the "Linux" branch, and make the control flow more amenable to having a second case / esac block.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31568.html
---
M tests/t_client.sh.in
1 file changed, 41 insertions(+), 23 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/961/4
tests/t_client.sh.in +41 -23
@@ -166,53 +166,71 @@ # this is higly system dependent... get_ifconfig_route() { - # linux / iproute2? (-> if configure got a path) - if [ -n "@IPROUTE@" ] - then - echo "-- linux iproute2 --" - @IPROUTE@ addr show | grep -v valid_lft - @IPROUTE@ route show - @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' - return - fi - - # try uname - case `uname -s` in + UNAME=`uname -s` + case $UNAME in Linux) - echo "-- linux / ifconfig --" - LANG=C @IFCONFIG@ -a |egrep "( addr:|encap:)" - LANG=C @NETSTAT@ -rn -4 -6 - return - ;; + # linux / iproute2? (-> if configure got a path) + if [ -n "@IPROUTE@" ] + then + echo "-- linux iproute2 --" + @IPROUTE@ addr show | grep -v valid_lft + @IPROUTE@ route show + @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' + else + echo "-- linux / ifconfig --" + LANG=C @IFCONFIG@ -a |egrep "( addr:|encap:)" + LANG=C @NETSTAT@ -rn -4 -6 + fi + ;; FreeBSD|NetBSD|Darwin) echo "-- FreeBSD/NetBSD/Darwin [MacOS X] --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }' - return ;; OpenBSD) echo "-- OpenBSD --" @IFCONFIG@ -a | egrep "(flags=|inet)" | \ sed -e 's/pltime [0-9]*//' -e 's/vltime [0-9]*//' @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }' - return ;; SunOS) echo "-- Solaris --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$6 }' - return ;; AIX) echo "-- AIX --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$6 }' - return ;; + *) + echo "get_ifconfig_route(): no idea how to get info on your OS (`uname -s`). FAIL." >&2 + exit 20 + ;; esac - echo "get_ifconfig_route(): no idea how to get info on your OS. FAIL." >&2 - exit 20 + # another round of per-platform information gathering, for DNS info + # for most of the platforms "cat /etc/resolv.conf" is good enough + # except Linux and MacOS + case $UNAME in + Linux) + if [ -x /usr/bin/resolvectl ] ; then + echo "-- linux resolvectl --" + resolvectl status + else + echo "-- linux resolv.conf --" + cat /etc/resolv.conf + fi + ;; + Darwin) + echo "-- MacOS scutil --dns" + scutil --dns + ;; + *) + echo "-- resolv.conf --" + cat /etc/resolv.conf + ;; + esac } # ----------------------------------------------------------
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/961?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9cae7314203424e4a604073c5445559260172477
Gerrit-Change-Number: 961
Gerrit-PatchSet: 4
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/961?usp=email )
Change subject: Add information-gathering about DNS resolvers configured to t_client.sh(.in)
......................................................................
Add information-gathering about DNS resolvers configured to t_client.sh(.in)
With the patchsets to add DNS configuration on Unix+MacOS systems, and the addition of test stanzas to excercise and verify the OS specific "dns-updown" script, it becomes important to trace test failures ("did it not ping because the DNS was not installed, or did something else fail?") and also verify that DNS config is properly restored at the end of each test.
Linux is probed with "resolvectl status", if available, and "cat resolv.conf" if not. MacOS uses scutil --dns.
All other platforms use "cat resolv.conf" for now (because even if "a tool to maintain DNS config" is available, in the end resolv.conf is always where the final config lands).
Include a bit of restructuring to handle linux iproute2 testing in the "Linux" branch, and make the control flow more amenable to having a second case / esac block.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31568.html
---
M tests/t_client.sh.in
1 file changed, 41 insertions(+), 23 deletions(-)
tests/t_client.sh.in +41 -23
@@ -166,53 +166,71 @@ # this is higly system dependent... get_ifconfig_route() { - # linux / iproute2? (-> if configure got a path) - if [ -n "@IPROUTE@" ] - then - echo "-- linux iproute2 --" - @IPROUTE@ addr show | grep -v valid_lft - @IPROUTE@ route show - @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' - return - fi - - # try uname - case `uname -s` in + UNAME=`uname -s` + case $UNAME in Linux) - echo "-- linux / ifconfig --" - LANG=C @IFCONFIG@ -a |egrep "( addr:|encap:)" - LANG=C @NETSTAT@ -rn -4 -6 - return - ;; + # linux / iproute2? (-> if configure got a path) + if [ -n "@IPROUTE@" ] + then + echo "-- linux iproute2 --" + @IPROUTE@ addr show | grep -v valid_lft + @IPROUTE@ route show + @IPROUTE@ -o -6 route show | grep -v ' cache' | sed -E -e 's/ expires [0-9]*sec//' -e 's/ (mtu|hoplimit|cwnd|ssthresh) [0-9]+//g' -e 's/ (rtt|rttvar) [0-9]+ms//g' + else + echo "-- linux / ifconfig --" + LANG=C @IFCONFIG@ -a |egrep "( addr:|encap:)" + LANG=C @NETSTAT@ -rn -4 -6 + fi + ;; FreeBSD|NetBSD|Darwin) echo "-- FreeBSD/NetBSD/Darwin [MacOS X] --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }' - return ;; OpenBSD) echo "-- OpenBSD --" @IFCONFIG@ -a | egrep "(flags=|inet)" | \ sed -e 's/pltime [0-9]*//' -e 's/vltime [0-9]*//' @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }' - return ;; SunOS) echo "-- Solaris --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$6 }' - return ;; AIX) echo "-- AIX --" @IFCONFIG@ -a | egrep "(flags=|inet)" @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$6 }' - return ;; + *) + echo "get_ifconfig_route(): no idea how to get info on your OS (`uname -s`). FAIL." >&2 + exit 20 + ;; esac - echo "get_ifconfig_route(): no idea how to get info on your OS. FAIL." >&2 - exit 20 + # another round of per-platform information gathering, for DNS info + # for most of the platforms "cat /etc/resolv.conf" is good enough + # except Linux and MacOS + case $UNAME in + Linux) + if [ -x /usr/bin/resolvectl ] ; then + echo "-- linux resolvectl --" + resolvectl status + else + echo "-- linux resolv.conf --" + cat /etc/resolv.conf + fi + ;; + Darwin) + echo "-- MacOS scutil --dns" + scutil --dns + ;; + *) + echo "-- resolv.conf --" + cat /etc/resolv.conf + ;; + esac } # ----------------------------------------------------------
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/961?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9cae7314203424e4a604073c5445559260172477
Gerrit-Change-Number: 961
Gerrit-PatchSet: 4
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged