diff --git a/conf/ynh-hotspot b/conf/ynh-hotspot index 6087e43..8139c0a 100644 --- a/conf/ynh-hotspot +++ b/conf/ynh-hotspot @@ -25,59 +25,59 @@ has_vpnclient_app() { } has_ip6delegatedprefix() { - i=${1} + local i=${1} - [[ -n "${ynh_ip6_net[${i}]}" ]] && [[ "${ynh_ip6_net[${i}]}" != "none" ]] + [[ -n "${ip6_net[${i}]}" ]] && [[ "${ip6_net[${i}]}" != "none" ]] } ip6addrfromdelegatedprefix() { - i=${1} + local i=${1} - echo "${ynh_ip6_net[${i}]}${i}001" + echo "${ip6_net[${i}]}${i}001" } is_nat_set() { - internet_device=${1} + local gateway_interface=${1} - iptables -w -nvt nat -L POSTROUTING | grep MASQUERADE | grep -q "${internet_device}" + iptables -w -nvt nat -L POSTROUTING | grep MASQUERADE | grep -q "${gateway_interface}" } is_ip4nataddr_set() { - i=${1} + local i=${1} dev=$(devfromid "${i}") - ip address show dev "${dev}" 2> /dev/null | grep -q "${ynh_ip4_nat_prefix[${i}]}.1/24" + ip address show dev "${dev}" 2> /dev/null | grep -q "${ip4_nat_prefix[${i}]}.1/24" } is_ip6addr_set() { - i=${1} + local i=${1} dev=$(devfromid "${i}") ip address show dev "${dev}" 2> /dev/null | grep -q "$(ip6addrfromdelegatedprefix $i)/64" } is_ip6firewall_set() { - i=${1} + local i=${1} dev=$(devfromid "${i}") ip6tables -w -nvL FORWARD | grep DROP | grep -q "${dev}" } is_forwarding_set() { - ip6=$(sysctl net.ipv6.conf.all.forwarding | awk '{ print $NF; }') - ip4=$(sysctl net.ipv4.conf.all.forwarding | awk '{ print $NF; }') + local ip6=$(sysctl net.ipv6.conf.all.forwarding | awk '{ print $NF; }') + local ip4=$(sysctl net.ipv4.conf.all.forwarding | awk '{ print $NF; }') [ "${ip6}" -eq 1 -a "${ip4}" -eq 1 ] } is_dhcpd6_running() { - i=${1} + local i=${1} $(ps aux | grep "dhcpdv6-ssid${i}" | grep -qv grep) } is_dhcpd4_running() { - i=${1} + local i=${1} $(ps aux | grep "dhcpdv4-ssid${i}" | grep -qv grep) } @@ -87,9 +87,9 @@ is_hostapd_running() { } is_running() { - for i in $(seq 0 $((${ynh_multissid} - 1))); do + for i in $(seq 0 $((${multissid} - 1))); do ( has_ip6delegatedprefix ${i} && is_ip6addr_set ${i}\ - && ( [ "${ynh_ip6_firewall[${i}]}" -eq 1 ] && is_ip6firewall_set ${i} || [ "${ynh_ip6_firewall[${i}]}" -eq 0 ] )\ + && ( [ "${ip6_firewall[${i}]}" -eq 1 ] && is_ip6firewall_set ${i} || [ "${ip6_firewall[${i}]}" -eq 0 ] )\ && is_dhcpd6_running ${i} || ! has_ip6delegatedprefix ${i} )\ && is_ip4nataddr_set ${i} && is_dhcpd4_running ${i} @@ -98,35 +98,35 @@ is_running() { fi done - is_hostapd_running && is_forwarding_set && ( [ -z "${new_internet_device}" ] || is_nat_set "${new_internet_device}" ) + is_hostapd_running && is_forwarding_set && ( [ -z "${new_gateway_interface}" ] || is_nat_set "${new_gateway_interface}" ) } ## Setters set_nat() { - internet_device=${1} + local gateway_interface=${1} - iptables -w -t nat -A POSTROUTING -o "${internet_device}" -j MASQUERADE + iptables -w -t nat -A POSTROUTING -o "${gateway_interface}" -j MASQUERADE } set_ip4nataddr() { - i=${1} - dev=$(devfromid "${i}") + local i=${1} + local dev=$(devfromid "${i}") - ip address add "${ynh_ip4_nat_prefix[${i}]}.1/24" dev "${dev}" + ip address add "${ip4_nat_prefix[${i}]}.1/24" dev "${dev}" } set_ip6addr() { - i=${1} - dev=$(devfromid "${i}") + local i=${1} + local dev=$(devfromid "${i}") ip address delete "$(ip6addrfromdelegatedprefix $i)/64" dev tun0 &> /dev/null ip address add "$(ip6addrfromdelegatedprefix $i)/64" dev "${dev}" } set_ip6firewall() { - i=${1} - dev=$(devfromid "${i}") + local i=${1} + local dev=$(devfromid "${i}") ip6tables -w -A FORWARD -i "${dev}" -j ACCEPT ip6tables -w -A FORWARD -o "${dev}" -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT @@ -139,51 +139,51 @@ set_forwarding() { } start_dhcpd6() { - i=${1} - dev=$(devfromid "${i}") + local i=${1} + local dev=$(devfromid "${i}") cp /etc/dnsmasq.dhcpd/dhcpdv6{.conf.tpl,-ssid${i}.conf} sed "s|__WIFI_DEVICE__|${dev}|g" -i /etc/dnsmasq.dhcpd/dhcpdv6-ssid${i}.conf - sed "s|__IP6_NET__|${ynh_ip6_net[${i}]}|g" -i /etc/dnsmasq.dhcpd/dhcpdv6-ssid${i}.conf - sed "s|__IP6_DNS__|${ynh_ip6_dns[${i}]}|g" -i /etc/dnsmasq.dhcpd/dhcpdv6-ssid${i}.conf + sed "s|__IP6_NET__|${ip6_net[${i}]}|g" -i /etc/dnsmasq.dhcpd/dhcpdv6-ssid${i}.conf + sed "s|__IP6_DNS__|${ip6_dns[${i}]}|g" -i /etc/dnsmasq.dhcpd/dhcpdv6-ssid${i}.conf dnsmasq -C /etc/dnsmasq.dhcpd/dhcpdv6-ssid${i}.conf -p0 } start_dhcpd4() { - i=${1} - dev=$(devfromid "${i}") + local i=${1} + local dev=$(devfromid "${i}") cp /etc/dnsmasq.dhcpd/dhcpdv4{.conf.tpl,-ssid${i}.conf} - sed "s|__IP4_DNS__|${ynh_ip4_dns[${i}]}|g" -i /etc/dnsmasq.dhcpd/dhcpdv4-ssid${i}.conf + sed "s|__IP4_DNS__|${ip4_dns[${i}]}|g" -i /etc/dnsmasq.dhcpd/dhcpdv4-ssid${i}.conf sed "s|__WIFI_DEVICE__|${dev}|g" -i /etc/dnsmasq.dhcpd/dhcpdv4-ssid${i}.conf - sed "s|__IP4_NAT_PREFIX__|${ynh_ip4_nat_prefix[${i}]}|g" -i /etc/dnsmasq.dhcpd/dhcpdv4-ssid${i}.conf + sed "s|__IP4_NAT_PREFIX__|${ip4_nat_prefix[${i}]}|g" -i /etc/dnsmasq.dhcpd/dhcpdv4-ssid${i}.conf dnsmasq -C /etc/dnsmasq.dhcpd/dhcpdv4-ssid${i}.conf -p0 } configure_hostapd() { - ethaddr=$(ip link show dev "${ynh_wifi_device}" | grep link/ether | awk -F: '{ printf "02:%s:%s:%s:%s:00", $2, $3, $4, $5 }') - ip link set addr "${ethaddr}" dev "${ynh_wifi_device}" + local ethaddr=$(ip link show dev "${wifi_device}" | grep link/ether | awk -F: '{ printf "02:%s:%s:%s:%s:00", $2, $3, $4, $5 }') + ip link set addr "${ethaddr}" dev "${wifi_device}" cp /etc/hostapd/hostapd.base.conf /etc/hostapd/hostapd.conf - sed "s|__WIFI_DEVICE__|${ynh_wifi_device}|g" -i /etc/hostapd/hostapd.conf - sed "s|__WIFI_CHANNEL__|${ynh_wifi_channel}|g" -i /etc/hostapd/hostapd.conf + sed "s|__WIFI_DEVICE__|${wifi_device}|g" -i /etc/hostapd/hostapd.conf + sed "s|__WIFI_CHANNEL__|${wifi_channel}|g" -i /etc/hostapd/hostapd.conf sed "s|__N_COMMENT__||g" -i /etc/hostapd/hostapd.conf - for i in $(seq 0 $((${ynh_multissid} - 1))); do + for i in $(seq 0 $((${multissid} - 1))); do - [ "${ynh_wifi_secure[${i}]}" -eq 1 ] && local sec_comment="" || local sec_comment="#" + [ "${wifi_secure[${i}]}" -eq 1 ] && local sec_comment="" || local sec_comment="#" [ "${i}" -eq 0 ] && local bss_comment="#" || local bss_comment="" cp /etc/hostapd/hostapd.accesspoint.conf /etc/hostapd/hostapd.conf.tmp sed "s|__WIFI_INTERFACE__|hotspot${i}|g" -i /etc/hostapd/hostapd.conf.tmp - sed "s|__WIFI_SSID__|${ynh_wifi_ssid[${i}]}|g" -i /etc/hostapd/hostapd.conf.tmp - sed "s|__WIFI_PASSPHRASE__|${ynh_wifi_passphrase[${i}]}|g" -i /etc/hostapd/hostapd.conf.tmp + sed "s|__WIFI_SSID__|${wifi_ssid[${i}]}|g" -i /etc/hostapd/hostapd.conf.tmp + sed "s|__WIFI_PASSPHRASE__|${wifi_passphrase[${i}]}|g" -i /etc/hostapd/hostapd.conf.tmp sed "s|__SEC_COMMENT__|${sec_comment}|g" -i /etc/hostapd/hostapd.conf.tmp sed "s|__BSS_COMMENT__|${bss_comment}|g" -i /etc/hostapd/hostapd.conf.tmp @@ -195,28 +195,28 @@ configure_hostapd() { ## Unsetters unset_nat() { - internet_device=${1} + local gateway_interface=${1} - iptables -w -t nat -D POSTROUTING -o "${internet_device}" -j MASQUERADE + iptables -w -t nat -D POSTROUTING -o "${gateway_interface}" -j MASQUERADE } unset_ip4nataddr() { - i=${1} - dev=$(devfromid "${i}") + local i=${1} + local dev=$(devfromid "${i}") - ip address delete "${ynh_ip4_nat_prefix[${i}]}.1/24" dev "${dev}" + ip address delete "${ip4_nat_prefix[${i}]}.1/24" dev "${dev}" } unset_ip6addr() { - i=${1} - dev=$(devfromid "${i}") + local i=${1} + local dev=$(devfromid "${i}") ip address delete "$(ip6addrfromdelegatedprefix $i)/64" dev "${dev}" } unset_ip6firewall() { - i=${1} - dev=$(devfromid "${i}") + local i=${1} + local dev=$(devfromid "${i}") ip6tables -w -D FORWARD -i "${dev}" -j ACCEPT ip6tables -w -D FORWARD -o "${dev}" -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT @@ -283,10 +283,10 @@ EOF } devfromid() { - i=${1} + local i=${1} if [ "${i}" -eq 0 ]; then - echo "${ynh_wifi_device}" + echo "${wifi_device}" else echo "hotspot${i}" fi @@ -298,41 +298,41 @@ if [ "$1" != restart ]; then echo -n "Retrieving Yunohost settings... " - ynh_service_enabled=$(systemctl is-enabled ynh-hotspot) - ynh_wifi_device=$(ynh_setting_get hotspot wifi_device) - ynh_wifi_channel=$(ynh_setting_get hotspot wifi_channel) - ynh_multissid=$(ynh_setting_get hotspot multissid) + service_enabled=$(systemctl is-enabled ynh-hotspot) + wifi_device=$(ynh_setting_get hotspot wifi_device) + wifi_channel=$(ynh_setting_get hotspot wifi_channel) + multissid=$(ynh_setting_get hotspot multissid) - IFS='|' read -a ynh_wifi_ssid <<< "$(ynh_setting_get hotspot wifi_ssid)" - IFS='|' read -a ynh_wifi_secure <<< "$(ynh_setting_get hotspot wifi_secure)" - IFS='|' read -a ynh_wifi_passphrase <<< "$(ynh_setting_get hotspot wifi_passphrase)" - IFS='|' read -a ynh_ip6_firewall <<< "$(ynh_setting_get hotspot ip6_firewall)" - IFS='|' read -a ynh_ip6_net <<< "$(ynh_setting_get hotspot ip6_net)" - IFS='|' read -a ynh_dns <<< "$(ynh_setting_get hotspot dns)" - IFS='|' read -a ynh_ip4_nat_prefix <<< "$(ynh_setting_get hotspot ip4_nat_prefix)" - for i in $(seq 0 $((${ynh_multissid} - 1))); do - ynh_ip6_dns[${i}]="" - ynh_ip4_dns[${i}]="" - for ip in $(echo "${ynh_dns[${i}]}" | tr ',' ' '); do + IFS='|' read -a wifi_ssid <<< "$(ynh_setting_get hotspot wifi_ssid)" + IFS='|' read -a wifi_secure <<< "$(ynh_setting_get hotspot wifi_secure)" + IFS='|' read -a wifi_passphrase <<< "$(ynh_setting_get hotspot wifi_passphrase)" + IFS='|' read -a ip6_firewall <<< "$(ynh_setting_get hotspot ip6_firewall)" + IFS='|' read -a ip6_net <<< "$(ynh_setting_get hotspot ip6_net)" + IFS='|' read -a dns <<< "$(ynh_setting_get hotspot dns)" + IFS='|' read -a ip4_nat_prefix <<< "$(ynh_setting_get hotspot ip4_nat_prefix)" + for i in $(seq 0 $((${multissid} - 1))); do + ip6_dns[${i}]="" + ip4_dns[${i}]="" + for ip in $(echo "${dns[${i}]}" | tr ',' ' '); do if [[ "$ip" == *":"* ]] then - ynh_ip6_dns[${i}]+="[$ip]," + ip6_dns[${i}]+="[$ip]," else - ynh_ip4_dns[${i}]+="$ip," + ip4_dns[${i}]+="$ip," fi done # Remove trailing , - ynh_ip6_dns[${i}]="${ynh_ip6_dns[${i}]%%,}" - ynh_ip4_dns[${i}]="${ynh_ip4_dns[${i}]%%,}" + ip6_dns[${i}]="${ip6_dns[${i}]%%,}" + ip4_dns[${i}]="${ip4_dns[${i}]%%,}" done - old_internet_device=$(ynh_setting_get hotspot internet_device) - new_internet_device=$(ip route get 1.2.3.4 | awk '{ print $5; }') + old_gateway_interface=$(ynh_setting_get hotspot gateway_interface) + new_gateway_interface=$(ip route get 1.2.3.4 | awk '{ print $5; }') # Switch the NAT interface if there is a VPN ip link show dev tun0 &> /dev/null if [ "$?" -eq 0 ]; then - new_internet_device=tun0 + new_gateway_interface=tun0 fi echo "OK" @@ -344,105 +344,110 @@ case "$1" in start) if is_running; then echo "Already started" - elif [ "${ynh_service_enabled}" != "enabled" ]; then - echo "Disabled service" - else + exit 0 + elif [ "${service_enabled}" != "enabled" ]; then + echo "Not starting because hotspod service is disabled" + exit 1 + fi - if [ -z "${ynh_wifi_device}" ]; then - echo "[ERR] No wifi device selected. Make sure your wifi antenna is plugged-in / available and select it in the Hotspot admin" - exitcode=1 + if [ -z "${wifi_device}" ]; then + echo "[FAIL] No wifi device selected. Make sure your wifi antenna is plugged-in / available and select it in the Hotspot admin" + exit 1 + fi + + echo "[hotspot] Starting..." + touch /tmp/.ynh-hotspot-started + + # Check old state of the ipv4 NAT settings + if [ ! -z "${old_gateway_interface}" -a "${new_gateway_interface}" != "${old_gateway_interface}" ]\ + && is_nat_set "${old_gateway_interface}"; then + + unset_nat "${old_gateway_interface}" + fi + + # Set ipv4 NAT + if [ ! -z "${new_gateway_interface}" ] && ! is_nat_set "${new_gateway_interface}"; then + echo "Set NAT" + set_nat "${new_gateway_interface}" + fi + + # Set forwarding for ipv6 and ipv4 + if ! is_forwarding_set; then + echo "Set forwarding" + set_forwarding + fi + + # Run hostapd + if ! is_hostapd_running; then + echo "Configuring hostapd" + configure_hostapd + + echo "Starting hostapd..." + if ! systemctl start hostapd + journalctl -u hostapd -n 100 --no-hostname --no-pager + exit 1 fi - echo "[hotspot] Starting..." - touch /tmp/.ynh-hotspot-started + sleep 1 - # Check old state of the ipv4 NAT settings - if [ ! -z "${old_internet_device}" -a "${new_internet_device}" != "${old_internet_device}" ]\ - && is_nat_set "${old_internet_device}"; then - - unset_nat "${old_internet_device}" - fi - - # Set ipv4 NAT - if [ ! -z "${new_internet_device}" ] && ! is_nat_set "${new_internet_device}"; then - echo "Set NAT" - set_nat "${new_internet_device}" - fi - - # Set forwarding for ipv6 and ipv4 - if ! is_forwarding_set; then - echo "Set forwarding" - set_forwarding - fi - - # Run hostapd - if ! is_hostapd_running; then - echo "Run hostapd" - start_hostapd ${i} - - if [ ! $? -eq 0 ]; then - journalctl -u hostapd -n 100 --no-hostname --no-pager + i=0; + while ! ip link show dev hotspot1 &> /dev/null; do + sleep 1 + if [ ${i} -gt 20 ] + then + echo "Failed to see hotspot interface showing up in 'ip a'" + stop_hostapd exit 1 fi + i=$(($i + 1)) + done + fi - if [ "${ynh_multissid}" -gt 1 ]; then - i=0; false || while [ $? -ne 0 ]; do - sleep 1 && (( i++ )) - [ ${i} -gt 20 ] && stop_hostapd - [ ${i} -gt 20 ] && exit 1 - ip link show dev hotspot1 &> /dev/null - done - else - sleep 1 - fi + # For each registred ssid + for i in $(seq 0 $((${multissid} - 1))); do + + # Set ipv4 NAT address + if ! is_ip4nataddr_set ${i}; then + echo "hotspot${i}: Set IPv4 NAT address" + set_ip4nataddr ${i} fi - # For each registred ssid - for i in $(seq 0 $((${ynh_multissid} - 1))); do + # Set the ipv6 address + if has_ip6delegatedprefix ${i} && ! is_ip6addr_set ${i}; then + echo "hotspot${i}: Set IPv6 address" + set_ip6addr ${i} + fi - # Set ipv4 NAT address - if ! is_ip4nataddr_set ${i}; then - echo "hotspot${i}: Set IPv4 NAT address" - set_ip4nataddr ${i} - fi + # Set ipv6 firewalling + if has_ip6delegatedprefix ${i} && [ "${ip6_firewall[${i}]}" -eq 1 ] && ! is_ip6firewall_set ${i}; then + echo "hotspot${i}: Set IPv6 firewalling" + set_ip6firewall ${i} + fi - # Set the ipv6 address - if has_ip6delegatedprefix ${i} && ! is_ip6addr_set ${i}; then - echo "hotspot${i}: Set IPv6 address" - set_ip6addr ${i} - fi + # Run DHCPv6 server + if has_ip6delegatedprefix ${i} && ! is_dhcpd6_running ${i}; then + echo "hotspot${i}: Start the NDP and DHCPv6 server (dnsmasq)" + start_dhcpd6 ${i} + fi - # Set ipv6 firewalling - if has_ip6delegatedprefix ${i} && [ "${ynh_ip6_firewall[${i}]}" -eq 1 ] && ! is_ip6firewall_set ${i}; then - echo "hotspot${i}: Set IPv6 firewalling" - set_ip6firewall ${i} - fi + # Run DHCPv4 server + if ! is_dhcpd4_running ${i}; then + echo "hotspot${i}: Start the DHCPv4 server (dnsmasq)" + start_dhcpd4 ${i} + fi - # Run DHCPv6 server - if has_ip6delegatedprefix ${i} && ! is_dhcpd6_running ${i}; then - echo "hotspot${i}: Start the NDP and DHCPv6 server (dnsmasq)" - start_dhcpd6 ${i} - fi + done - # Run DHCPv4 server - if ! is_dhcpd4_running ${i}; then - echo "hotspot${i}: Start the DHCPv4 server (dnsmasq)" - start_dhcpd4 ${i} - fi - - done - - # Update dynamic settings - ynh_setting_set hotspot internet_device "${new_internet_device}" - fi + # Update dynamic settings + ynh_setting_set hotspot gateway_interface "${new_gateway_interface}" ;; stop) echo "[hotspot] Stopping..." rm -f /tmp/.ynh-hotspot-started - if [ ! -z "${old_internet_device}" ] && is_nat_set "${old_internet_device}"; then + if [ ! -z "${old_gateway_interface}" ] && is_nat_set "${old_gateway_interface}"; then echo "Unset NAT" - unset_nat "${old_internet_device}" + unset_nat "${old_gateway_interface}" fi if is_forwarding_set; then @@ -450,7 +455,7 @@ case "$1" in unset_forwarding fi - for i in $(seq 0 $((${ynh_multissid} - 1))); do + for i in $(seq 0 $((${multissid} - 1))); do if is_ip4nataddr_set ${i}; then echo "hotspot${i}: Unset IPv4 NAT address" unset_ip4nataddr ${i} @@ -461,7 +466,7 @@ case "$1" in unset_ip6addr ${i} fi - if has_ip6delegatedprefix ${i} && [ "${ynh_ip6_firewall[${i}]}" -eq 1 ] && is_ip6firewall_set ${i}; then + if has_ip6delegatedprefix ${i} && [ "${ip6_firewall[${i}]}" -eq 1 ] && is_ip6firewall_set ${i}; then echo "hotspot${i}: Unset IPv6 firewalling" unset_ip6firewall ${i} fi @@ -494,60 +499,60 @@ case "$1" in status) exitcode=0 - if [ "${ynh_service_enabled}" != "enabled" ]; then - echo "[ERR] Hotspot Service disabled" - exitcode=1 + if [ "${service_enabled}" != "enabled" ]; then + echo "[FAIL] Hotspot Service disabled" + exit 1 fi - if [ -z "${ynh_wifi_device}" ]; then - echo "[ERR] No wifi device selected. Make sure your wifi antenna is plugged-in / available and select it in the Hotspot admin" - exitcode=1 + if [ -z "${wifi_device}" ]; then + echo "[FAIL] No wifi device selected. Make sure your wifi antenna is plugged-in / available and select it in the Hotspot admin" + exit 1 fi - echo "[INFO] Autodetected internet interface: ${new_internet_device} (last start: ${old_internet_device})" + echo "[INFO] Autodetected internet interface: ${new_gateway_interface} (last start: ${old_gateway_interface})" - if is_nat_set "${new_internet_device}"; then - echo "[OK] IPv4 NAT set" + if is_nat_set "${new_gateway_interface}"; then + echo "[ OK ] IPv4 NAT set" else - if [ -z "${new_internet_device}" ]; then + if [ -z "${new_gateway_interface}" ]; then echo "[INFO] No IPv4 NAT set (no internet interface)" else - echo "[ERR] No IPv4 NAT set" + echo "[FAIL] No IPv4 NAT set" fi exitcode=1 fi if is_forwarding_set; then - echo "[OK] IPv6/IPv4 forwarding set" + echo "[ OK ] IPv6/IPv4 forwarding set" else - echo "[ERR] No IPv6/IPv4 forwarding set" + echo "[FAIL] No IPv6/IPv4 forwarding set" exitcode=1 fi if is_hostapd_running; then - echo "[OK] Hostapd is running" + echo "[ OK ] Hostapd is running" else - echo "[ERR] Hostapd is not running" + echo "[FAIL] Hostapd is not running" exitcode=1 fi - for i in $(seq 0 $((${ynh_multissid} - 1))); do + for i in $(seq 0 $((${multissid} - 1))); do if has_ip6delegatedprefix ${i}; then echo "[INFO] hotspot${i}: IPv6 delegated prefix found" echo "[INFO] hotspot${i}: IPv6 address computed from the delegated prefix: $(ip6addrfromdelegatedprefix $i)" if is_ip6addr_set ${i}; then - echo "[OK] hotspot${i}: IPv6 address set" + echo "[ OK ] hotspot${i}: IPv6 address set" else - echo "[ERR] hotspot${i}: No IPv6 address set" + echo "[FAIL] hotspot${i}: No IPv6 address set" exitcode=1 fi if is_ip6firewall_set ${i}; then - echo "[OK] hotspot${i}: IPv6 firewalling set" + echo "[ OK ] hotspot${i}: IPv6 firewalling set" else - if [ "${ynh_ip6_firewall[${i}]}" -eq 1 ]; then - echo "[ERR] hotspot${i}: No IPv6 firewalling set" + if [ "${ip6_firewall[${i}]}" -eq 1 ]; then + echo "[FAIL] hotspot${i}: No IPv6 firewalling set" else echo "[INFO] hotspot${i}: No IPv6 firewalling set" fi @@ -555,9 +560,9 @@ case "$1" in fi if is_dhcpd6_running ${i}; then - echo "[OK] hotspot${i}: NDP and DHCPv6 server (dnsmasq) are running" + echo "[ OK ] hotspot${i}: NDP and DHCPv6 server (dnsmasq) are running" else - echo "[ERR] hotspot${i}: NDP and DHCPv6 server (dnsmasq) are not running" + echo "[FAIL] hotspot${i}: NDP and DHCPv6 server (dnsmasq) are not running" exitcode=1 fi else @@ -565,16 +570,16 @@ case "$1" in fi if is_dhcpd4_running ${i}; then - echo "[OK] hotspot${i}: DHCPv4 server (dnsmasq) is running" + echo "[ OK ] hotspot${i}: DHCPv4 server (dnsmasq) is running" else - echo "[ERR] hotspot${i}: DHCPv4 (dnsmasq) is not running" + echo "[FAIL] hotspot${i}: DHCPv4 (dnsmasq) is not running" exitcode=1 fi if is_ip4nataddr_set ${i}; then - echo "[OK] hotspot${i}: IPv4 NAT address set" + echo "[ OK ] hotspot${i}: IPv4 NAT address set" else - echo "[ERR] hotspot${i}: No IPv4 NAT address set" + echo "[FAIL] hotspot${i}: No IPv4 NAT address set" exitcode=1 fi done