Revert "Use System.Net.IPNetwork"

This reverts commit 117d05d288da1d412159a29c0cb8d5c8259e48ae.
This commit is contained in:
Bond_009
2023-11-14 20:21:34 +01:00
parent 0fd36a5bf1
commit 635d67d458
24 changed files with 60 additions and 418 deletions

View File

@@ -5,8 +5,7 @@ using System.Net;
using System.Net.Sockets;
using System.Text.RegularExpressions;
using Jellyfin.Extensions;
using Jellyfin.Networking.Constants;
using Microsoft.AspNetCore.HttpOverrides;
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
namespace MediaBrowser.Common.Net;
@@ -180,7 +179,7 @@ public static partial class NetworkUtils
{
if (TryParseToSubnet(values[a], out var innerResult, negated))
{
tmpResult.Add(innerResult.Value);
tmpResult.Add(innerResult);
}
}
@@ -336,7 +335,7 @@ public static partial class NetworkUtils
/// <returns>The broadcast address.</returns>
public static IPAddress GetBroadcastAddress(IPNetwork network)
{
var addressBytes = network.BaseAddress.GetAddressBytes();
var addressBytes = network.Prefix.GetAddressBytes();
uint ipAddress = BitConverter.ToUInt32(addressBytes, 0);
uint ipMaskV4 = BitConverter.ToUInt32(CidrToMask(network.PrefixLength, AddressFamily.InterNetwork).GetAddressBytes(), 0);
uint broadCastIPAddress = ipAddress | ~ipMaskV4;