瀏覽代碼

Detect ipv6 addresses

Bob Mottram 7 年之前
父節點
當前提交
871a4f6cad
共有 1 個檔案被更改,包括 4 行新增4 行删除
  1. 4
    4
      src/freedombone-utils-mesh

+ 4
- 4
src/freedombone-utils-mesh 查看文件

@@ -107,12 +107,12 @@ function mesh_protocol_init {
107 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 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 118
 function global_rate_limit {
@@ -368,7 +368,7 @@ function enable_mesh_scuttlebot {
368 368
     if [ -f /etc/scuttlebot/.ssb/config ]; then
369 369
         ethernet_connected=$(cat /sys/class/net/eth0/carrier)
370 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 372
             systemctl restart scuttlebot
373 373
         else
374 374
             if [ ! -f /etc/nginx/sites-available/git_ssb ]; then