TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException
QPM limit IPv6 prefix valid range is between 0 and 128.
Error message
QPM limit IPv6 prefix valid range is between 0 and 128.
What it means
Thrown by the QpmPrefixLimitsIPv6 property setter when any dictionary key (IPv6 prefix length) is outside 0-128. IPv6 addresses are 128 bits, so prefix lengths beyond that are invalid. Each entry is validated in a loop.
Source
Thrown at DnsServerCore/Dns/DnsServer.cs:7449
public IReadOnlyDictionary<int, (int, int)> QpmPrefixLimitsIPv6
{
get { return _qpmPrefixLimitsIPv6; }
set
{
if (value is null)
{
_qpmPrefixLimitsIPv6 = new Dictionary<int, (int, int)>();
}
else if (value.Count > byte.MaxValue)
{
throw new ArgumentOutOfRangeException(nameof(QpmPrefixLimitsIPv6), "QPM Prefix Limits for IPv6 cannot have more than 255 entries.");
}
else
{
foreach (KeyValuePair<int, (int, int)> qpmPrefixLimit in value)
{
if ((qpmPrefixLimit.Key < 0) || (qpmPrefixLimit.Key > 128))
throw new ArgumentOutOfRangeException(nameof(QpmPrefixLimitsIPv6), "QPM limit IPv6 prefix valid range is between 0 and 128.");
if ((qpmPrefixLimit.Value.Item1 < 0) || (qpmPrefixLimit.Value.Item2 < 0))
throw new ArgumentOutOfRangeException(nameof(QpmPrefixLimitsIPv6), "QPM limit value cannot be less than 0.");
}
_qpmPrefixLimitsIPv6 = value;
}
ResetQpsLimitTimer();
}
}
public int QpmLimitSampleMinutes
{
get { return _qpmLimitSampleMinutes; }
set
{
if ((value < 1) || (value > 60))View on GitHub (pinned to d0484b6c1e)
Solutions
- Ensure all keys are integers in the range 0-128 inclusive.
- Filter out-of-range keys before assignment.
Example fix
// before
server.QpmPrefixLimitsIPv6 =
new Dictionary<int,(int,int)> { { 200, (100, 200) } }; // throws
// after
server.QpmPrefixLimitsIPv6 =
new Dictionary<int,(int,int)> { { 64, (100, 200) } }; Defensive patterns
Strategy: validation
Validate before calling
foreach (var key in qpmV6.Keys)
if (key < 0 || key > 128)
throw new InvalidOperationException($"Invalid IPv6 prefix key: {key}");
server.QpmPrefixLimitsIPv6 = qpmV6; Type guard
static bool IsValidV6PrefixKey(int key) => key >= 0 && key <= 128;
Try / catch
try { server.QpmPrefixLimitsIPv6 = qpmV6; }
catch (ArgumentOutOfRangeException) { qpmV6 = qpmV6.Where(kv => kv.Key >= 0 && kv.Key <= 128).ToDictionary(k=>k.Key,v=>v.Value); server.QpmPrefixLimitsIPv6 = qpmV6; } Prevention
- Validate keys are in 0-128 before building.
- Do not pass IPv4 prefix lists to the IPv6 property.
When it happens
Trigger: Assigning QpmPrefixLimitsIPv6 a dictionary containing a key < 0 or > 128.
Common situations: Passing IPv4-style limits to the IPv6 property by mistake; off-by-one or typo in config; a negative value from a computation.
Related errors
- QPM limit IPv4 prefix valid range is between 0 and 32.
- QPM limit value cannot be less than 0.
- QPM Prefix Limits for IPv6 cannot have more than 255 entries
- QPM Prefix Limits for IPv4 cannot have more than 255 entries
- Valid range is between 1 and 60 minutes.
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/39b3c5d35ed9845a.
Report an issue: GitHub.