interfaces: remove inconsistencies regarding ping utility

This commit is contained in:
Franco Fichtner 2022-07-18 09:16:11 +02:00
parent 40a64dc9f5
commit 8edb37042c
3 changed files with 8 additions and 16 deletions

View File

@ -47,7 +47,7 @@ echo "Currently running $(opnsense-version) at $(date)" >> ${LOCKFILE}
if [ -n "${IPV4}" -a -z "${IPV4%%*.*}" ]; then
echo "Checking connectivity for host: ${HOST} -> ${IPV4}" | ${TEE} ${LOCKFILE}
(ping ${POPT} ${IPV4} 2>&1) | ${TEE} ${LOCKFILE}
(ping -4 ${POPT} ${IPV4} 2>&1) | ${TEE} ${LOCKFILE}
echo "Checking connectivity for repository (IPv4): ${URL}" | ${TEE} ${LOCKFILE}
(pkg -4 update -f 2>&1) | ${TEE} ${LOCKFILE}
else
@ -56,7 +56,7 @@ fi
if [ -n "${IPV6}" -a -z "${IPV6%%*:*}" ]; then
echo "Checking connectivity for host: ${HOST} -> ${IPV6}" | ${TEE} ${LOCKFILE}
(ping6 ${POPT} ${IPV6} 2>&1) | ${TEE} ${LOCKFILE}
(ping -6 ${POPT} ${IPV6} 2>&1) | ${TEE} ${LOCKFILE}
echo "Checking connectivity for repository (IPv6): ${URL}" | ${TEE} ${LOCKFILE}
(pkg -6 update -f 2>&1) | ${TEE} ${LOCKFILE}
else

View File

@ -35,16 +35,8 @@ $fp = fopen('php://stdin', 'r');
echo "\nEnter a host name or IP address: ";
$pinghost = chop(fgets($fp));
if (is_ipaddrv4($pinghost) || is_hostname($pinghost)) {
$command = "ping";
} elseif (is_ipaddrv6($pinghost)) {
$command = "ping6";
}
if ($command) {
echo "\n";
passthru("/sbin/{$command} -c 3 -n " . escapeshellarg($pinghost));
echo "\nPress ENTER to continue.\n";
fgets($fp);
}
echo "\n";
passthru("/sbin/ping -c 3 -n " . escapeshellarg($pinghost));
echo "\nPress ENTER to continue.\n";
fgets($fp);
fclose($fp);

View File

@ -62,9 +62,9 @@ for TOPING in $PINGHOSTS ; do
WANTHRESHOLD=`echo $TOPING | cut -d"|" -f7`
AF=`echo $TOPING | cut -d"|" -f8`
if [ "$AF" == "inet6" ]; then
PINGCMD=ping6
PINGCMD="ping -6"
else
PINGCMD=ping
PINGCMD="ping -4"
fi
echo Processing $DSTIP
# Look for a service being down