diff --git a/src/packages/fff/fff-hoods/Makefile b/src/packages/fff/fff-hoods/Makefile index c17d807d..58ca1901 100644 --- a/src/packages/fff/fff-hoods/Makefile +++ b/src/packages/fff/fff-hoods/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fff-hoods -PKG_RELEASE:=17 +PKG_RELEASE:=18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index 1e6745f0..2dab76f5 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -190,6 +190,14 @@ if [ -s "$hoodfiletmp" ]; then # Set $prefix::MAC as IP if [ -n "$prefix" ] ; then prefix="$(echo "$prefix" | sed -e 's,\\,,')" + + # in earlier firmware versions the prefix had to be written + # in an incorrect syntax (missing a trailing colon). + # To make hoodfiles with this old incorrect syntax work with + # newer firmware versions like this one, we have to fix the + # incorrect syntax here. + prefix="$(echo "$prefix" | sed -e 's,\([^:]\):\/,\1::/,')" + mac="$(cat "/sys/class/net/br-client/address")" addr="$(ipMacAssemble "$prefix" "$mac")" addr="$(ipTidyColon "$addr")" diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile index 8d67824d..0122a9ab 100644 --- a/src/packages/fff/fff-network/Makefile +++ b/src/packages/fff/fff-network/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fff-network -PKG_RELEASE:=26 +PKG_RELEASE:=27 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/src/packages/fff/fff-network/files/lib/functions/fff/network b/src/packages/fff/fff-network/files/lib/functions/fff/network index 06a6a84d..ebefc107 100644 --- a/src/packages/fff/fff-network/files/lib/functions/fff/network +++ b/src/packages/fff/fff-network/files/lib/functions/fff/network @@ -2,7 +2,7 @@ # License GPLv3 ipMacSuffix() { - # Returns the lower 64 bits of an IPv6 address (0:aabb:ccdd:eeff) + # Returns the lower 64 bits of an IPv6 address (::aabb:ccdd:eeff) # based on the provided MAC address (aa:bb:cc:bb:ee:ff) # # Argument: MAC address (with colons) @@ -11,12 +11,12 @@ ipMacSuffix() { local mac=$1 - echo "$mac" | awk -F: '{ print "0:"$1$2":"$3$4":"$5$6 }' + echo "$mac" | awk -F: '{ print "::"$1$2":"$3$4":"$5$6 }' return 0 } ipEUISuffix() { - # Returns the EUI (interface ID, a8bb:ccff:fedd:eeff) + # Returns the EUI (interface ID, ::a8bb:ccff:fedd:eeff) # based on the provided MAC address (aa:bb:cc:bb:ee:ff) # # Argument: MAC address (with colons) @@ -25,21 +25,40 @@ ipEUISuffix() { local mac=$1 - echo "$mac" | awk -F: '{ printf("%02x%s:%sff:fe%s:%s%s\n", xor(("0x"$1),2), $2, $3, $4, $5, $6) }' + echo "$mac" | awk -F: '{ printf("::%02x%s:%sff:fe%s:%s%s\n", xor(("0x"$1),2), $2, $3, $4, $5, $6) }' 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::) + # (The prefix must only contain the upper 64 bits (0:0:0:0:: or 0::) + # (The suffix must only contain the lower 64 bits (::0:0:0:0 or ::0) [ $# -ne "2" ] && return 1 local prefix=$1 - local suffix=$2 + local suffix + local result + + # remove leading colons + suffix=$(echo "$2" | sed -e 's,^:*,,') + + # check if prefix contains the mandatory trailing double-colon + if ! echo "$prefix" | grep "::/" >/dev/null; then + return 1 + fi + + # concatenate prefix and suffix + result=$(echo "$prefix" | sed -e "s,/,$suffix/,") + + # remove double-colon if both prefix and suffix are fully expanded + if [ "$(echo "$result" | awk -F":" '{print NF-1}')" -gt 7 ]; then + result=$(echo "$result" | sed -e 's,::,:,') + fi + + echo "$result" - echo "$prefix" | sed -e 's,/,'$suffix'/,' 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 d683e7da..7ab74e24 100755 --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork @@ -207,7 +207,7 @@ else uci -q set network.client.proto=static # Set $prefix::1 as IP - addr="$(ipAssemble "$prefix" "1")" + addr="$(ipAssemble "$prefix" "::1")" ip -6 addr add $addr dev br-client uci -q add_list network.client.ip6addr=$addr