Commit c96e67f
committed
fix(net-network-information): Ping correlates its reply and reports a refused socket option (#2194)
sendPingCore accepted the FIRST datagram on its socket without correlating it to the request it
had just sent, and every setsockopt discarded its return value, so an option the kernel rejected
was silently not applied. Landed under SA-5.
THE BLOCKER WAS ENVIRONMENTAL AND IS GONE. #2194 was blocked as unexercisable: "every send fails
at socket creation because ping_group_range is '1 0'". This container's range is now
'0 2147483647', SOCK_DGRAM/IPPROTO_ICMP opens, and a real loopback round trip succeeds --
measured before implementing anything. No raw-socket fallback was added; #1962 is untouched, as
the ticket instructs.
THE ACCEPTANCE CRITERION IS WRONG ON TWO OF ITS THREE FIELDS, both measured:
- IDENTIFIER -- cannot be matched. On a Linux ping socket the kernel REWRITES it: probed, a
request written with id 0x1234 came back as 0x94d4 (the socket's own port). .NET checks the
identifier (Ping.RawSocket.cs:230) because its RAW path writes an id the kernel leaves
alone; here that check would reject every reply.
- SOURCE ADDRESS -- must not be matched. .NET does not check it either: it reports
socketConfig.EndPoint.Address, the address it SENT to (:245). Requiring the source to equal
the destination would reject the legitimate error replies that come from an intermediate
router -- TimeExceeded above all, which is exactly what a caller setting a low Ttl wants.
- SEQUENCE -- matched. It survives the ping socket unchanged (probed 0x5678 out, 0x5678 back).
An ICMP error quotes the original request after its own header, so the sequence is read from the
quoted request -- the same rule .NET follows (:166-190). The read loop keeps the ORIGINAL
deadline across skips, so a busy socket cannot extend the call without bound.
Ttl = 256 is the reachable option door and that is measured: PingOptions rejects only ttl <= 0,
which is .NET's own bound, so 0 never reaches a socket, while 256 passes the type and IP_TTL
refuses it with EINVAL.
Mutations: 4, 2 caught -- and THE TWO THAT WERE NOT ARE THE INFORMATIVE ONES.
- Computing the correlation and ignoring it changes nothing here, which EXPOSED A VACUOUS TEST
OF MINE: a first case claimed to prove the skip by putting an unrelated echo on the wire, and
it proves nothing, because a Linux ping socket is demultiplexed by the identifier the KERNEL
assigned -- a reply belonging to another socket is never queued on ours. So the check is
DEFENSIVE on this platform. It is kept because #1962 would add a raw-socket fallback, and a
raw ICMP socket receives EVERY ICMP datagram on the host, at which point it becomes
essential. The test was rewritten to assert what it actually establishes, and both it and
Ping.cpp say so.
- Restarting the deadline on every foreign datagram cannot be caught deterministically:
observing it needs a sustained flood plus a wall-clock assertion, and under the mutation the
call would HANG rather than fail -- flaky and useless, the shape #2352 and #2105 were
repaired for.
Gate: 17,402 run, 17,402 passed, 0 failed, 0 skipped across 38 executables (+4, in
SharpRuntimeTests_Net_NetworkInformation, 63 -> 67). Built in build/ with --parallel 2.
Downstream: zero System::Net::NetworkInformation::Ping sites in cna and mobile-eggbert (the four
text matches are unrelated third-party enet/SDL code).
docs/Migration-PingReplyCorrelation.md1 parent dba5ace commit c96e67f
5 files changed
Lines changed: 331 additions & 6 deletions
File tree
- docs
- modules/net-network-information
- src/System/Net/NetworkInformation
- tests/System/Net/NetworkInformation
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
Lines changed: 116 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
183 | 252 | | |
184 | 253 | | |
185 | 254 | | |
186 | 255 | | |
187 | 256 | | |
188 | 257 | | |
189 | | - | |
| 258 | + | |
190 | 259 | | |
191 | | - | |
| 260 | + | |
192 | 261 | | |
193 | 262 | | |
194 | | - | |
| 263 | + | |
195 | 264 | | |
196 | 265 | | |
197 | 266 | | |
| |||
210 | 279 | | |
211 | 280 | | |
212 | 281 | | |
213 | | - | |
| 282 | + | |
214 | 283 | | |
215 | 284 | | |
216 | 285 | | |
| |||
289 | 358 | | |
290 | 359 | | |
291 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
292 | 382 | | |
293 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
294 | 405 | | |
295 | 406 | | |
296 | 407 | | |
| |||
0 commit comments