Procházet zdrojové kódy

Detect ipv6 addresses

Bob Mottram před 7 roky
rodič
revize
871a4f6cad
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4
    4
      src/freedombone-utils-mesh

+ 4
- 4
src/freedombone-utils-mesh Zobrazit soubor

@@ -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