Description
On Linux, non-privileged processes cannot send raw IP packets and Ping functionality is implemented by interfacing with the ping utility. This utility, however, does not support specifying custom payload for the ICMP ping packets so the payload provided by user code was ignored.
PR dotnet/runtime#64625 introduced a check which throws an exception in such cases.
Original issue: dotnet/runtime#62458
Version
.NET 7 Preview 2
Previous behavior
Ping packet payload is silently ignored (i.e. not sent) on non-privileged Linux processes.
New behavior
Attempt to send custom payload when running in non-privileged Linux process leads to PlatformNotSupportedException being thrown.
Type of breaking change
Reason for change
It is better to signal to the user that the operation cannot be performed instead of silently dropping the payload.
Recommended action
If ping payload is necessary, run application as root or grant cap_net_raw capability using setcap utility.
Otherwise, use an overload of Ping.SendPingAsync which does not accept the custom payload, or pass in an empty array.
Feature area
Networking
Affected APIs
All overloads of the following methods which accept byte[] buffer parameter
Ping.Send
Ping.SendAsync
Ping.SendPingAsync
Description
On Linux, non-privileged processes cannot send raw IP packets and Ping functionality is implemented by interfacing with the
pingutility. This utility, however, does not support specifying custom payload for the ICMP ping packets so the payload provided by user code was ignored.PR dotnet/runtime#64625 introduced a check which throws an exception in such cases.
Original issue: dotnet/runtime#62458
Version
.NET 7 Preview 2
Previous behavior
Ping packet payload is silently ignored (i.e. not sent) on non-privileged Linux processes.
New behavior
Attempt to send custom payload when running in non-privileged Linux process leads to
PlatformNotSupportedExceptionbeing thrown.Type of breaking change
Reason for change
It is better to signal to the user that the operation cannot be performed instead of silently dropping the payload.
Recommended action
If ping payload is necessary, run application as
rootor grantcap_net_rawcapability usingsetcaputility.Otherwise, use an overload of
Ping.SendPingAsyncwhich does not accept the custom payload, or pass in an empty array.Feature area
Networking
Affected APIs
All overloads of the following methods which accept
byte[] bufferparameterPing.Send
Ping.SendAsync
Ping.SendPingAsync