Browse Source

Detect ipv6 addresses

Bob Mottram 7 years ago
parent
commit
871a4f6cad
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      src/freedombone-utils-mesh

+ 4
- 4
src/freedombone-utils-mesh View File

107
     fi
107
     fi
108
 }
108
 }
109
 
109
 
110
-function get_ipv4_wlan {
111
-    echo $(ip -o -f inet addr show dev "$IFACE" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}')
110
+function get_ipv6_wlan {
111
+    echo $(ifconfig ${IFACE} | grep inet6 | awk -F ' ' '{print $2}')
112
 }
112
 }
113
 
113
 
114
 function mesh_hotspot_ip_address {
114
 function mesh_hotspot_ip_address {
115
-    echo $(ip -o -f inet addr show dev "${BRIDGE}" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}')
115
+    echo $(ifconfig ${BRIDGE} | grep inet6 | awk -F ' ' '{print $2}')
116
 }
116
 }
117
 
117
 
118
 function global_rate_limit {
118
 function global_rate_limit {
368
     if [ -f /etc/scuttlebot/.ssb/config ]; then
368
     if [ -f /etc/scuttlebot/.ssb/config ]; then
369
         ethernet_connected=$(cat /sys/class/net/eth0/carrier)
369
         ethernet_connected=$(cat /sys/class/net/eth0/carrier)
370
         if [[ "$ethernet_connected" != "0" ]]; then
370
         if [[ "$ethernet_connected" != "0" ]]; then
371
-            sed -i "s|\"host\": .*|\"host\": \"$(get_ipv4_wlan)\",|g" /etc/scuttlebot/.ssb/config
371
+            sed -i "s|\"host\": .*|\"host\": \"$(get_ipv6_wlan)\",|g" /etc/scuttlebot/.ssb/config
372
             systemctl restart scuttlebot
372
             systemctl restart scuttlebot
373
         else
373
         else
374
             if [ ! -f /etc/nginx/sites-available/git_ssb ]; then
374
             if [ ! -f /etc/nginx/sites-available/git_ssb ]; then