File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/libraries/System.Net.Ping/tests/FunctionalTests Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -565,6 +565,11 @@ public async Task SendPingWithIPAddressAndBigSize()
565
565
{
566
566
IPAddress localIpAddress = TestSettings . GetLocalIPAddress ( ) ;
567
567
568
+ if ( ! ( Capability . CanUseRawSockets ( localIpAddress . AddressFamily ) || PlatformDetection . IsOSXLike ) )
569
+ {
570
+ throw new SkipTestException ( "Underprivileged process cannot specify ping payload." ) ;
571
+ }
572
+
568
573
using ( Ping p = new Ping ( ) )
569
574
{
570
575
// Assert.DoesNotThrow
@@ -575,8 +580,7 @@ public async Task SendPingWithIPAddressAndBigSize()
575
580
//
576
581
// On Windows 10 the maximum ping size seems essentially limited to 65500 bytes and thus any buffer
577
582
// size on the loopback ping succeeds. On macOS anything bigger than 8184 will report packet too
578
- // big error. On Linux/Unix the result differs for privileged and unprivileged processes and may
579
- // change with different platform versions.
583
+ // big error.
580
584
if ( OperatingSystem . IsMacOS ( ) )
581
585
{
582
586
Assert . Equal ( IPStatus . PacketTooBig , pingReply . Status ) ;
@@ -753,7 +757,7 @@ public async Task SendPingAsyncWithHostAndTtlAndFragmentPingOptions(bool fragmen
753
757
{
754
758
IPAddress [ ] localIpAddresses = await TestSettings . GetLocalIPAddressesAsync ( ) ;
755
759
756
- byte [ ] buffer = TestSettings . PayloadAsBytes ;
760
+ byte [ ] buffer = GetPingPayloadForUnix ( localIpAddresses [ 0 ] . AddressFamily ) ;
757
761
758
762
PingOptions options = new PingOptions ( ) ;
759
763
options . Ttl = 32 ;
You can’t perform that action at this time.
0 commit comments