fff-hoods: Allow correct ula_prefix syntax in hoodfiles

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. Both the old, incorrect and the correct
syntax work with this fix, so in the far away future, the
correct syntax can be used in hoodfiles.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Fabian Bläse 2021-01-27 12:33:08 +01:00 committed by Adrian Schmutzler
parent ae1ed11cd9
commit afe633e874
2 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-hoods
PKG_RELEASE:=18
PKG_RELEASE:=19
include $(INCLUDE_DIR)/package.mk

View File

@ -191,8 +191,15 @@ if [ -s "$hoodfiletmp" ]; then
if [ -n "$prefix" ] ; then
# remove escape character
prefix=$(echo "$prefix" | sed -e 's,\\,,')
# create proper prefix
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. Both the old, incorrect and
# the correct syntax work with this fix.
prefix="$(echo "$prefix" | sed -e 's,\([^:]\):/,\1::/,')"
mac=$(cat "/sys/class/net/br-client/address")
addr=$(owipcalc "$prefix" add "::$(ipMacSuffix "$mac")")
addr_eui=$(owipcalc "$prefix" add "::$(ipEUISuffix "$mac")")