Skip to content

Explicitly check for TTL expiration when using Ping utility #65312

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

Merged
merged 3 commits into from
Feb 16, 2022

Conversation

rzikm
Copy link
Member

@rzikm rzikm commented Feb 14, 2022

Fixes issue #65065

For some reason, TTL expiration went through the same path as timout expiration. This PR adds code which explicitly checks if TTL occured.

@ghost ghost assigned rzikm Feb 14, 2022
@ghost ghost added the area-System.Net label Feb 14, 2022
@ghost
Copy link

ghost commented Feb 14, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes issue #65065

For some reason, TTL expiration went through the same path as timout expiration. This PR adds code which explicitly checks if TTL occured.

Author: rzikm
Assignees: rzikm
Labels:

area-System.Net

Milestone: -

{
// TTL exceeded may have occured
output = await p.StandardOutput.ReadToEndAsync().ConfigureAwait(false);
if (output.Contains("Time to live exceeded", StringComparison.Ordinal))
Copy link
Member

Choose a reason for hiding this comment

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

This is going to be problematic IMHO. This message may come out localized. I'm wondering if we should accept that we cannot really distinguish the cases with confidence..

cc: @filipnavara @tmds

Copy link
Member

Choose a reason for hiding this comment

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

maybe not. It seems like we explicitly set LC_ALL but dependency on particular text string still worries me little bit.

Copy link
Member

Choose a reason for hiding this comment

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

IMHO it's worth a try. We can check strings in the common implementations (FreeBSD, GNU Inetutils, macOS*). Worst case it will behave the same way as it does now, best case we can provide slightly more accurate result.

However, the code needs to do way more input checking than it does now. The .IndexOf calls may fail to find anything and it would throw ArgumentOutOfRangeException.

Copy link
Member Author

Choose a reason for hiding this comment

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

I realize that the dependency is suboptimal, one of the reason I put up this PR is to check is to check if it gets a hit on CI (I tried both Arch and Ubuntu locally, so I have hopes)

Will add checking of the indices

@rzikm
Copy link
Member Author

rzikm commented Feb 15, 2022

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rzikm rzikm requested a review from wfurt February 15, 2022 17:23
Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

LGTM

@rzikm
Copy link
Member Author

rzikm commented Feb 16, 2022

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rzikm
Copy link
Member Author

rzikm commented Feb 16, 2022

CI Failures seem unrelated:

@rzikm rzikm merged commit a71d6f1 into dotnet:main Feb 16, 2022
@rzikm rzikm removed their assignment Feb 16, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2022
@karelz karelz added this to the 7.0.0 milestone Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System.Net.NetworkInformation.Tests.PingTest.SendPingToExternalHostWithLowTtlTest Failures
4 participants