diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
index 3d0afc3..f785b7d 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -2,6 +2,7 @@
 
 . /usr/share/libubox/jshn.sh
 . /lib/functions/fff/keyxchange
+. /lib/functions/fff/network
 . /lib/functions/fff/wireless
 . /lib/functions/fff/timeserver
 
@@ -242,12 +243,10 @@ if [ -s "$hoodfile" ]; 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..8dd9f77
--- /dev/null
+++ b/src/packages/fff/fff-network/files/lib/functions/fff/network
@@ -0,0 +1,87 @@
+#!/bin/sh
+# Copyright 2017 Adrian Schmutzler
+# License GPLv3
+
+ipMacSuffix() {
+ # Returns the lower 64 bits of an IPv6 address
(0:aabb:ccdd:eeff)
+ # based on the mac address (aa:bb:cc:bb:ee:ff) of a
specified interface
+ #
+ # Argument: name of interface (e.g. br-mesh)
+
+ [ $# -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() {
+ # Returns the EUI (interface ID, a8bb:ccff:fedd:eeff)
+ # based on the mac address (aa:bb:cc:bb:ee:ff) of a
specified interface
+ #
+ # Argument: name of interface (e.g. br-mesh)
+
+ [ $# -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() {
+ # Concatenates a prefix (1st argument) and a suffix (2nd
argument) to a merged IPv6 address
+ # (The prefix has to bear the subnet: fdff::/64)
+ # (The prefix must only contain the higher 64 bits (correct:
0:0:0:0: or 0:: - wrong: 0:0:0:0::)

mir gefällt die Vorgabe 0:0:0:0: nicht so gut. Man muss nen vollständigen Prefix dann z.B. so mitgeben fd43:5602:29bd:9:/64  , was keine gültige v6 Notierung ist.

Könnte man vorher noch wegbügeln. z.B. so
sed -e 's,\(\([[:digit:]]*:\)\{4\}\):,\1,' | sed -e 's,/,'$suffix'/,'

Robert



 
+
+ [ $# -ne "2" ] && return 1
+
+ local prefix=$1
+ local suffix=$2
+
+ echo "$prefix" | sed -e 's,/,'$suffix'/,'
+ return 0
+}
+
+ipMacAssemble() {
+ # Concatenates a prefix (1st argument) and a MAC-based
suffix (interface as 2nd argument) to a merged IPv6 address
+ # (Details on prefix: Check ipAssemble(), details on suffix:
Check ipMacSuffix())
+
+ [ $# -ne "2" ] && return 1
+
+ local prefix=$1
+ local iface=$2
+
+ suffix="$(ipMacSuffix "$iface")"
+ ipAssemble "$prefix" "$suffix"
+ return 0
+}
+
+ipEUIAssemble() {
+ # Concatenates a prefix (1st argument) and an EUI-based
suffix (interface as 2nd argument) to a merged IPv6 address
+ # (Details on prefix: Check ipAssemble(), details on suffix:
Check ipEUISuffix())
+
+ [ $# -ne "2" ] && return 1
+
+ local prefix=$1
+ local iface=$2
+
+ suffix="$(ipEUISuffix "$iface")"
+ ipAssemble "$prefix" "$suffix"
+ return 0
+}
+
+ipTidyColon() {
+ # Collapses zeros to :: to yield short but valid IPv6
addresses
+ #
+ # Argument: IPv6 address to be shortened
+
+ [ $# -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
 
