Merge pull request #383 from chris5560/master

ddns-scripts: send_update() detection private IPv4
This commit is contained in:
sbyx 2014-09-30 08:48:46 +02:00
commit f64c545876
2 changed files with 4 additions and 4 deletions

View file

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ddns-scripts PKG_NAME:=ddns-scripts
PKG_VERSION:=2.0.1 PKG_VERSION:=2.0.1
PKG_RELEASE:=4 PKG_RELEASE:=5
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

View file

@ -552,9 +552,9 @@ send_update() {
# $1 # IP to set at DDNS service provider # $1 # IP to set at DDNS service provider
local __IP __URL __ANSWER __ERR local __IP __URL __ANSWER __ERR
# verify given IP # verify given IP / no private IPv4's / no IPv6 addr starting with fxxx of with ":"
[ $use_ipv6 -eq 0 ] && __IP=$(echo $1 | grep -v -E "(^0|^10\.|^127|^172|^192)") # no private IPv4's [ $use_ipv6 -eq 0 ] && __IP=$(echo $1 | grep -v -E "(^0|^10\.|^127|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-1]\.|^192\.168)")
[ $use_ipv6 -eq 1 ] && __IP=$(echo $1 | grep "^[0-9a-eA-E]") # no IPv6 addr starting with fxxx of with ":" [ $use_ipv6 -eq 1 ] && __IP=$(echo $1 | grep "^[0-9a-eA-E]")
[ -z "$__IP" ] && critical_error "Invalid or no IP '$1' given" [ -z "$__IP" ] && critical_error "Invalid or no IP '$1' given"
# do replaces in URL # do replaces in URL