Skip to content

Commit 4ae1f70

Browse files
authored
Ping breaking change (#28788)
1 parent 6bc5460 commit 4ae1f70

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

docs/core/compatibility/7.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ If you're migrating an app to .NET 7, the breaking changes listed here might aff
3737
| Title | Binary compatible | Source compatible | Introduced |
3838
| - | :-: | :-: | - |
3939
| [AllowRenegotiation default is false](networking/7.0/allowrenegotiation-default.md) ||| Preview 3 |
40+
| [Custom ping payloads on Linux](networking/7.0/ping-custom-payload-linux.md) || ✔️ | Preview 2 |
4041

4142
## Serialization
4243

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: "Breaking change: Custom ping payloads on Linux"
3+
description: Learn about the .NET 7 breaking change in networking where an exception is thrown on non-privileged Linux processes when a custom payload is passed to the Ping method.
4+
ms.date: 03/23/2022
5+
---
6+
# Custom ping payloads on Linux
7+
8+
On Linux, non-privileged processes can't send raw IP packets. <xref:System.Net.NetworkInformation.Ping> functionality is implemented by interfacing with the `ping` utility. However, this utility doesn't support specifying a custom payload for the Internet Control Message Protocol (ICMP) ping packets. NET 7 adds a check for such cases and throws an exception if a custom payload is specified.
9+
10+
## Previous behavior
11+
12+
In previous versions, the ping packet payload was silently ignored (that is, it wasn't sent) on non-privileged Linux processes.
13+
14+
## New behavior
15+
16+
Starting in .NET 7, a <xref:System.PlatformNotSupportedException> is thrown if you attempt to send a custom ping packet payload when running in non-privileged Linux process.
17+
18+
## Version introduced
19+
20+
.NET 7 Preview 2
21+
22+
## Type of breaking change
23+
24+
This change can affect [binary compatibility](../../categories.md#binary-compatibility).
25+
26+
## Reason for change
27+
28+
It's better to signal to the user that the operation cannot be performed instead of silently dropping the payload.
29+
30+
## Recommended action
31+
32+
If a ping payload is necessary, run the application as `root`, or grant the `cap_net_raw` capability using the `setcap` utility.
33+
34+
Otherwise, use an overload of <xref:System.Net.NetworkInformation.Ping.SendPingAsync%2A?displayProperty=nameWithType> that does not accept a custom payload, or pass in an empty array.
35+
36+
## Affected APIs
37+
38+
- <xref:System.Net.NetworkInformation.Ping.Send(System.Net.IPAddress,System.Int32,System.Byte[],System.Net.NetworkInformation.PingOptions)?displayProperty=fullName>
39+
- <xref:System.Net.NetworkInformation.Ping.Send(System.Net.IPAddress,System.Int32,System.Byte[])?displayProperty=fullName>
40+
- <xref:System.Net.NetworkInformation.Ping.Send(System.String,System.Int32,System.Byte[],System.Net.NetworkInformation.PingOptions)?displayProperty=fullName>
41+
- <xref:System.Net.NetworkInformation.Ping.Send(System.String,System.Int32,System.Byte[])?displayProperty=fullName>
42+
- <xref:System.Net.NetworkInformation.Ping.SendAsync(System.Net.IPAddress,System.Int32,System.Byte[],System.Net.NetworkInformation.PingOptions,System.Object)?displayProperty=fullName>
43+
- <xref:System.Net.NetworkInformation.Ping.SendAsync(System.Net.IPAddress,System.Int32,System.Byte[],System.Object)?displayProperty=fullName>
44+
- <xref:System.Net.NetworkInformation.Ping.SendAsync(System.String,System.Int32,System.Byte[],System.Net.NetworkInformation.PingOptions,System.Object)?displayProperty=fullName>
45+
- <xref:System.Net.NetworkInformation.Ping.SendAsync(System.String,System.Int32,System.Byte[],System.Object)?displayProperty=fullName>
46+
- <xref:System.Net.NetworkInformation.Ping.SendPingAsync(System.Net.IPAddress,System.Int32,System.Byte[],System.Net.NetworkInformation.PingOptions)?displayProperty=fullName>
47+
- <xref:System.Net.NetworkInformation.Ping.SendPingAsync(System.Net.IPAddress,System.Int32,System.Byte[])?displayProperty=fullName>
48+
- <xref:System.Net.NetworkInformation.Ping.SendPingAsync(System.String,System.Int32,System.Byte[],System.Net.NetworkInformation.PingOptions)?displayProperty=fullName>
49+
- <xref:System.Net.NetworkInformation.Ping.SendPingAsync(System.String,System.Int32,System.Byte[])?displayProperty=fullName>

docs/core/compatibility/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ items:
5151
items:
5252
- name: AllowRenegotiation default is false
5353
href: networking/7.0/allowrenegotiation-default.md
54+
- name: Custom ping payloads on Linux
55+
href: networking/7.0/ping-custom-payload-linux.md
5456
- name: Serialization
5557
items:
5658
- name: Deserialize Version type with leading or trailing whitespace
@@ -895,6 +897,8 @@ items:
895897
items:
896898
- name: AllowRenegotiation default is false
897899
href: networking/7.0/allowrenegotiation-default.md
900+
- name: Custom ping payloads on Linux
901+
href: networking/7.0/ping-custom-payload-linux.md
898902
- name: .NET 6
899903
items:
900904
- name: Port removed from SPN

0 commit comments

Comments
 (0)