version 1.1, 2019/10/21 14:25:31
|
version 1.1.1.3, 2023/09/27 11:18:58
|
Line 12
|
Line 12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# GNU General Public License for more details. |
# |
# |
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License along |
# along with this program; if not, write to the Free Software | # with this program; if not, write to the Free Software Foundation, Inc., |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
# |
# |
|
|
'''Test sending probes and receiving respones.''' | '''Test sending probes and receiving responses.''' |
|
|
import socket |
import socket |
import sys |
import sys |
Line 136 class TestProbeICMPv4(mtrpacket.MtrPacketTest):
|
Line 136 class TestProbeICMPv4(mtrpacket.MtrPacketTest):
|
'Test timeouts when sending to a non-existant address' |
'Test timeouts when sending to a non-existant address' |
|
|
# |
# |
# Probe a non-existant address, and expect no reply | # Probe a non-existent address, and expect no reply |
# |
# |
# I'm not sure what the best way to find an address that doesn't |
# I'm not sure what the best way to find an address that doesn't |
# exist, but is still route-able. If we use a reserved IP |
# exist, but is still route-able. If we use a reserved IP |
Line 208 class TestProbeICMPv4(mtrpacket.MtrPacketTest):
|
Line 208 class TestProbeICMPv4(mtrpacket.MtrPacketTest):
|
def test_ttl_expired(self): |
def test_ttl_expired(self): |
'Test sending a probe which will have its time-to-live expire' |
'Test sending a probe which will have its time-to-live expire' |
|
|
# Probe Goolge's DNS server, but give the probe only one hop | # Probe Google's DNS server, but give the probe only one hop |
# to live. |
# to live. |
self.write_command('16 send-probe ip-4 8.8.8.8 ttl 1') |
self.write_command('16 send-probe ip-4 8.8.8.8 ttl 1') |
reply = self.parse_reply() |
reply = self.parse_reply() |
Line 220 class TestProbeICMPv4(mtrpacket.MtrPacketTest):
|
Line 220 class TestProbeICMPv4(mtrpacket.MtrPacketTest):
|
'''Test sending multiple probes in parallel |
'''Test sending multiple probes in parallel |
|
|
We will expect the probes to complete out-of-order by sending |
We will expect the probes to complete out-of-order by sending |
a probe to a distant host immeidately followed by a probe to | a probe to a distant host immediately followed by a probe to |
the local host.''' |
the local host.''' |
|
|
success_count = 0 |
success_count = 0 |
Line 268 class TestProbeICMPv6(mtrpacket.MtrPacketTest):
|
Line 268 class TestProbeICMPv6(mtrpacket.MtrPacketTest):
|
'''Test sending probes using IP version 6''' |
'''Test sending probes using IP version 6''' |
|
|
def __init__(self, *args): |
def __init__(self, *args): |
google_addr = resolve_ipv6_address(mtrpacket.IPV6_TEST_HOST) | if mtrpacket.HAVE_IPV6: |
| google_addr = resolve_ipv6_address(mtrpacket.IPV6_TEST_HOST) |
|
|
self.google_addr = google_addr # type: str | self.google_addr = google_addr # type: str |
|
|
super(TestProbeICMPv6, self).__init__(*args) |
super(TestProbeICMPv6, self).__init__(*args) |
|
|
Line 300 class TestProbeICMPv6(mtrpacket.MtrPacketTest):
|
Line 301 class TestProbeICMPv6(mtrpacket.MtrPacketTest):
|
def test_ttl_expired(self): |
def test_ttl_expired(self): |
'Test sending a probe which will have its time-to-live expire' |
'Test sending a probe which will have its time-to-live expire' |
|
|
# Probe Goolge's DNS server, but give the probe only one hop | # Probe Google's DNS server, but give the probe only one hop |
# to live. |
# to live. |
cmd = '53 send-probe ip-6 ' + self.google_addr + ' ttl 1' |
cmd = '53 send-probe ip-6 ' + self.google_addr + ' ttl 1' |
self.write_command(cmd) |
self.write_command(cmd) |