From patchwork Tue Oct 3 21:30:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC,v3] Configure the Node a routable ula v6 From: Adrian Schmutzler X-Patchwork-Id: 521 Message-Id: <1507066236-23180-1-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Tue, 3 Oct 2017 23:30:36 +0200 This is only an RFC and untested, I need a litte bit feedback about this. Signed-off-by: Christian Dresel Signed-off-by: Adrian Schmutzler 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 --- .../fff/fff-hoods/files/usr/sbin/configurehood | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index 29d32a3..3a1bd88 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -186,6 +186,29 @@ 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 + suffix="$(awk -F: '{ print $1$2":"$3$4":"$5$6 }' /sys/class/net/br-mesh/address)" + addr="$(echo "$prefix" | sed -e 's/\//'$suffix'\//')" + for ip in $(ip -6 addr show dev br-mesh | grep inet6 | grep -v "fe80::" | grep -v "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 adress 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 + json_select ".." # back to root + echo "Loading wifi" wifi