From 21cb7dd8a0fa4a87481506f08732865f763b94d4 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Sat, 13 Dec 2014 00:26:52 +0100 Subject: Fix traceroute for Cisco when using 'source'. On Cisco, when using traceroute 'source' option with a FQDN, you need to explicitly specify if you want an IPv4 or an IPv6 traceroute. To fix this we try to resolve the given FQDN and then pass the IPv4 or IPv6 address instead of the FQDN Also make sure that the FQDN is used in the issued command. Do not use the resolved IP anymore. --- routers/bird.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'routers/bird.php') 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()) { -- cgit v1.2.3