| #
14d370c9
|
| 28-Dec-2024 |
Maxim Konovalov <maxim@FreeBSD.org> |
ping: remove a stray tab
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D48233
|
| #
8408510c
|
| 28-Dec-2024 |
Maxim Konovalov <maxim@FreeBSD.org> |
ping: adjust error messages and comments for -gGh flags
The -gGh flags are used for sweep ping to specify minimal, maximum and increment sizes for the ICMP payload, not the packet size. Adjust the
ping: adjust error messages and comments for -gGh flags
The -gGh flags are used for sweep ping to specify minimal, maximum and increment sizes for the ICMP payload, not the packet size. Adjust the error messages and comments accordingly.
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D48232
show more ...
|
| #
39d3c81c
|
| 28-Dec-2024 |
Maxim Konovalov <maxim@FreeBSD.org> |
ping: correct minimal payload size for the sweep ping
The -g flag specifies a minimal payload size for the sweep ping and its default is zero. Make it possible to do ping -g 0 ..., i.e., start with
ping: correct minimal payload size for the sweep ping
The -g flag specifies a minimal payload size for the sweep ping and its default is zero. Make it possible to do ping -g 0 ..., i.e., start with no payload.
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D48231
show more ...
|
| #
eaab8826
|
| 20-Oct-2024 |
Mark Johnston <markj@FreeBSD.org> |
Revert "Reapply "sbin/ping: allow normal users to specify larger packets""
The value of MAXPAYLOAD in the re-applied commit is not right. Back this out until it's had a proper review.
This reverts
Revert "Reapply "sbin/ping: allow normal users to specify larger packets""
The value of MAXPAYLOAD in the re-applied commit is not right. Back this out until it's had a proper review.
This reverts commit b88df1e893c455731c7915f72a3b97b078ab04e2.
Requested by: maxim, glebius
show more ...
|
| #
b88df1e8
|
| 16-Oct-2024 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
Reapply "sbin/ping: allow normal users to specify larger packets"
The ping tests were originally broken by an unrelated isue that is now fixed ( 2926c2594249f64fecbbdcb0b0b9a3591931ab04 ).
THanks t
Reapply "sbin/ping: allow normal users to specify larger packets"
The ping tests were originally broken by an unrelated isue that is now fixed ( 2926c2594249f64fecbbdcb0b0b9a3591931ab04 ).
THanks to kp@ for fixing the test and Jose Luis Duran for pinting it out.
This reverts commit 7bc0cb91a2dfc7e23d96efd0fb7866ee2a23ba88.
show more ...
|
| #
7bc0cb91
|
| 16-Oct-2024 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
Revert "sbin/ping: allow normal users to specify larger packets" It is causing test failures.
This reverts commit 80a5b26871e90a0ad99d95bd129343471a7a36e3.
|
| #
80a5b268
|
| 15-Oct-2024 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sbin/ping: allow normal users to specify larger packets
Only super-user could specify a packet size larger than the default 56 bytes. This restriction was added by Matt Dillon in 1998 during the BES
sbin/ping: allow normal users to specify larger packets
Only super-user could specify a packet size larger than the default 56 bytes. This restriction was added by Matt Dillon in 1998 during the BEST days [0]. This restriction doesn't exist in ping IPV6 or on NetBSD, OpenBSD and Linux.
UMS [1] uses this feature to estimate the client's bandwidth to optimize the streaming experience.
[0] DFGit 526f06b278d9252add168aa18b60242c08771165 [1] UMS: https://github.com/UniversalMediaServer/UniversalMediaServer
Obtained from: DragonFlyBSD Differential Revision: https://reviews.freebsd.org/D45774
show more ...
|
| #
0b8224d1
|
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals.
Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require).
Sponsored by: Netflix
show more ...
|
| #
51e16cb8
|
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sbin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl
sbin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
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 ...
|
| #
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 ...
|
| #
72d3e667
|
| 10-Feb-2023 |
Jose Luis Duran <jlduran@gmail.com> |
ping: Specify the sigaction(2) name
After a2a008880568eaeb87d8404b39627b83df851f34, specify the signal name.
Obtained from: Darwin MFC after: 1 week Reviewed by: asomers Pull Request: https://githu
ping: Specify the sigaction(2) name
After a2a008880568eaeb87d8404b39627b83df851f34, specify the signal name.
Obtained from: Darwin MFC after: 1 week Reviewed by: asomers Pull Request: https://github.com/freebsd/freebsd-src/pull/863 Differential Revision: https://reviews.freebsd.org/D38484
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 ...
|
| #
4d348e83
|
| 06-Oct-2023 |
Jose Luis Duran <jlduran@gmail.com> |
ping: Avoid reporting NaNs
Avoid calculating the square root of negative zero, which can easily happen on certain architectures when calculating the population standard deviation with a sample size
ping: Avoid reporting NaNs
Avoid calculating the square root of negative zero, which can easily happen on certain architectures when calculating the population standard deviation with a sample size of one, e.g., 0.01 - (0.1 * 0.1) = -0.000000.
Avoid returning a NaN by capping the minimum possible variance value to zero (positive).
In the future, maybe skip reporting statistics at all for a single sample.
Reported by: Jenkins Reviewed by: asomers MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/863 Differential Revision: https://reviews.freebsd.org/D42114
show more ...
|
| #
1d386b48
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
4630a325
|
| 24-Mar-2023 |
Jose Luis Duran <jlduran@gmail.com> |
ping: Fix an uninitialized variable
The variable oicmp, which holds the original ("quoted packet") ICMP packet in a structured way, did not have a copy of the original ICMP packet obtained from the
ping: Fix an uninitialized variable
The variable oicmp, which holds the original ("quoted packet") ICMP packet in a structured way, did not have a copy of the original ICMP packet obtained from the raw data.
The code was accidentally removed in 20b41303140e. Bring it back.
Reported by: Coverity Scan, cy Reviewed by: cy CID: 1506960 (UNINIT) Fixes: 20b41303140eee4dfb896558fb83600c5f013d39 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39233
show more ...
|
| #
ea6d1692
|
| 09-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
|
| #
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 ...
|
| #
491263d7
|
| 17-Mar-2023 |
Jose Luis Duran <jlduran@gmail.com> |
ping: Avoid magic numbers
The sizeof(struct ip) is 20. The sizeof(struct in_addr) is 4.
No functional change intended.
Reviewed by: asomers, markj MFC after: 1 week Differential Revision: https://
ping: Avoid magic numbers
The sizeof(struct ip) is 20. The sizeof(struct in_addr) is 4.
No functional change intended.
Reviewed by: asomers, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39125
show more ...
|
| #
6d331213
|
| 14-Mar-2023 |
Jose Luis Duran <jlduran@gmail.com> |
ping: Remove ifndef icmp_data guards
Early versions of <netinet/ip_icmp.h> [1] did not have icmp_data defined, but FreeBSD has always had. Remove these guards.
NetBSD [2] and OpenBSD [3] have alre
ping: Remove ifndef icmp_data guards
Early versions of <netinet/ip_icmp.h> [1] did not have icmp_data defined, but FreeBSD has always had. Remove these guards.
NetBSD [2] and OpenBSD [3] have already removed them.
[1]: https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/netinet/ip_icmp.h [2]: https://github.com/NetBSD/src/commit/203dfd34867991fd002f747d74a96f26ae80d41c [3]: https://github.com/openbsd/src/commit/d83449c83c03b86e72d642dc92bcea434310435a
Reviewed by: markj MFC after: 1 week
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 ...
|
| #
70960bb8
|
| 23-Feb-2023 |
Cy Schubert <cy@FreeBSD.org> |
ping: Fix unsigned integer underflow resuling in a ping -R segfault
ping -R (F_RROUTE) will loop at ping.c:1381 until it segfaults or the unsigned int hlen happens to be less than the size of an IP
ping: Fix unsigned integer underflow resuling in a ping -R segfault
ping -R (F_RROUTE) will loop at ping.c:1381 until it segfaults or the unsigned int hlen happens to be less than the size of an IP header:
slippy$ ping -R 192.168.0.101 PING 192.168.0.101 (192.168.0.101): 56 data bytes 64 bytes from 192.168.0.101: icmp_seq=0 ttl=63 time=1.081 ms RR: 192.168.0.1 192.168.0.101 192.168.0.101 10.1.1.254 10.1.1.91 unknown option bb unknown option 32 unknown option 6 ... unknown option 96 unknown option 2d Segmentation fault
The reason for this is while looping through loose source routing (LSRR) and strict source routing (SSRR), hlen will become smaller than the IP header. It may even become negative. This should terminate the loop. However, when hlen is unsigned, an integer underflow occurs becoming a large number causing the loop to continue virtually forever until hlen is either by chance smaller than the lenghth of an IP header or it segfaults.
Reviewed by: asomers Fixes: 46d7b45a267b MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D38744
show more ...
|
| #
46d7b45a
|
| 17-Nov-2022 |
Tom Jones <thj@FreeBSD.org> |
ping: Fix handling of IP packet sizes
Ping reads raw IP packets to parse ICMP responses. When reading the IP Header Len (IHL) ping was was taking the value from the provided packet without any valid
ping: Fix handling of IP packet sizes
Ping reads raw IP packets to parse ICMP responses. When reading the IP Header Len (IHL) ping was was taking the value from the provided packet without any validation. This could lead to remotely triggerable stack corruption.
Validate the IHL against expected and recieved data sizes when reading from the received packet and when reading any quoted packets from within the ICMP response.
Approved by: so Reviewed by: markj, asomers Security: FreeBSD-SA-22:15.ping Security: CVE-2022-23093 Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #77 Differential Revision: https://reviews.freebsd.org/D37195
show more ...
|