[PR #5595] [CLOSED] Multiple IP fixes #10571

Closed
opened 2026-02-07 06:22:41 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/5595
Author: @BaronGreenback
Created: 3/22/2021
Status: Closed

Base: masterHead: RemoveInvalidIP


📝 Commits (10+)

  • 588213b Invalid ip masks are now detected.
  • 6dca815 Fixed IP6 subnets
  • 9010744 Update MediaBrowser.Common/Net/IPNetAddress.cs
  • 1eb7fb5 streamlined parsers
  • a65971e Fixed tests
  • f1ff430 Update IPNetAddress.cs
  • 68d5926 Update MediaBrowser.Common/Net/IPHost.cs
  • e4febbe removed trailing spaces
  • e3ac096 Permit /0 on limited IP addresses
  • 912188c Removed IPAddress.None

📊 Changes

15 files changed (+1153 additions, -1265 deletions)

View changed files

📝 Emby.Dlna/Main/DlnaEntryPoint.cs (+5 -3)
📝 Jellyfin.Networking/Configuration/NetworkConfiguration.cs (+20 -0)
📝 Jellyfin.Networking/Manager/NetworkManager.cs (+247 -348)
📝 Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs (+4 -8)
📝 Jellyfin.Server/Program.cs (+1 -1)
📝 MediaBrowser.Common/Net/INetworkManager.cs (+18 -82)
📝 MediaBrowser.Common/Net/IPHost.cs (+123 -171)
📝 MediaBrowser.Common/Net/IPNetAddress.cs (+401 -111)
MediaBrowser.Common/Net/IPObject.cs (+0 -395)
MediaBrowser.Common/Net/IpClassType.cs (+23 -0)
📝 MediaBrowser.Common/Net/NetworkExtensions.cs (+36 -95)
📝 RSSDP/SsdpDevicePublisher.cs (+11 -3)
📝 tests/Jellyfin.Networking.Tests/NetworkManagerTests.cs (+11 -3)
📝 tests/Jellyfin.Networking.Tests/NetworkParseTests.cs (+226 -45)
📝 tests/Jellyfin.Server.Implementations.Tests/LiveTv/HdHomerunHostTests.cs (+27 -0)

📄 Description

Improvement: Altered the code to detect /x subnet values that are invalid. eg. 10.10.10.10/255 or 10.10.10.10/65535 were being treated as valid. (see https://github.com/jellyfin/jellyfin/issues/5545)

Fix: Corrected an parsing issue with IP6 subnets, where 1 character would be removed from the subnet if the address was in [ ] (/127 becomes /12) Thanks to @Ullmie02.

Fix: IPHost names were not being auto resolved if ToString was being called.

Fix: IPAddress.None was being used to represent objects with no addresses. Null is now used. None =

Fix: wrong allowed proxy address applied it hostname is used.

Fix: Some IP6 addresses were being processed with a hardcoded /32 subnet instead or /128

Fix: Possible out of bounds exception due to IPv4 and IPv6 bytes comparisons exceeding allocation resulting in IsInNetwork incorrectly failing.

Fix: On rare occassions a collection might be created and returned before dns lookup has been completed, meaning address lists are invalid.

Includes fixes in: #5773: Permits multiple overlapping IP addresses and a workaround for dotnet networking bug.

Fix: Added networkManager to the mock AutoFixture for HDHomerunHostTests as it crashed IPNetAddress.

Fix: The internal bind address lists could contain external addresses.

Improvement: Added more network testing.

Improvement: Optimised and simplied IPHost.Parse and IPNetAddress.Parse.

Improvement: Normalised IPHost.HostName. ToString() is hostname [ipaddress1,ipaddress2,....] Thanks to @Ullmie02.

Improvement: Detects and handles the live removal of IP6 or IP4 support.

Simplification: Simplified and reduced code base by moving the IPObject code up a level into IPNetAddress.

Optimizations: Implemented suggestions by ReSharper.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/5595 **Author:** [@BaronGreenback](https://github.com/BaronGreenback) **Created:** 3/22/2021 **Status:** ❌ Closed **Base:** `master` ← **Head:** `RemoveInvalidIP` --- ### 📝 Commits (10+) - [`588213b`](https://github.com/jellyfin/jellyfin/commit/588213bf2bc921620ec8c51d3428c3a82aa9bee7) Invalid ip masks are now detected. - [`6dca815`](https://github.com/jellyfin/jellyfin/commit/6dca815e3948aa974bebb4fffc44025adc0204d0) Fixed IP6 subnets - [`9010744`](https://github.com/jellyfin/jellyfin/commit/901074413c396618244e5448d84f2107fb3a33fa) Update MediaBrowser.Common/Net/IPNetAddress.cs - [`1eb7fb5`](https://github.com/jellyfin/jellyfin/commit/1eb7fb5af50530082dd0248414af8136cbe83f83) streamlined parsers - [`a65971e`](https://github.com/jellyfin/jellyfin/commit/a65971ed1d6ce2b380e6ed2a491d2377e2a7477e) Fixed tests - [`f1ff430`](https://github.com/jellyfin/jellyfin/commit/f1ff430e7dc53d3dbc19a91b88b0e0ced63c4dc3) Update IPNetAddress.cs - [`68d5926`](https://github.com/jellyfin/jellyfin/commit/68d5926a75895a1f6266157795b1a9bc345f7f2e) Update MediaBrowser.Common/Net/IPHost.cs - [`e4febbe`](https://github.com/jellyfin/jellyfin/commit/e4febbe6ea6300b103eec863bb1d47459f2640f8) removed trailing spaces - [`e3ac096`](https://github.com/jellyfin/jellyfin/commit/e3ac09659fa37e822781fd301cb539a4dbdec10e) Permit /0 on limited IP addresses - [`912188c`](https://github.com/jellyfin/jellyfin/commit/912188cb2a9e8ff9f567960f222ffb78e428edef) Removed IPAddress.None ### 📊 Changes **15 files changed** (+1153 additions, -1265 deletions) <details> <summary>View changed files</summary> 📝 `Emby.Dlna/Main/DlnaEntryPoint.cs` (+5 -3) 📝 `Jellyfin.Networking/Configuration/NetworkConfiguration.cs` (+20 -0) 📝 `Jellyfin.Networking/Manager/NetworkManager.cs` (+247 -348) 📝 `Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs` (+4 -8) 📝 `Jellyfin.Server/Program.cs` (+1 -1) 📝 `MediaBrowser.Common/Net/INetworkManager.cs` (+18 -82) 📝 `MediaBrowser.Common/Net/IPHost.cs` (+123 -171) 📝 `MediaBrowser.Common/Net/IPNetAddress.cs` (+401 -111) ➖ `MediaBrowser.Common/Net/IPObject.cs` (+0 -395) ➕ `MediaBrowser.Common/Net/IpClassType.cs` (+23 -0) 📝 `MediaBrowser.Common/Net/NetworkExtensions.cs` (+36 -95) 📝 `RSSDP/SsdpDevicePublisher.cs` (+11 -3) 📝 `tests/Jellyfin.Networking.Tests/NetworkManagerTests.cs` (+11 -3) 📝 `tests/Jellyfin.Networking.Tests/NetworkParseTests.cs` (+226 -45) 📝 `tests/Jellyfin.Server.Implementations.Tests/LiveTv/HdHomerunHostTests.cs` (+27 -0) </details> ### 📄 Description **Improvement:** Altered the code to detect /x subnet values that are invalid. eg. 10.10.10.10/255 or 10.10.10.10/65535 were being treated as valid. (see https://github.com/jellyfin/jellyfin/issues/5545) **Fix:** Corrected an parsing issue with IP6 subnets, where 1 character would be removed from the subnet if the address was in [ ] (/127 becomes /12) _Thanks to @Ullmie02._ **Fix:** IPHost names were not being auto resolved if ToString was being called. **Fix:** IPAddress.None was being used to represent objects with no addresses. Null is now used. None = **Fix:** wrong allowed proxy address applied it hostname is used. **Fix:** Some IP6 addresses were being processed with a hardcoded /32 subnet instead or /128 **Fix:** Possible out of bounds exception due to IPv4 and IPv6 bytes comparisons exceeding allocation resulting in IsInNetwork incorrectly failing. **Fix:** On rare occassions a collection might be created and returned before dns lookup has been completed, meaning address lists are invalid. **Includes fixes in: #5773:** Permits multiple overlapping IP addresses and a workaround for dotnet networking bug. **Fix:** Added networkManager to the mock AutoFixture for HDHomerunHostTests as it crashed IPNetAddress. **Fix:** The internal bind address lists could contain external addresses. **Improvement:** Added more network testing. **Improvement:** Optimised and simplied IPHost.Parse and IPNetAddress.Parse. **Improvement:** Normalised IPHost.HostName. ToString() is _hostname [ipaddress1,ipaddress2,....]_ _Thanks to @Ullmie02._ **Improvement:** Detects and handles the live removal of IP6 or IP4 support. **Simplification:** Simplified and reduced code base by moving the IPObject code up a level into IPNetAddress. **Optimizations**: Implemented suggestions by ReSharper. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 06:22:41 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#10571