From 5adf2d0f877bfb88421fee6332c694ecc947c6c2 Mon Sep 17 00:00:00 2001 From: Johan Andreas Drewsen Geday Date: Tue, 8 Nov 2022 13:58:23 +0100 Subject: [PATCH] While replicating fail over: now stores options in dictionary with keys being VendorNames instead of OptionId's (since there can be multiple options of same option Id) --- src/Dhcp/DhcpServerScope.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Dhcp/DhcpServerScope.cs b/src/Dhcp/DhcpServerScope.cs index 697a078..08a69b3 100644 --- a/src/Dhcp/DhcpServerScope.cs +++ b/src/Dhcp/DhcpServerScope.cs @@ -362,11 +362,11 @@ internal void ReplicateTo(DhcpServerScope destinationScope) destinationScope.ExcludedIpRanges.AddExcludedIpRange(range); // replicate option values - var destOptions = ((DhcpServerScopeOptionValueCollection)destinationScope.Options).GetOptionValues(includeDnsSettingsOption: true).ToDictionary(o => o.OptionId); - var srcOptions = ((DhcpServerScopeOptionValueCollection)Options).GetOptionValues(includeDnsSettingsOption: true).ToDictionary(o => o.OptionId); + var destOptions = ((DhcpServerScopeOptionValueCollection)destinationScope.Options).GetOptionValues(includeDnsSettingsOption: true).ToDictionary(o => o.VendorName); + var srcOptions = ((DhcpServerScopeOptionValueCollection)Options).GetOptionValues(includeDnsSettingsOption: true).ToDictionary(o => o.VendorName); // remove option values foreach (var optionId in destOptions.Keys.Except(srcOptions.Keys)) - destinationScope.Options.RemoveOptionValue(optionId); + destinationScope.Options.RemoveOptionValue(destOptions[optionId].OptionId); // add option values foreach (var optionId in srcOptions.Keys.Except(destOptions.Keys)) destinationScope.Options.AddOrSetOptionValue(srcOptions[optionId]);