Powershell: Test-Connection tests: DontFragment not set on result, using gateway address leads to argument null exception

Created on 16 Jun 2020  路  4Comments  路  Source: PowerShell/PowerShell

In CI, the Test-Connection IPv4 with explicit PingOptions test specifies -DontFragment, however the response object has $result.Reply.Options.DontFragment set to $false after execution.

Another issue is that providing the gateway address instead of the hostname on Windows and Linux CI platforms leads to an ArgumentNullException which does not seem to reproduce locally.

Area-Cmdlets-Utility Issue-Question

Most helpful comment

I've mainly opened this issue to track things I hit when fixing up the CI tests, since getting CI back to passing was my responsibility last week.

@vexx32 and @iSazonov it's clear you've done a lot of work in this area, so thank you so much for that. It also sounds like this might be an opportunity for us to speak to the .NET team -- it might be worth discussing with @SteveL-MSFT what .NET APIs we are experiencing issues with and make a list of any we might want prioritised

All 4 comments

@rjmholt I thought we had a known issue for the first one, not sure where it is at the moment, but... yeah I knew about that one. IIRC you'll see it in the test file somewhere as part of the tests for that parameter too. It's the .NET API ignoring the requested setting (presumably because it's not actually supported on Unix yet).

aka welcome to the wacky world of .NET's rather lacking support/compat/functionality for its base networking APIs 馃槙

I've mainly opened this issue to track things I hit when fixing up the CI tests, since getting CI back to passing was my responsibility last week.

@vexx32 and @iSazonov it's clear you've done a lot of work in this area, so thank you so much for that. It also sounds like this might be an opportunity for us to speak to the .NET team -- it might be worth discussing with @SteveL-MSFT what .NET APIs we are experiencing issues with and make a list of any we might want prioritised

Probably best to look through the code to be sure, but from memory, we mainly use Ping, Dns, and TcpClient classes in Test-Connection currently... and iirc they all have their own problems. DNS was the most stable thing until it started failing recently, actually. 馃槀


Wishlist (from memory, I'm sure I'll forget some):

  • Ping sent with a maximum hop count (aka Ttl) actually works on Non-Windows OS's (intermediate hops come back with no usable data, all reporting TimedOut and the maximum response time for every single node in the network until it reaches the target machine). Windows reports TtlExpired with a proper response time given.
  • Ping should never surface native exceptions and instead should reflect errors either in an appropriate .NET exception or just the ping reply status field, IIRC there are still a fair few cases where it will, especially on Unix.
  • Ping should support a properly _cancellable_ SendAsync() API, currently we have to implement our own cancellation, and even that doesn't seem to be properly cancellable for long timeouts, if memory serves...
  • Ping sent with DontFragment option set a) actually respects the option properly, and b) actually works / reports proper errors on non-Windows OS. If you look at the current code we essentially have to catch all exceptions instead of just the appropriate one which we can easily determine on Windows; on Unix IIRC we get either native or nonspecific exceptions thrown.

    • The DontFragment option should be reflected in the returned ping reply object's PingOptions data, currently it is not.

  • TCP support a maximum hop count; from reading up on TCP protocols it seems this _could_ be supported but simply... isn't... in .NET's TcpClient implementation. (Folks have asked a fair few times for -Traceroute -TcpPort $x support in the cmdlet, this would be a hard requirement for it.)
Was this page helpful?
0 / 5 - 0 ratings