summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--routers/bird.php12
-rw-r--r--routers/cisco.php17
-rw-r--r--routers/quagga.php8
3 files changed, 26 insertions, 11 deletions
diff --git a/routers/bird.php b/routers/bird.php
index 9ee2e7f..06aea32 100644
--- a/routers/bird.php
+++ b/routers/bird.php
@@ -36,11 +36,11 @@ final class Bird extends Router {
}
if (match_ipv4($destination)) {
- $ping = 'ping -A -c 10 '.$destination;
+ $ping = 'ping -A -c 10 '.$fqdn;
} else if (match_ipv6($destination)) {
- $ping = 'ping6 -A -c 10 '.$destination;
+ $ping = 'ping6 -A -c 10 '.$fqdn;
} else {
- throw new Exception('The parameter is not an IPv4/IPv6 address or a FQDN.');
+ throw new Exception('The parameter does not resolve to an IPv4/IPv6 address.');
}
if (($ping != null) && $this->has_source_interface_id()) {
@@ -69,11 +69,11 @@ final class Bird extends Router {
}
if (match_ipv4($destination)) {
- $traceroute = 'traceroute -4 -A -q1 -N32 -w1 -m15 '.$destination;
+ $traceroute = 'traceroute -4 -A -q1 -N32 -w1 -m15 '.$fqdn;
} else if (match_ipv6($destination)) {
- $traceroute = 'traceroute -6 -A -q1 -N32 -w1 -m15 '.$destination;
+ $traceroute = 'traceroute -6 -A -q1 -N32 -w1 -m15 '.$fqdn;
} else {
- throw new Exception('The parameter is not an IPv4/IPv6 address or a FQDN.');
+ throw new Exception('The parameter does not resolve to an IPv4/IPv6 address.');
}
if (($traceroute != null) && $this->has_source_interface_id()) {
diff --git a/routers/cisco.php b/routers/cisco.php
index 5a135c0..20592b6 100644
--- a/routers/cisco.php
+++ b/routers/cisco.php
@@ -44,8 +44,23 @@ final class Cisco extends Router {
$traceroute = null;
if (match_ipv4($destination) || match_ipv6($destination) ||
- match_fqdn($destination)) {
+ (match_fqdn($destination) && !$this->has_source_interface_id())) {
$traceroute = 'traceroute '.$destination;
+ } else if (match_fqdn($destination)) {
+ $fqdn = $destination;
+ $destination = fqdn_to_ip_address($fqdn);
+
+ if (!$destination) {
+ throw new Exception('No A or AAAA record found for '.$fqdn);
+ }
+
+ if (match_ipv4($destination)) {
+ $traceroute = 'traceroute ip '.$fqdn;
+ } else if (match_ipv6($destination)) {
+ $traceroute = 'traceroute ip6 '.$fqdn;
+ } else {
+ throw new Exception('The parameter does not resolve to an IPv4/IPv6 address.');
+ }
} else {
throw new Exception('The parameter is not an IPv4/IPv6 address or a FQDN.');
}
diff --git a/routers/quagga.php b/routers/quagga.php
index 3dea33b..f78bdec 100644
--- a/routers/quagga.php
+++ b/routers/quagga.php
@@ -40,7 +40,7 @@ final class Quagga extends Router {
} else if (match_ipv6($destination)) {
$ping = 'ping6 -A -c 10 '.$destination;
} else {
- throw new Exception('The parameter is not an IPv4/IPv6 address or a FQDN.');
+ throw new Exception('The parameter does not resolve to an IPv4/IPv6 address.');
}
if (($ping != null) && $this->has_source_interface_id()) {
@@ -69,11 +69,11 @@ final class Quagga extends Router {
}
if (match_ipv4($destination)) {
- $traceroute = 'traceroute -4 -A -q1 -N32 -w1 -m15 '.$destination;
+ $traceroute = 'traceroute -4 -A -q1 -N32 -w1 -m15 '.$fqdn;
} else if (match_ipv6($destination)) {
- $traceroute = 'traceroute -6 -A -q1 -N32 -w1 -m15 '.$destination;
+ $traceroute = 'traceroute -6 -A -q1 -N32 -w1 -m15 '.$fqdn;
} else {
- throw new Exception('The parameter is not an IPv4/IPv6 address or a FQDN.');
+ throw new Exception('The parameter does not resolve to an IPv4/IPv6 address.');
}
if (($traceroute != null) && $this->has_source_interface_id()) {