Fix getting pulic interface in IPv6 only (#578)

In a IPv6 only environment, the variable $NIC would be empty and iptables in add-openvpn-rules.sh will fail by missing argument.
This commit is contained in:
Henry N 2020-03-26 21:22:22 +01:00 committed by GitHub
parent 6bb87ae716
commit aab5e7b2ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -606,6 +606,9 @@ function installOpenVPN () {
# Get the "public" interface from the default route # Get the "public" interface from the default route
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1) NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
if [[ -z "$NIC" ]] && [[ "$IPV6_SUPPORT" = 'y' ]]; then
NIC=$(ip -6 route show default | sed -ne 's/^default .* dev \([^ ]*\) .*$/\1/p')
fi
if [[ "$OS" =~ (debian|ubuntu) ]]; then if [[ "$OS" =~ (debian|ubuntu) ]]; then
apt-get update apt-get update