From 588c58799f5696f0dc9269de2796f9f7f55df6cb Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Thu, 5 Oct 2017 17:43:10 +0100 Subject: [PATCH] Allow local ip addresses for scuttlebot --- src/freedombone-image-mesh | 1 + src/freedombone-mesh-batman | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/freedombone-image-mesh b/src/freedombone-image-mesh index ca975fe6b..52198a606 100755 --- a/src/freedombone-image-mesh +++ b/src/freedombone-image-mesh @@ -795,6 +795,7 @@ function initialise_scuttlebot_pub { echo '{' > /etc/scuttlebot/.ssb/config echo " \"host\": \"${HOSTNAME}\"," >> /etc/scuttlebot/.ssb/config echo " \"port\": ${SCUTTLEBOT_PORT}," >> /etc/scuttlebot/.ssb/config + echo ' "allowPrivate": true,' >> /etc/scuttlebot/.ssb/config echo ' "timeout": 30000,' >> /etc/scuttlebot/.ssb/config echo ' "pub": true,' >> /etc/scuttlebot/.ssb/config echo ' "local": true,' >> /etc/scuttlebot/.ssb/config diff --git a/src/freedombone-mesh-batman b/src/freedombone-mesh-batman index 592cc87dc..a64422eb7 100755 --- a/src/freedombone-mesh-batman +++ b/src/freedombone-mesh-batman @@ -96,6 +96,10 @@ if [ -e /etc/default/batctl ]; then . /etc/default/batctl fi +function get_ipv6_bat0 { + echo $(ip -o -f inet6 addr show dev "bat0" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}') +} + function mesh_hotspot_ip_address { echo $(ip -o -f inet addr show dev "$BRIDGE" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}') } @@ -402,6 +406,12 @@ function start { systemctl restart avahi-daemon + if [ -f /etc/scuttlebot/.ssb/config ]; then + ipv6addr=$(get_ipv6_bat0) + sed -i "s|\"host\": .*|\"host\": \"${ipv6addr}\",|g" /etc/scuttlebot/.ssb/config + systemctl restart scuttlebot + fi + verify } -- GitLab