From 871a4f6cad659f02a86a5cc3a6aa9511684f44af Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 19 Jan 2018 12:36:04 +0000 Subject: [PATCH] Detect ipv6 addresses --- src/freedombone-utils-mesh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/freedombone-utils-mesh b/src/freedombone-utils-mesh index 504bd52e..84742a41 100755 --- a/src/freedombone-utils-mesh +++ b/src/freedombone-utils-mesh @@ -107,12 +107,12 @@ function mesh_protocol_init { fi } -function get_ipv4_wlan { - echo $(ip -o -f inet addr show dev "$IFACE" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}') +function get_ipv6_wlan { + echo $(ifconfig ${IFACE} | grep inet6 | awk -F ' ' '{print $2}') } function mesh_hotspot_ip_address { - echo $(ip -o -f inet addr show dev "${BRIDGE}" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}') + echo $(ifconfig ${BRIDGE} | grep inet6 | awk -F ' ' '{print $2}') } function global_rate_limit { @@ -368,7 +368,7 @@ function enable_mesh_scuttlebot { if [ -f /etc/scuttlebot/.ssb/config ]; then ethernet_connected=$(cat /sys/class/net/eth0/carrier) if [[ "$ethernet_connected" != "0" ]]; then - sed -i "s|\"host\": .*|\"host\": \"$(get_ipv4_wlan)\",|g" /etc/scuttlebot/.ssb/config + sed -i "s|\"host\": .*|\"host\": \"$(get_ipv6_wlan)\",|g" /etc/scuttlebot/.ssb/config systemctl restart scuttlebot else if [ ! -f /etc/nginx/sites-available/git_ssb ]; then