History log of /freebsd/sbin/ping/tests/test_ping.py (Results 1 – 22 of 22)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 5797a03f 05-Nov-2024 Jose Luis Duran <jlduran@FreeBSD.org>

ping tests: Run tests unprivileged inside a vnet

In order to create vnet jails, atf_python needs root privileges.
However, once the vnet is created, its privileges inside the vnet can be
demoted, as

ping tests: Run tests unprivileged inside a vnet

In order to create vnet jails, atf_python needs root privileges.
However, once the vnet is created, its privileges inside the vnet can be
demoted, as these tests should not require root in order to pass.

Reviewed by: markj
Approved by: emaste (mentor)
Fixes: 4efaf43c6fa7 ("ping: Require root user for pytests")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42175

show more ...


# 8b13cb9d 05-Nov-2024 Jose Luis Duran <jlduran@FreeBSD.org>

ping tests: Silence deprecation warnings

Declare some regex patterns as a raw string by prepending `r`.

Reviewed by: markj
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebs

ping tests: Silence deprecation warnings

Declare some regex patterns as a raw string by prepending `r`.

Reviewed by: markj
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D42174

show more ...


# 4859030e 05-Nov-2024 Jose Luis Duran <jlduran@FreeBSD.org>

ping: tests: Align with Scapy defaults

Align some of pinger() defaults with Scapy to facilitate debugging when
printing packets.

No functional change intended.

Reviewed by: emaste, kp
Approved by:

ping: tests: Align with Scapy defaults

Align some of pinger() defaults with Scapy to facilitate debugging when
printing packets.

No functional change intended.

Reviewed by: emaste, kp
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D47159

show more ...


# 2e29bf7a 05-Nov-2024 Jose Luis Duran <jlduran@FreeBSD.org>

ping: tests: Cleanup IPOption()s

Scapy now only accepts known options with IPOption(), so our unknown
option must be passed raw.

While here, prefer the named options for EOL and NOP.

Reviewed by:

ping: tests: Cleanup IPOption()s

Scapy now only accepts known options with IPOption(), so our unknown
option must be passed raw.

While here, prefer the named options for EOL and NOP.

Reviewed by: emaste, kp
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D47160

show more ...


# 2926c259 16-Oct-2024 Kristof Provost <kp@FreeBSD.org>

ping tests: fix for scapy-2.6.0

Scapy 2.6.0 now appears to parse the IPOption during construction, and it then
gets confused at a single-byte option. IP Options typically contain at least a 1
byte t

ping tests: fix for scapy-2.6.0

Scapy 2.6.0 now appears to parse the IPOption during construction, and it then
gets confused at a single-byte option. IP Options typically contain at least a 1
byte type and 1 byte length. Avoid this by just returning the raw bytes, rather
than an IPOption object.

MFC after: 1 week
Reviewed by: Jose Luis Duran <jlduran@gmail.com>
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D47151

show more ...


Revision tags: release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0
# 24fe0cb8 17-Oct-2023 Jose Luis Duran <jlduran@gmail.com>

ping tests: Fix test on i386 platforms

Actually use INT_MAX (0x7fffffff), not UINT_MAX (0xffffffff) to avoid
overflowing time_t and missing the test.

Reported by: Jenkins
Reviewed by: markj
Fixes:

ping tests: Fix test on i386 platforms

Actually use INT_MAX (0x7fffffff), not UINT_MAX (0xffffffff) to avoid
overflowing time_t and missing the test.

Reported by: Jenkins
Reviewed by: markj
Fixes: 5b8af90fe332 ("ping: Add ATF-Python tests")
Pull Request: https://github.com/freebsd/freebsd-src/pull/874
Differential Revision: https://reviews.freebsd.org/D42268

show more ...


# 4efaf43c 11-Oct-2023 Jose Luis Duran <jlduran@gmail.com>

ping: Require root user for pytests

atf_python may use vnet jails for creating an isolated test environment.
Mark these tests that require root user privileges.

Reviewed by: markj
MFC after: 1 week

ping: Require root user for pytests

atf_python may use vnet jails for creating an isolated test environment.
Mark these tests that require root user privileges.

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/863

show more ...


# b86e4812 13-Apr-2023 Jose Luis Duran <jlduran@gmail.com>

ping: pr_iph() improvements

Very early on, the Src/Dst IP addresses were printed in hex notation
(%08x), which will always be 8-characters wide. It was later changed to
use a dot-decimal notation.

ping: pr_iph() improvements

Very early on, the Src/Dst IP addresses were printed in hex notation
(%08x), which will always be 8-characters wide. It was later changed to
use a dot-decimal notation. Depending on the IP address length, the Src
and Dst headers may require a different padding. Use the source and
destination IP lengths as padding for the headers.

Also, print an Opts (options) header, if there are options present. It
has been abbreviated to Opts to match the length of the previous Data
header, removed in ef9e6dc7eebe9830511602904d3ef5218d964080.

Print the header info such that no trailing spaces are produced. As
some git workflows may automatically trim them, and make the tests fail
(see 25b86f8559c2e7076daff56933217e95cd4398d4).

