[PATCH v6] Configure the Node a routable IPv6 ULA
Adrian Schmutzler
freifunk at adrianschmutzler.de
Fr Okt 6 23:22:00 CEST 2017
Signed-off-by: Christian Dresel <fff at chrisi01.de>
Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
Changes in v2:
- Rebased onto keyXchange v2 patchset v15
- correctly handle keyxchangev2data without reloading
- added some quotes
Changes in v3:
- Added route block
- Inverted condition in address block
- Changed if style to "grep -q"
- Added some quotes
Changes in v4:
- Optimized grep and sed
Changes in v5:
- Only apply if ula_prefix is not empty
- Remove escape sign from ula_prefix
Changes in v6:
- Typo in echo
- Optimized sed
---
.../fff/fff-hoods/files/usr/sbin/configurehood | 25 ++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
index c18474f..ca8139e 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -161,6 +161,31 @@ if [ -s /tmp/keyxchangev2data ]; then
fi
done
+ # now we load the prefix from the hoodfile and set this to br-mesh
+ json_select network
+ json_get_var prefix ula_prefix
+ # Set $prefix::MAC as IP
+ if [ -n "$prefix" ] ; then
+ suffix="$(awk -F: '{ print $1$2":"$3$4":"$5$6 }' /sys/class/net/br-mesh/address)"
+ addr="$(echo "$prefix" | sed -e 's,\\,,' -e 's,/,'$suffix'/,')"
+ for ip in $(ip -6 addr show dev br-mesh | grep inet6 | grep -v -e "fe80::" -e "fdff::" | cut -f6 -d " "); do
+ ip -6 addr del "$ip" dev br-mesh
+ done
+ if ! ( ifconfig br-mesh | grep -q "$addr" ) ; then
+ ip -6 addr add "$addr" dev br-mesh
+ echo "Set ULA address to br-mesh: $addr"
+ else
+ echo "Address already set."
+ fi
+ if ! ( ip -6 route show dev br-mesh | grep -q "fc00::" ) ; then
+ ip -6 route add fc00::/7 via fe80::1 dev br-mesh
+ echo "Set ULA route to br-mesh."
+ else
+ echo "Route already set."
+ fi
+ fi
+ json_select ".." # back to root
+
echo "Loading wifi"
wifi
--
2.7.4
Mehr Informationen über die Mailingliste franken-dev