Page MenuHomeFreeBSD

D39492.id120111.diff
No OneTemporary

D39492.id120111.diff

diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1299,14 +1299,14 @@
for (i = 0; i < datalen; ++i, ++cp) {
if ((i % 16) == 8)
(void)printf("\n\t");
- (void)printf("%2x ", *cp);
+ (void)printf(" %2x", *cp);
}
(void)printf("\ndp:");
cp = &outpack[ICMP_MINLEN];
for (i = 0; i < datalen; ++i, ++cp) {
if ((i % 16) == 8)
(void)printf("\n\t");
- (void)printf("%2x ", *cp);
+ (void)printf(" %2x", *cp);
}
break;
}
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
@@ -275,6 +275,8 @@
("hlim=[0-9]*", "hlim="),
("ttl=[0-9]*", "ttl="),
("time=[0-9.-]*", "time="),
+ ("cp: .*", "cp: xx xx xx xx xx xx xx xx"),
+ ("dp: .*", "dp: xx xx xx xx xx xx xx xx"),
("\(-[0-9\.]+[0-9]+ ms\)", "(- ms)"),
("[0-9\.]+/[0-9.]+", "/"),
]
@@ -1291,6 +1293,39 @@
},
id="_0_0_special_warp",
),
+ pytest.param(
+ {
+ "src": "192.0.2.1",
+ "dst": "192.0.2.2",
+ "icmp_type": 0,
+ "icmp_code": 0,
+ "special": "wrong",
+ },
+ {
+ "returncode": 0,
+ "stdout": """\
+PATTERN: 0x01
+PING 192.0.2.2 (192.0.2.2): 56 data bytes
+64 bytes from: icmp_seq=0 ttl= time= ms
+wrong data byte #55 should be 0x1 but was 0x0
+cp: xx xx xx xx xx xx xx xx
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
+dp: xx xx xx xx xx xx xx xx
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
+
+--- 192.0.2.2 ping statistics ---
+1 packets transmitted, 1 packets received, 0.0% packet loss
+round-trip min/avg/max/stddev = /// ms
+""",
+ "stderr": "",
+ "redacted": True,
+ },
+ id="_0_0_special_wrong",
+ ),
]
@pytest.mark.parametrize("pinger_kargs, expected", pinger_testdata)

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 25, 12:47 PM (17 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35473805
Default Alt Text
D39492.id120111.diff (2 KB)

Event Timeline