Before

Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 f 00 007c 0001 0 0000 40 01 d868 192.0.2.1 192.0.2.2␣

After

Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 f 00 007c 0001 0 0000 40 01 d868 192.0.2.1 192.0.2.2

And with options:

Before

Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 f 00 007c 0001 0 0000 40 01 d868 192.0.2.1 192.0.2.2 01...

After

Vr HL TOS Len ID Flg off TTL Pro cks Src Dst Opts
4 f 00 007c 0001 0 0000 40 01 d868 192.0.2.1 192.0.2.2 01...

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/863
Differential Revision: https://reviews.freebsd.org/D39561

show more ...


# 8db2c580 10-Apr-2023 Jose Luis Duran <jlduran@gmail.com>

ping: Fix the spacing between the time stamp and cp/dp

When an echo reply packet is received, the data is compared with the
sent data. When a wrong byte is detected the command displays a report
wi

ping: Fix the spacing between the time stamp and cp/dp

When an echo reply packet is received, the data is compared with the
sent data. When a wrong byte is detected the command displays a report
with the differences.

The first row (the first 8-bytes of data after the ICMP header) should
include the time stamp (if data is at least 8-bytes), this value is not
taken into consideration for the comparison. The remaining rows
represent the data (padded pattern) received/sent, with each byte being
compared for differences.

Print the space before (not after), to add an extra space after cp:/dp:
for better readability when the first time stamp octet is not
zero-padded, and to remove trailing spaces in the output.

Before:
cp:99 0 0 c 1 5 c 0␣
ab cd ab cd ab cd ab cd ab cd ab cd ab cd ab cd␣
...

After:
cp: 99 0 0 c 1 5 c 0
ab cd ab cd ab cd ab cd ab cd ab cd ab cd ab cd
...

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/863
Differential Revision: https://reviews.freebsd.org/D39492

show more ...


Revision tags: release/13.2.0, release/12.4.0
# 03d4d1c7 21-Nov-2022 Jose Luis Duran <jlduran@gmail.com>

ping: Unify ping/ping6 statistics section

This is a first step towards a unification/simplification of ping/ping6
(internally). The end goal is to produce a standardized user-facing
output.

Before

ping: Unify ping/ping6 statistics section

This is a first step towards a unification/simplification of ping/ping6
(internally). The end goal is to produce a standardized user-facing
output.

Before (ping6):

PING6(56=40+8+8 bytes) 2001:db8::1 --> 2001:db8::2
16 bytes from ::1, icmp_seq=0 hlim=64 time=0.168 ms
16 bytes from ::1, icmp_seq=1 hlim=64 time=0.068 ms

--- 2001:db8::2 ping6 statistics ---
round-trip min/avg/max/std-dev = 0.068/0.118/0.168/0.050 ms

After (ping6):

PING(56=40+8+8 bytes) 2001:db8::1 --> 2001:db8::2
16 bytes from ::1, icmp_seq=0 hlim=64 time=0.168 ms
16 bytes from ::1, icmp_seq=1 hlim=64 time=0.068 ms

--- 2001:db8::2 ping statistics ---
round-trip min/avg/max/stddev = 0.068/0.118/0.168/0.050 ms

This has the nice side-effect of adding units to SIGINFO's statistics,
as printing numbers without units may not be of much help. Also
mentions the fact that these times are round-trip.

Before (ping/ping6 SIGINFO):

2/2 packets received (100.0%) 0.068 min / 0.118 avg / 0.168 max

After (ping/ping6 SIGINFO):

--- <ipv4/ipv6 address> ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.068/0.118/0.168/0.050 ms

In the case of a SIGINFO, the output will be printed to stderr, for both
ping and ping6.

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/863
Differential Revision: https://reviews.freebsd.org/D39126

show more ...


# d2c9a140 09-Feb-2023 Jose Luis Duran <jlduran@gmail.com>

ping: Remove an extra new line character

This matches the behavior when an RR truncated route is printed.

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/p

ping: Remove an extra new line character

This matches the behavior when an RR truncated route is printed.

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/863
Differential Revision: https://reviews.freebsd.org/D39485

show more ...


# 20012a3a 11-Feb-2023 Jose Luis Duran <jlduran@gmail.com>

ping tests: Test IHL/quoted data/inner packet paths

Commit 46d7b45a267b3d78c5054b210ff7b6c55bfca42b introduced these code
paths. Test and document them.

- Add inner packet too short test
- Add inn

ping tests: Test IHL/quoted data/inner packet paths

Commit 46d7b45a267b3d78c5054b210ff7b6c55bfca42b introduced these code
paths. Test and document them.

- Add inner packet too short test
- Add inner IHL too short test
- Add quoted data too short test
- Add IHL too short test
- Add max inner packet IHL without payload test

Reviewed by: markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/863
Differential Revision: https://reviews.freebsd.org/D38528

show more ...


# 25b86f85 02-Apr-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ping: fix failing test_pinger[_3_1_verbose_false] test.


# 9fc2d858 26-Mar-2023 Jose Luis Duran <jlduran@gmail.com>

ping tests: Add a regression test

