From 74bd420937489d8d729c0e2c64f81219600992b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoran=20Peri=C4=8Di=C4=87?= Date: Fri, 8 Apr 2022 19:00:10 +0200 Subject: [PATCH] v0.9.0 --- dnsupdate | 12 +++++++++++- dnsupdate.spec | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dnsupdate b/dnsupdate index 881584a..32b5973 100755 --- a/dnsupdate +++ b/dnsupdate @@ -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 } diff --git a/dnsupdate.spec b/dnsupdate.spec index 65909c9..ad80cab 100644 --- a/dnsupdate.spec +++ b/dnsupdate.spec @@ -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