diff options
Diffstat (limited to 'routers/quagga.php')
-rw-r--r-- | routers/quagga.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/routers/quagga.php b/routers/quagga.php index 9f6426d..642ff4e 100644 --- a/routers/quagga.php +++ b/routers/quagga.php @@ -62,6 +62,18 @@ final class Quagga extends Router { $commands[] = 'ping -A -c 10 '.$parameters; } else if (match_ipv6($parameters)) { $commands[] = 'ping6 -A -c 10 '.$parameters; + } else if (match_fqdn($parameters)) { + $ip_address = fqdn_to_ip_address($parameters); + + if (!$ip_address) { + throw new Exception('No A or AAAA record found for '.$parameters); + } + + if (match_ipv4($ip_address)) { + $commands[] = 'ping -A -c 10 '.$parameters; + } else if (match_ipv6($ip_address)) { + $commands[] = 'ping6 -A -c 10 '.$parameters; + } } else { throw new Exception('The parameter is not an IPv4/IPv6 address.'); } @@ -72,6 +84,18 @@ final class Quagga extends Router { $commands[] = 'traceroute -4 -A -q1 -N32 -w1 -m15 '.$parameters; } else if (match_ipv6($parameters)) { $commands[] = 'traceroute -6 -A -q1 -N32 -w1 -m15 '.$parameters; + } else if (match_fqdn($parameters)) { + $ip_address = fqdn_to_ip_address($parameters); + + if (!$ip_address) { + throw new Exception('No A or AAAA record found for '.$parameters); + } + + if (match_ipv4($ip_address)) { + $commands[] = 'traceroute -4 -A -q1 -N32 -w1 -m15 '.$parameters; + } else if (match_ipv6($ip_address)) { + $commands[] = 'traceroute -6 -A -q1 -N32 -w1 -m15 '.$parameters; + } } else { throw new Exception('The parameter is not an IPv4/IPv6 address.'); } |