Test regression fixed in 4630a3252ac8. Add two tests that do not
use the verbose flag, so the code path in question can be reached:

1. Respond with a proper ICMP d

ping tests: Add a regression test

Test regression fixed in 4630a3252ac8. Add two tests that do not
use the verbose flag, so the code path in question can be reached:

1. Respond with a proper ICMP destination host unreachable packet.
2. Respond with a doctored ICMP destination host unreachable packet,
that has the ICMP Identifier field modified (+1 bit).

Reviewed by: cy
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39244

show more ...


# ea6d1692 10-Feb-2023 Jose Luis Duran <jlduran@gmail.com>

ping: Avoid reporting negative time statistics

Display a warning when the time goes back.

PR: 192417
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38480


# 076b718d 09-Feb-2023 Jose Luis Duran <jlduran@gmail.com>

ping tests: Add tests for IP header options

The function pr_pack() prints out a packet, if the IP packet contains
options, these are printed as well.

Test the functionality fixed in
70960bb86a3ba5b

ping tests: Add tests for IP header options

The function pr_pack() prints out a packet, if the IP packet contains
options, these are printed as well.

Test the functionality fixed in
70960bb86a3ba5b6f5c4652e613e6313a7ed1ac1.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38470

show more ...


# 1dc1f6bd 09-Feb-2023 Jose Luis Duran <jlduran@gmail.com>

ping: Remove pr_retip()

Ping used to provide some sort of packet sniffing capabilities, this was
in an era where hubs were used and tcpdump wasn't invented.

pr_iph() is a function that prints the I

ping: Remove pr_retip()

Ping used to provide some sort of packet sniffing capabilities, this was
in an era where hubs were used and tcpdump wasn't invented.

pr_iph() is a function that prints the IP header of the packet.

pr_retip() is essentially a wrapper function to pr_iph(), that also
displays the source and destination ports of a TCP or UDP packet.

After ef9e6dc7eebe9830511602904d3ef5218d964080 some of this
functionality was almost removed, to only display packets sent by us
(26+ years ago).

At this point, reaching this code path was only possible by doctoring
the original packet.

After 46d7b45a267b3d78c5054b210ff7b6c55bfca42b this code path can never
be reached.

Remove the code.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38475

show more ...


# 20b41303 09-Feb-2023 Jose Luis Duran <jlduran@gmail.com>

ping: Print the IP options of the original packet

When an ICMP packet contains an IP packet in its payload, and that
original IP packet contains options, these options were not displayed
accordingly

ping: Print the IP options of the original packet

When an ICMP packet contains an IP packet in its payload, and that
original IP packet contains options, these options were not displayed
accordingly in pr_iph().

pr_iph() is a function that prints the original "quoted packet" IP
header, with only an IP struct as an argument. The IP struct does not
contain IP options, and it is not guaranteed that the options will be
contiguous in memory to the IP struct after
d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52.

Pass the raw ICMP data along with the IP struct, in order to print the
options, if any.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38469

show more ...


# 9185854d 14-Mar-2023 Jose Luis Duran <jlduran@gmail.com>

ping: Fix the display of Flags/Fragment Offset

In the IP header, Flags + Fragment Offset is a 16-bit field.

Use ntohs() instead of ntohl(), otherwise the Flags/Fragment Offset
values may not displa

ping: Fix the display of Flags/Fragment Offset

In the IP header, Flags + Fragment Offset is a 16-bit field.

Use ntohs() instead of ntohl(), otherwise the Flags/Fragment Offset
values may not display correctly.

Before (DF set)

Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 5 00 0054 0001 0 0000 40 01 b6a4 192.0.2.1 192.0.2.2

After (DF set)

Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 5 00 0054 0001 2 0000 40 01 b6a4 192.0.2.1 192.0.2.2

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38479

show more ...


# f32d6f74 14-Mar-2023 Jose Luis Duran <jlduran@gmail.com>

ping6: Use errx to avoid appending a specious error message

Reviewed by: asomers, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38418


# 5b8af90f 20-Feb-2023 Jose Luis Duran <jlduran@gmail.com>

ping: Add ATF-Python tests

ping(8) is an old utility, which has received many changes and updates through the years.
Some of these changes may have introduced small bugs, in part due to the lack of

ping: Add ATF-Python tests

ping(8) is an old utility, which has received many changes and updates through the years.
Some of these changes may have introduced small bugs, in part due to the lack of tests.
Attempt to remedy the current situation by introducing a way to easily add tests.

Differential Revision: https://reviews.freebsd.org/D38053

show more ...


# 0343e90f 20-Feb-2023 Alexander V. Chernikov <melifaro@FreeBSD.org>

ping: Add ATF-Python tests

ping(8) is an old utility, which has received many changes and updates through the years.
Some of these changes may have introduced small bugs, in part due to the lack of

ping: Add ATF-Python tests

ping(8) is an old utility, which has received many changes and updates through the years.
Some of these changes may have introduced small bugs, in part due to the lack of tests.
Attempt to remedy the current situation by introducing a way to easily add tests.

Differential Revision: https://reviews.freebsd.org/D38053

show more ...