Inline... On 6/12/11 11:59 AM, openwrt-comm...@openwrt.org wrote: > Author: jow > Date: 2011-06-12 20:59:40 +0200 (Sun, 12 Jun 2011) > New Revision: 27160 > > Modified: > trunk/package/6to4/Makefile > trunk/package/6to4/files/6to4.sh > Log: > [package] 6to4: don't start if detected local IPv4 address is RFC1918, allows > people to deploy firmwares with 6to4 enabled by default > > > Modified: trunk/package/6to4/Makefile > =================================================================== > --- trunk/package/6to4/Makefile 2011-06-12 14:07:08 UTC (rev 27159) > +++ trunk/package/6to4/Makefile 2011-06-12 18:59:40 UTC (rev 27160) > @@ -8,7 +8,7 @@ > include $(TOPDIR)/rules.mk > > PKG_NAME:=6to4 > -PKG_VERSION:=3 > +PKG_VERSION:=4 > PKG_RELEASE:=1 > > include $(INCLUDE_DIR)/package.mk > > Modified: trunk/package/6to4/files/6to4.sh > =================================================================== > --- trunk/package/6to4/files/6to4.sh 2011-06-12 14:07:08 UTC (rev 27159) > +++ trunk/package/6to4/files/6to4.sh 2011-06-12 18:59:40 UTC (rev 27160) > @@ -1,5 +1,5 @@ > # 6to4.sh - IPv6-in-IPv4 tunnel backend > -# Copyright (c) 2010 OpenWrt.org > +# Copyright (c) 2010-2011 OpenWrt.org > > find_6to4_wanif() { > local if=$(ip -4 r l e 0.0.0.0/0); if="${if#default* dev }"; if="${if%% > *}" > @@ -18,6 +18,15 @@ > printf "2002:%02x%02x:%02x%02x\n" $1 $2 $3 $4 > } > > +test_6to4_rfc1918() > +{ > + local oIFS="$IFS"; IFS="."; set -- $1; IFS="$oIFS"
I believe you can just do: local IFS="." ; set -- $1 instead. Yup, confirmed: [philipp@builder ~/openwrt4]$ cat /tmp/aaa #!/bin/sh foo() { local IFS="." ; set -- $1 echo "\$1=$1, \$2=$2, \$3=$3" } IFS=":" echo "IFS=$IFS" foo "1.2.3.4" echo "IFS=$IFS" [philipp@builder ~/openwrt4]$ /tmp/aaa IFS=: $1=1, $2=2, $3=3 IFS=: [philipp@builder ~/openwrt4]$ > + [ $1 -eq 10 ] && return 0 > + [ $1 -eq 192 ] && [ $2 -eq 168 ] && return 0 > + [ $1 -eq 172 ] && [ $2 -ge 16 ] && [ $2 -le 31 ] && return 0 > + return 1 > +} > + > set_6to4_radvd_interface() { > local cfgid="$1" > local lanif="${2:-lan}" > @@ -136,6 +145,11 @@ > } > } > > + test_6to4_rfc1918 "$local4" && { > + logger -t "$link" "Local wan ip $local4 is private - aborting" > + return > + } > + > [ -n "$local4" ] && { > logger -t "$link" "Starting ..." > > _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel