6in4: replace sed match with variable substitution, change pattern from a-z to a-f (hex only)

SVN-Revision: 22893
This commit is contained in:
Jo-Philipp Wich 2010-09-04 16:09:49 +00:00
parent 6edf2c577b
commit 52dcaeb65d
2 changed files with 2 additions and 2 deletions

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=6in4
PKG_VERSION:=5
PKG_RELEASE:=1
PKG_RELEASE:=2
include $(INCLUDE_DIR)/package.mk

View file

@ -32,7 +32,7 @@ if [ "$ACTION" = ifup ]; then
config_get password "$cfg" password
[ -n "$tunnelid" ] && [ -n "$username" ] && [ -n "$password" ] && {
[ "${#password}" != 32 ] || [ -n "$(echo "$password" | sed 's/[a-z0-9]//g')" ] && {
[ "${#password}" == 32 -a -z "${password//[a-f0-9]/}" ] && {
password="$(echo -n "$password" | md5sum)"; password="${password%% *}"
}
uci_set_state network "$cfg" ipaddr "$wanip"