@@ -31,3 +31,14 @@ getUpgradePath() {
fi
return 0
}
+
+getJsonGateway() {
+ regex='s/^\s*[^ ]*\s*\([^ ]*\)\s.*/\1/p'
+ batctl gwl | grep "Bit" | sed -n -e "$regex" | while read -r line ; do
+ gwmac="$(batctl tg | grep -v -e " 0[01]:00:5e" -e " 01:80:c2" -e " 33:33" | grep -m 1 "$line" | sed -n -e "$regex")"
+ # remove reserved Multicast MAC adresses (https://en.wikipedia.org/wiki/Multicast_address#Ethernet)
+ eui="$(echo "$gwmac" | awk -F: '{ printf("%02x%s:%sff:fe%s:%s%s\n", xor(("0x"$1),2), $2, $3, $4, $5, $6) }')"
+ gwaddr="fe80::${eui}%br-mesh"
+ wget -T15 -t5 "http://[$gwaddr]:2342/keyxchangev2data" -O "$hoodfile" && break
+ done
+}
\ No newline at end of file
@@ -115,8 +115,8 @@ else
wget -T15 -t5 "http://[fe80::1%w2sta]:2342/sectorfile" -O "$sectortmp" || wget -T15 -t5 "http://[fe80::1%w5sta]:2342/sectorfile" -O "$sectortmp"
fi
else
- echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1"
- wget -T15 -t5 "http://[fe80::1%br-mesh]:2342/keyxchangev2data" -O "$hoodfile"
+ echo "We have a Gateway in Range, we load the keyxchangev2data based on batctl"
+ getJsonGateway
#UPLINK: Do nothing
fi
fi
This patch uses the information accessible through batctl. This has the advantage that no additional data sources are required (hood file, ...) and thus no one has to put additional information anywhere. Semi-tested: Tested via console, but not in connection with configurehood. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Changes in v2: - Filter multicast addresses --- src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange | 11 +++++++++++ src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-)