This commit is contained in:
2022-04-08 19:00:10 +02:00
parent e13f31ae8b
commit 74bd420937
2 changed files with 12 additions and 2 deletions

View File

@@ -352,7 +352,7 @@ function parse_ddns_config() {
}
function get_all_ifaces() {
echo `ip addr show | sed -nr 's/([0-9]*: )(.*): .*/\2/p'`
cat /proc/net/dev | sed -nr 's/ *(.*): .*/\1/p'
return 0
}
@@ -412,6 +412,16 @@ function update_iface() {
return 0
fi
public_ip=no
[[ ! $ip_address =~ ^192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\. ]] && public_ip=yes
if [ $public_ip == "no" ]; then
ip_address=`dig @resolver4.opendns.com myip.opendns.com +short -4`
if ! [[ $ip_address =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
return -1;
fi
fi
parse_ddns_config "${ip_address}"
return 0
}

View File

@@ -1,6 +1,6 @@
Summary: Dynamic DNS for ppp and dhclient
Name: dnsupdate
Version: 0.8.0
Version: 0.9.0
Release: 1%{?dist}
License: GPLv2+
Group: System Environment/Daemons