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

Ping class acts differently on Linux vs Windows #99838

Closed
rjrizzuto opened this issue Mar 14, 2024 · 12 comments
Closed

Ping class acts differently on Linux vs Windows #99838

rjrizzuto opened this issue Mar 14, 2024 · 12 comments
Assignees
Milestone

Comments

@rjrizzuto
Copy link

When I set a TTL of 1 (to implement traceroute functionality), I get TimedOut with an address of 0.0.0.0 on Linux. On Windows, I get the expected TtlExpired with the IP address of my router.

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 14, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Mar 14, 2024
@rjrizzuto
Copy link
Author

Using Wireshark I can confirm that the ping request is properly formatted, and an immediate Time-to-live exceeded message is returned by my router. However, my application returned a timeout status 5 seconds after the initial request. It seems like the Ping class is not processing the message from the router.

@CarnaViire CarnaViire transferred this issue from dotnet/dotnet-api-docs Mar 15, 2024
@CarnaViire CarnaViire added area-System.Net and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Mar 15, 2024
@CarnaViire
Copy link
Member

cc @dotnet/ncl

@wfurt
Copy link
Member

wfurt commented Mar 15, 2024

looks like dup of #73232

@rjrizzuto
Copy link
Author

I am not sure. That ticket is talking about containers. My issue is on Linux mint 21.3,. Net 8 with sudo for raw socket access.

@wfurt
Copy link
Member

wfurt commented Mar 16, 2024

do you have any simple repro you can share @rjrizzuto? That would simplify the investigation.

@wfurt
Copy link
Member

wfurt commented Mar 16, 2024

(and what .NET version do you use)

@rjrizzuto
Copy link
Author

rjrizzuto commented Mar 16, 2024

dotnet --version reports 8.0.103

This is the simple test code I wrote:

using System.Net.NetworkInformation;

var X = new Ping();
var options = new PingOptions(1, true);
byte[] buffer = new byte[0];
var reply = X.Send("8.8.8.8",5000,buffer,options);
Console.WriteLine(reply.Address.ToString());
Console.WriteLine(reply.Status.ToString());

Here's what I see on my Linux system:

ay@Green-lantern:~/Dotnet Projects/Test/Test/bin/Release/net8.0/linux-x64$ sudo ./Test
[sudo] password for ray:
0.0.0.0
TimedOut

@kasperk81
Copy link
Contributor

copy paste error after "Here's what I see on my Linux system:"?

@rjrizzuto
Copy link
Author

My bad. It's fixed now.

@rjrizzuto
Copy link
Author

On Windows 11, the same code outputs this:

192.168.86.1
TtlExpired

That is the expected behavior.

@wfurt wfurt removed the untriaged New issue has not been triaged by the area owner label Mar 19, 2024
@wfurt wfurt self-assigned this Mar 19, 2024
@wfurt wfurt added this to the 9.0.0 milestone Mar 19, 2024
@wfurt
Copy link
Member

wfurt commented Apr 16, 2024

fixed by #99875

@wfurt wfurt closed this as completed Apr 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants