summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshin <shin@FreeBSD.org>2000-03-28 17:46:02 +0000
committershin <shin@FreeBSD.org>2000-03-28 17:46:02 +0000
commit1ec21e179d8cdcd295c69b7653deb9896f29b271 (patch)
tree2ceb55a7a939dd3fcc9572bd7800031fd90fa79b
parentef2ad588bc64686d6b4461aa77574845aee684d1 (diff)
downloadFreeBSD-src-1ec21e179d8cdcd295c69b7653deb9896f29b271.zip
FreeBSD-src-1ec21e179d8cdcd295c69b7653deb9896f29b271.tar.gz
Avoid using sed and awk in configure script.
TODO: also replace other sed and awk usages. Submitted by: wollman
-rw-r--r--etc/rc.d/network_ipv610
-rw-r--r--etc/rc.network610
2 files changed, 12 insertions, 8 deletions
diff --git a/etc/rc.d/network_ipv6 b/etc/rc.d/network_ipv6
index d4c5dd2..3f6cd89 100644
--- a/etc/rc.d/network_ipv6
+++ b/etc/rc.d/network_ipv6
@@ -259,10 +259,12 @@ network6_stf_setup() {
gifconfig stf0 ${stf_interface_ipv4addr} 255.255.255.255
# assign IPv6 addr and interface route for 6to4 interface
stf_prefixlen=$((16+${stf_interface_ipv4plen:-0}))
- ipv4_in_hexformat=`echo ${stf_interface_ipv4addr} | \
- sed -e s/"\."/" "/g | \
- awk '{$5 = $1*256 + $2; $6 = $3*256 + $4; \
- printf "%x:%x\n", $5, $6}'`
+ OIFS="$IFS"
+ IFS=".$IFS"
+ set ${stf_interface_ipv4addr}
+ IFS="$OIFS"
+ ipv4_in_hexformat=`printf "%x:%x\n", \
+ $(($1*256 + $2)) $(($3*256 + $4))`
case ${stf_interface_ipv6_ifid} in
[Aa][Uu][Tt][Oo] | '')
laddr=`ifconfig stf0 inet6 | grep 'inet6 fe80:' \
diff --git a/etc/rc.network6 b/etc/rc.network6
index d4c5dd2..3f6cd89 100644
--- a/etc/rc.network6
+++ b/etc/rc.network6
@@ -259,10 +259,12 @@ network6_stf_setup() {
gifconfig stf0 ${stf_interface_ipv4addr} 255.255.255.255
# assign IPv6 addr and interface route for 6to4 interface
stf_prefixlen=$((16+${stf_interface_ipv4plen:-0}))
- ipv4_in_hexformat=`echo ${stf_interface_ipv4addr} | \
- sed -e s/"\."/" "/g | \
- awk '{$5 = $1*256 + $2; $6 = $3*256 + $4; \
- printf "%x:%x\n", $5, $6}'`
+ OIFS="$IFS"
+ IFS=".$IFS"
+ set ${stf_interface_ipv4addr}
+ IFS="$OIFS"
+ ipv4_in_hexformat=`printf "%x:%x\n", \
+ $(($1*256 + $2)) $(($3*256 + $4))`
case ${stf_interface_ipv6_ifid} in
[Aa][Uu][Tt][Oo] | '')
laddr=`ifconfig stf0 inet6 | grep 'inet6 fe80:' \
OpenPOWER on IntegriCloud