[PR #13854] [MERGED] Fix negated IP addresses without subnet mask not being parsed correctly #13738

Closed
opened 2026-02-07 07:18:19 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/13854
Author: @mapret
Created: 4/6/2025
Status: Merged
Merged: 4/9/2025
Merged by: @crobibero

Base: masterHead: parse-negated-address-fix


📝 Commits (1)

  • df41f0c Fix negated IP addresses without subnet mask not being parsed correctly

📊 Changes

2 files changed (+20 additions, -6 deletions)

View changed files

📝 MediaBrowser.Common/Net/NetworkUtils.cs (+16 -5)
📝 tests/Jellyfin.Networking.Tests/NetworkParseTests.cs (+4 -1)

📄 Description

This PR fixes that IP addresses without subnet mask were not being parsed correctly with the bool negated argument of the NetworkUtils.TryParseToSubnet function set to true, which leads to IP addresses from the "LAN networks" setting being classified as excluded in the NetworkManager._excludedSubnets variable, which in turn leads to these IP addresses not being considered local.

Changes

  • Change NetworkUtils.TryParseToSubnet function to also respect the ! character for IP address without subnet
  • Update NetworkParseTests.TryParseValidIPStringsTrue to test with both true and false for the negated parameter of the TryParseToSubnet function

Issue details
This PR fixes an issue which I encountered with the following setup:

  • Jellyfin installed from the debian jellyfin repository
  • Nginx as reverse proxy on the same machine which serves as entrypoint for remote connections
  • Public static IPv4 address and domain name "jellyfin.example.com"
  • Internet streaming bitrate limit set to a relatively small value
  • Known proxies set to "127.0.0.1"
  • LAN networks set to "10.0.0.0/24, 1.2.3.4" (10.0.0.0/24 is my LAN, instead of 1.2.3.4 I use my real public IPv4 address)

The goal of this setup is that when using the hostname "jellyfin.example.com" from within the LAN, I dont want the bitrate limit to apply since my router supports NAT-loopback and the connection speed is not limited by my internet upload speed. But this does not work, since IP addresses without subnets are not parsed correctly.
A workaround is to use "1.2.3.4/32" instead, which is technically equivalent, but it took me some time to figure out why the setup was not working with just "1.2.3.4", since the info text below the "LAN networks" field suggests that IP addresses with and without subnet mask are supported.


🔄 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/13854 **Author:** [@mapret](https://github.com/mapret) **Created:** 4/6/2025 **Status:** ✅ Merged **Merged:** 4/9/2025 **Merged by:** [@crobibero](https://github.com/crobibero) **Base:** `master` ← **Head:** `parse-negated-address-fix` --- ### 📝 Commits (1) - [`df41f0c`](https://github.com/jellyfin/jellyfin/commit/df41f0c4a2f8830f180cce957e84e98560b41d9d) Fix negated IP addresses without subnet mask not being parsed correctly ### 📊 Changes **2 files changed** (+20 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `MediaBrowser.Common/Net/NetworkUtils.cs` (+16 -5) 📝 `tests/Jellyfin.Networking.Tests/NetworkParseTests.cs` (+4 -1) </details> ### 📄 Description This PR fixes that IP addresses without subnet mask were not being parsed correctly with the `bool negated` argument of the `NetworkUtils.TryParseToSubnet` function set to `true`, which leads to IP addresses from the "LAN networks" setting being classified as excluded in the `NetworkManager._excludedSubnets` variable, which in turn leads to these IP addresses not being considered local. **Changes** * Change `NetworkUtils.TryParseToSubnet` function to also respect the ! character for IP address without subnet * Update `NetworkParseTests.TryParseValidIPStringsTrue` to test with both `true` and `false` for the `negated` parameter of the `TryParseToSubnet` function **Issue details** This PR fixes an issue which I encountered with the following setup: * Jellyfin installed from the debian jellyfin repository * Nginx as reverse proxy on the same machine which serves as entrypoint for remote connections * Public static IPv4 address and domain name "jellyfin.example.com" * Internet streaming bitrate limit set to a relatively small value * Known proxies set to "127.0.0.1" * LAN networks set to "10.0.0.0/24, 1.2.3.4" (10.0.0.0/24 is my LAN, instead of 1.2.3.4 I use my real public IPv4 address) The goal of this setup is that when using the hostname "jellyfin.example.com" from within the LAN, I dont want the bitrate limit to apply since my router supports NAT-loopback and the connection speed is not limited by my internet upload speed. But this does not work, since IP addresses without subnets are not parsed correctly. A workaround is to use "1.2.3.4/32" instead, which is technically equivalent, but it took me some time to figure out why the setup was not working with just "1.2.3.4", since the info text below the "LAN networks" field suggests that IP addresses with and without subnet mask are supported. --- <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 07:18:19 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#13738