Skip to content

Commit

Permalink
imp - Pinging normally needs no buffer
Browse files Browse the repository at this point in the history
---

To fix a Unix issue where non-superusers are unable to use ping, we need to change the PingAddress() function code so that they don't call the PingAddress() function with buffers.

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Sep 3, 2024
1 parent 8a2ffa5 commit 7123c30
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions Kernel Simulator/Network/NetworkTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,8 @@ public enum SpeedDialType
/// <returns>A ping reply status</returns>
public static PingReply PingAddress(string Address)
{
_ = new Ping();
_ = new PingOptions() { DontFragment = true };
byte[] PingBuffer = Encoding.ASCII.GetBytes("Kernel Simulator");
int Timeout = PingTimeout; // 60 seconds = 1 minute. timeout of Pinger.Send() takes milliseconds.
return PingAddress(Address, Timeout, PingBuffer);
int Timeout = PingTimeout;
return PingAddress(Address, Timeout);
}

/// <summary>
Expand All @@ -81,10 +78,8 @@ public static PingReply PingAddress(string Address)
/// <returns>A ping reply status</returns>
public static PingReply PingAddress(string Address, int Timeout)
{
_ = new Ping();
_ = new PingOptions() { DontFragment = true };
byte[] PingBuffer = Encoding.ASCII.GetBytes("Kernel Simulator");
return PingAddress(Address, Timeout, PingBuffer);
var Pinger = new Ping();
return Pinger.Send(Address, Timeout);
}

/// <summary>
Expand Down Expand Up @@ -255,4 +250,4 @@ public static string GetFilenameFromUrl(string Url)
}

}
}
}

0 comments on commit 7123c30

Please sign in to comment.