Detect ipv6 addresses

This commit is contained in:
Bob Mottram 2018-01-19 12:36:04 +00:00
parent e29fe7b88b
commit 871a4f6cad
1 changed files with 4 additions and 4 deletions

View File

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