If the first resolveip call will fail, peeraddr will be now empty, and
the subsequent resolveip call will try to resolve an empty string.
Fix this by storing the result in a temporary variable.
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
SVN-Revision: 45712
include $(TOPDIR)/rules.mk
PKG_NAME:=ds-lite
include $(TOPDIR)/rules.mk
PKG_NAME:=ds-lite
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
local cfg="$1"
local iface="$2"
local link="ds-$cfg"
local cfg="$1"
local iface="$2"
local link="ds-$cfg"
local mtu ttl peeraddr ip6addr tunlink zone weakif
json_get_vars mtu ttl peeraddr ip6addr tunlink zone weakif
local mtu ttl peeraddr ip6addr tunlink zone weakif
json_get_vars mtu ttl peeraddr ip6addr tunlink zone weakif
( proto_add_host_dependency "$cfg" "::" "$tunlink" )
( proto_add_host_dependency "$cfg" "::" "$tunlink" )
- peeraddr=$(resolveip -6 $peeraddr)
- if [ -z "$peeraddr" ]; then
+ remoteip6=$(resolveip -6 $peeraddr)
+ if [ -z "$remoteip6" ]; then
- peeraddr=$(resolveip -6 $peeraddr)
- if [ -z "$peeraddr" ]; then
+ remoteip6=$(resolveip -6 $peeraddr)
+ if [ -z "$remoteip6" ]; then
proto_notify_error "$cfg" "AFTR_DNS_FAIL"
return
fi
fi
proto_notify_error "$cfg" "AFTR_DNS_FAIL"
return
fi
fi
- peeraddr="${peeraddr%% *}"
+ peeraddr="${remoteip6%% *}"
[ -z "$ip6addr" ] && {
local wanif="$tunlink"
[ -z "$ip6addr" ] && {
local wanif="$tunlink"