diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
index 88c0daa..e60812d 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 . /usr/share/libubox/jshn.sh
+. /lib/functions/fff/network
 . /lib/functions/fff/wireless
 . /lib/functions/fff/timeserver
 
@@ -205,12 +206,10 @@ if [ -s /tmp/keyxchangev2data ]; then
 	# Set $prefix::MAC as IP
 	if [ -n "$prefix" ] ; then
 		prefix="$(echo "$prefix" | sed -e 's,\\,,')"
-		suffix="$(awk -F: '{ print "0:"$1$2":"$3$4":"$5$6 }' /sys/class/net/br-mesh/address)"
-		suffix_eui="$(awk -F: '{ printf("%02x%s:%sff:fe%s:%s%s\n", xor(("0x"$1),2), $2, $3, $4, $5, $6) }' /sys/class/net/br-mesh/address)"
-		addr="$(echo "$prefix" | sed -e 's,/,'$suffix'/,')"
-		echo $addr | grep -q "::" || addr="$(echo "$addr" | sed -e 's,:[0:]*:,::,')"
-		addr_eui="$(echo "$prefix" | sed -e 's,/,'$suffix_eui'/,')"
-		echo $addr_eui | grep -q "::" || addr_eui="$(echo "$addr_eui" | sed -e 's,:[0:]*:,::,')"
+		addr="$(ipMacAssemble "$prefix" "br-mesh")"
+		addr="$(ipTidyColon "$addr")"
+		addr_eui="$(ipEUIAssemble "$prefix" "br-mesh")"
+		addr_eui="$(ipTidyColon "$addr_eui")"
 		for ip in $(ip -6 addr show dev br-mesh | grep inet6 | grep -v -e " $addr" -e " $addr_eui" -e " fe80::" -e " fdff::" | cut -f6 -d " "); do
 			ip -6 addr del "$ip" dev br-mesh
 		done
diff --git a/src/packages/fff/fff-network/files/lib/functions/fff/network b/src/packages/fff/fff-network/files/lib/functions/fff/network
new file mode 100644
index 0000000..f16d671
--- /dev/null
+++ b/src/packages/fff/fff-network/files/lib/functions/fff/network
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Copyright 2017 Adrian Schmutzler
+# License GPLv3
+
+ipMacSuffix() {
+	[ $# -ne "1" ] && return 1
+
+	local iface=$1
+
+	awk -F: '{ print "0:"$1$2":"$3$4":"$5$6 }' "/sys/class/net/${iface}/address"
+	return 0
+}
+
+ipEUISuffix() {
+	[ $# -ne "1" ] && return 1
+
+	local iface=$1
+
+	awk -F: '{ printf("%02x%s:%sff:fe%s:%s%s\n", xor(("0x"$1),2), $2, $3, $4, $5, $6) }' "/sys/class/net/${iface}/address"
+	return 0
+}
+
+ipAssemble() {
+	[ $# -ne "2" ] && return 1
+
+	local prefix=$1
+	local suffix=$2
+
+	echo "$prefix" | sed -e 's,/,'$suffix'/,'
+	return 0
+}
+
+ipMacAssemble() {
+	[ $# -ne "2" ] && return 1
+
+	local prefix=$1
+	local iface=$2
+
+	suffix="$(ipMacSuffix "$iface")"
+	ipAssemble "$prefix" "$suffix"
+	return 0
+}
+
+ipEUIAssemble() {
+	[ $# -ne "2" ] && return 1
+
+	local prefix=$1
+	local iface=$2
+
+	suffix="$(ipEUISuffix "$iface")"
+	ipAssemble "$prefix" "$suffix"
+	return 0
+}
+
+ipTidyColon() {
+	[ $# -ne "1" ] && return 1
+
+	local addr=$1
+
+	echo "$addr" | grep -q "::" || addr="$(echo "$addr" | sed -e 's,:[0:]*:,::,')"
+	echo "$addr"
+	return 0
+}
diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
index c6b3113..d4866e4 100755
--- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
+++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
@@ -9,6 +9,8 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+. /lib/functions/fff/network
+
 BOARD="$(uci get board.model.name)"
 . /etc/network.$BOARD
 
@@ -218,8 +220,7 @@ else
 
     prefix="fdff:0::/64"
     # Set $prefix::MAC as IP
-    suffix=$(awk -F: '{ print $1$2":"$3$4":"$5$6 }' /sys/class/net/br-mesh/address)
-    addr=$(echo $prefix | sed -e 's/\//'$suffix'\//')
+    addr="$(ipMacAssemble "$prefix" "br-mesh")"
     ip -6 addr add $addr dev br-mesh
 
     uci -q del network.globals
@@ -229,14 +230,12 @@ else
     uci -q set network.mesh.proto=static
 
     # Set $prefix::1 as IP
-    suffix="1"
-    addr=$(echo $prefix | sed -e 's/\//'$suffix'\//')
+    addr="$(ipAssemble "$prefix" "1")"
     ip -6 addr add $addr dev br-mesh
     uci -q add_list network.mesh.ip6addr=$addr
 
     # Set $prefix::link-local as IP
-    suffix=$(awk -F: '{ printf("%02x%s:%sff:fe%s:%s%s\n", xor(("0x"$1),2), $2, $3, $4, $5, $6) }' /sys/class/net/br-mesh/address)
-    addr=$(echo $prefix | sed -e 's/\//'$suffix'\//')
+    addr="$(ipEUIAssemble "$prefix" "br-mesh")"
     ip -6 addr add $addr dev br-mesh
     uci -q add_list network.mesh.ip6addr=$addr
 
