Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test-Connection Changes #172

Merged
merged 8 commits into from Jul 1, 2019
Merged

Test-Connection Changes #172

merged 8 commits into from Jul 1, 2019

Conversation

vexx32
Copy link
Contributor

@vexx32 vexx32 commented May 9, 2019

Refer to PowerShell/PowerShell#6768 for existing discussion and Committee decision details.

}

// For -MtuSizeDetect switch
class PingMtuDetect : PingStatus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider just having MtuSize being a member of PingStatus but $null if -DetectMtuSize is not specified?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do this, absolutely. However, that means that the default format view with the default behaviour will always have an empty column.

That strikes me as... Odd? Also, given the cmdlet's current behaviour with -MtuSizeDetect which causes the cmdlet to only send / retrieve a single PingReply (vs default behaviour W/O the switch being to send 4 pings instead) it seems a little better to have this as a separate object type imo.

Definitely open to alternate solutions though!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've reminded me that @powercode has a PR to only show properties of MeasureInfo objects that have values. We can do the same thing here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link me to that? I wasn't aware that the formatter supported this!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PowerShell/PowerShell#7104, this was merged but was reverted

Copy link
Contributor Author

@vexx32 vexx32 May 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we'd need to put at least those methods into the code base for that to happen. @powercode, would you be able to PR just those formatting methods in so that we can make use of them? I'm not familiar with why it was reverted, but I'm sure we could stand to use a feature like that in more places than just here. 🙂

EDIT: Seeing references to a security review. I guess that means we're waiting on a green light from... @PaulHigin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SteveL-MSFT I looked over these again -- I know you opened an issue for it in the PS repo -- and I realize we're going to hit an issue here; the reason this is fairly easily doable for MeasureInfo is that the format used is a List format, not a Table format. Implementing the same thing in a table format is... problematic at best.

Update RFC per Steve's comments
Update MtuSize property type & give default value
1-Draft/RFCNNNN-Test-Connection.md Outdated Show resolved Hide resolved
This name conveys the same thing without being excessively long and causing difficulty effectively formatting the output.
@joeyaiello
Copy link
Contributor

I'm in general support barring the remainder of the discussion the formatting (which again, I think should be newlined for units and nothing else).

@vexx32
Copy link
Contributor Author

vexx32 commented Jun 19, 2019

@SteveL-MSFT @joeyaiello I was reading documentation for PingReply today... found this: https://docs.microsoft.com/en-us/dotnet/api/system.net.networkinformation.pingreply?view=netframework-4.8#remarks

Basically, when we're doing a traceroute (which essentially is done by sending out pings with TTL that increases one at a time so we can determine the hop points) we're always going to get back replies with a status of TtlExpired. This appears to be by design(?), and means that we're always going to have useless values for RoundtripTime, PingOptions, and Buffer.

I can work around this by:

  1. Using a Stopwatch to get reasonably accurate ping latency times.
  2. Explicitly passing in the PingOptions & buffer size values.

This shouldn't be hard to do, but I thought it should be noted. Not sure if it should be in the RFC text itself, let me know if I should add it.

This is why the current implementation can't get response times, etc., from the intermediary hops when doing a trace route -- so we have to basically fill in what we can by what we're sending as well as the directly measurable response time.

Copy link
Contributor Author

@vexx32 vexx32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pointing out a couple things I missed / typo'd in case folks want to comment on the individual items before I incorporate the edits.

1-Draft/RFCNNNN-Test-Connection.md Outdated Show resolved Hide resolved
1-Draft/RFCNNNN-Test-Connection.md Outdated Show resolved Hide resolved
1-Draft/RFCNNNN-Test-Connection.md Outdated Show resolved Hide resolved
1-Draft/RFCNNNN-Test-Connection.md Outdated Show resolved Hide resolved
1-Draft/RFCNNNN-Test-Connection.md Outdated Show resolved Hide resolved
@SteveL-MSFT
Copy link
Member

@vexx32 for the latency times, I think you can just send another ping to the destination along the route

@vexx32
Copy link
Contributor Author

vexx32 commented Jun 21, 2019

@SteveL-MSFT yeah, I considered that... but then we're potentially sending double (or more if the timer ping happens to fail) the number of pings every single time, and that... doesn't seem like a good idea, really?

If I stopwatch.Start(); reply = pinger.Ping(); stopwatch.Stop() it should be sufficiently accurate, no?

Update parameter sets
@joeyaiello
Copy link
Contributor

No quorum today, but after applying your latest comments on missing a property or two, I'm personally good to merge.

@vexx32
Copy link
Contributor Author

vexx32 commented Jun 24, 2019

Sounds good. I'll do a full review of this today or tomorrow. I've been exploring this in code to make sure the RFC makes sense practically and I think there are one or two other things that may need to be updated as well. (Especially regarding my comment that the table formatter can't really handle the variable number of properties as originally suggested.)

Update RFC & examples
@vexx32
Copy link
Contributor Author

vexx32 commented Jun 27, 2019

@joeyaiello @SteveL-MSFT Updated the RFC & included some new examples based on my POC implementation I've been working on. 😄

Test-Connection [-TargetName] <string[]> [-IPv4] [-IPv6] [-ResolveDestination] [-TimeoutSeconds <int>] [-Quiet] [<CommonParameters>]

# Set 1
[-Ping] [-Count <int>] [-Delay <int>] [-Source <string>] [-MaxHops <int>] [-BufferSize <int>] [-DontFragment]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be the default parameter set, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

Copy link
Member

@JamesWTruher JamesWTruher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure why -tcpport is its own parameter set and why it can't just be part of all of the sets.

@joeyaiello
Copy link
Contributor

@PowerShell/powershell-committee voted and is ready to accept. @JamesWTruher had a question above, and I had one around whether -Source will actually work cross-platform (it's currently broken on Core), but we're comfortable handling both in code PR.

@joeyaiello joeyaiello merged commit b4fc60d into PowerShell:master Jul 1, 2019
@vexx32 vexx32 deleted the patch-1 branch July 1, 2019 19:18
@vexx32
Copy link
Contributor Author

vexx32 commented Jul 1, 2019

Sounds good. I have this all implemented in a branch, so I'll send a PR this evening :)

@JamesWTruher -TcpPort current implementation is -Quiet by default, with no other option available. I'm not familiar enough with the low level APIs to know whether ping packets sent to other ports make sense in a traceroute context or with determining MTU size?

@bobfrankly
Copy link

bobfrankly commented Jul 2, 2019

I would like to see a sequence number added to the basic ping output. If you're testing on-prem targets that return consistent (like EXACTLY) stats, the sequence incrementing on the screen can be the difference between "is the ping still running? did the window freeze?" and "no, it's still running, see the sequence?"

Sequence numbers in the pings would also help with looking at the results from a long running ping test. When filtering the return from a long-running test, you could see if the missed pings are grouped or scattered by the sequence numbers.

@joeyaiello
Copy link
Contributor

Unless @vexx32 wants to implement that immediately, I think it's fine to take that up as an issue/PR in PowerShell/PowerShell later.

@vexx32
Copy link
Contributor Author

vexx32 commented Jul 2, 2019

@joeyaiello simple addition, I'm happy to. ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants