Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177605327
D38475.1794827333.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D38475.1794827333.diff
View Options
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1725,16 +1725,9 @@
* Dump some info on a returned (via ICMP) IP packet.
*/
static void
-pr_retip(struct ip *ip, const u_char *cp)
+pr_retip(struct ip *ip, const u_char *cp __unused)
{
pr_iph(ip);
-
- if (ip->ip_p == 6)
- (void)printf("TCP: from port %u, to port %u (decimal)\n",
- (*cp * 256 + *(cp + 1)), (*(cp + 2) * 256 + *(cp + 3)));
- else if (ip->ip_p == 17)
- (void)printf("UDP: from port %u, to port %u (decimal)\n",
- (*cp * 256 + *(cp + 1)), (*(cp + 2) * 256 + *(cp + 3)));
}
static char *
diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py
--- a/sbin/ping/tests/test_ping.py
+++ b/sbin/ping/tests/test_ping.py
@@ -1126,6 +1126,54 @@
marks=pytest.mark.skip("XXX currently failing"),
id="_3_1_flags_DF",
),
+ pytest.param(
+ {
+ "src": "192.0.2.1",
+ "dst": "192.0.2.2",
+ "icmp_type": 3,
+ "icmp_code": 1,
+ "special": "tcp",
+ },
+ {
+ "returncode": 2,
+ "stdout": """\
+PATTERN: 0x01
+PING 192.0.2.2 (192.0.2.2): 56 data bytes
+
+--- 192.0.2.2 ping statistics ---
+1 packets transmitted, 0 packets received, 100.0% packet loss
+""",
+ "stderr": """\
+ping: quoted data too short (40 bytes) from 192.0.2.2
+""",
+ "redacted": False,
+ },
+ id="_3_1_special_tcp",
+ ),
+ pytest.param(
+ {
+ "src": "192.0.2.1",
+ "dst": "192.0.2.2",
+ "icmp_type": 3,
+ "icmp_code": 1,
+ "special": "udp",
+ },
+ {
+ "returncode": 2,
+ "stdout": """\
+PATTERN: 0x01
+PING 192.0.2.2 (192.0.2.2): 56 data bytes
+
+--- 192.0.2.2 ping statistics ---
+1 packets transmitted, 0 packets received, 100.0% packet loss
+""",
+ "stderr": """\
+ping: quoted data too short (28 bytes) from 192.0.2.2
+""",
+ "redacted": False,
+ },
+ id="_3_1_special_udp",
+ ),
]
@pytest.mark.parametrize("pinger_kargs, expected", pinger_testdata)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 16, 11:08 AM (3 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41774823
Default Alt Text
D38475.1794827333.diff (2 KB)
Attached To
Mode
D38475: ping: Remove vestigial code
Attached
Detach File
Event Timeline