Repository navigation
Feature: Network Interface improvements & bug fixes - #3728
Merged
Merged
Conversation
…onfiguration in the model, with tests (R1, T1) ApplyConfiguration and ApplyConfigurationFromProfile duplicated the conversion (CIDR to subnet mask, static DNS without servers falls back to DHCP, secondary DNS becomes primary). Moved to NetworkInterfaceConfig.Create, both use one ApplyConfigurationAsync. The Configure tab no longer changes its own fields while applying. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… IP address / subnet mask (B9) The validators trim the input, the Configure tab and Add IPv4 address passed it to netsh as entered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… not converted to a subnet mask (B10) The validator accepts "24", Configure, profiles and Add IPv4 address only converted "/24" and passed mask=24 to netsh. NetworkInterfaceConfig.ConvertSubnetmaskOrCidr is used by all of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… passed to netsh (S1) IP address, subnet mask, gateway and DNS servers were inserted into the elevated PowerShell/netsh command line without escaping, only the UI validated them. A manipulated profile file could run other commands when the profile was applied. The values are checked in the model (NetworkInterfaceConfig.GetInvalidValue) and the view model shows a localized message. Values of the option that is not used (e.g. a static IP of a DHCP profile) are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sed an empty "gateway=" to netsh (S2) netsh expects an IP address or "none". The commands are built in NetworkInterface.GetConfigureCommands, with tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ter was removed, profile Apply without guards (B4, B5) - A reload selected nothing if the selected adapter was removed (USB/VPN). CanConfigure kept its old value, Apply threw a NullReferenceException before the try and IsConfigurationRunning stayed true. The first adapter is selected instead and CanConfigure is also reset for null. - The commands check IsConfigurationRunning, the selected adapter and (Apply / profile Apply) whether it is connected. Before, only the Apply button was disabled via style triggers, the profile context menu item was not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e (B1) NetworkChange events are raised on a thread pool thread. The reload continued there and created the BandwidthMeter (DispatcherTimer) on a thread without a running dispatcher, so it never ticked. The reload is started on the UI thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d reset the Configure tab (B2) Every reload (network change, Apply, F5) creates new NetworkInterfaceInfo objects. The selection compared by reference and restarted the meter / filled in the defaults although the same interface was selected. Compare the ID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rofile when switching tools (B3) ProfileHostViewModelBase rebuilds the profile list on OnViewVisible / profile changes and selects the same profile again (null first). The override filled in the profile values every time. Only fill them in for another profile (an edited profile is a new object and is filled in again). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… on the Configure tab (B6) ConfigEnableStaticIPAddress set ConfigEnableStaticDNS = true for true and false. Only for a static IP address, like the profile dialog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…disabled, selected option (B11) "Obtain DNS server address automatically" is disabled for a static IP address. Profiles from older or edited files can contain both, the profile dialog and the Configure tab now select static DNS servers in that case (same result when applied: no DNS servers fall back to DHCP). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reload or crashed the app (B7) LoadNetworkInterfaces / ReloadNetworkInterfaces (async void) had no try/finally: IsNetworkInterfaceLoading stayed true or the exception ended the process. Errors are logged, the flag is reset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The button only checked whether IPv4 is available on the adapter, the action returned silently without an address. CanExecute checks for an IPv4 address with subnet mask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, D1, #146) - Profile: "Bind to network interface" + drop-down of the network interfaces of this computer (loaded only when the option is enabled). Stored: NetworkInterface_BindToInterface, _InterfaceId (matched, unique per computer) and _InterfaceName (shown if missing). A bound interface that doesn't exist on this computer is listed as "Not found on this computer" and kept when saving. Save is disabled while no interface is selected. - Apply (profile context menu) uses the bound interface and selects it (to check the result on the Information tab). If it is missing, a dialog shows name + ID and offers to apply to the selected interface (only if connected). - Selecting a bound profile selects its interface. - Docs: profile section explains selecting / applying a profile and the new option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shows the bound network interface and the IP address / subnet mask (or "Obtain an IP address automatically"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Configure tab (M2) "Add profile..." opens the profile dialog with the values of the Configure tab, bound to the selected network interface (name of the interface as profile name, its IPv4 address as host, which is required by every profile). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shows the current configuration of the selected adapter again (after a profile was selected / values were changed). For DHCP (IP / DNS) the static values are cleared instead of keeping the ones of the previously selected adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sabled fields (C2) Same trigger as on the Configure tab: no error template while static IP address / static DNS is not selected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… filter) switched the adapter (CR1) ProfileHostViewModelBase.SetProfilesView selects the previous or first profile again on view visible, search, filter and profile changes. The Network Interface treated it as a user selection: filled in the values (B3 only covered the same profile) and, with #146, switched the network interface and saved it as last selected. IsProfileSelectedByCode (base) marks these selections; only a user selection fills in values / selects the bound interface. Replaces the _prefilledProfile check, so a profile can be selected again after a search cleared it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…DNS for a static IP (CR2) B11 selected static DNS servers in the UI for profiles with a static IP and DHCP DNS, but Apply in the context menu used the stored value and set the DNS servers to DHCP on a static interface (no DNS servers). The rule is in NetworkInterfaceConfig.Create now, used by both apply paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… was removed and added again (CR3) Since B2 the meter is no longer recreated when the same interface is reloaded. The BandwidthMeter kept the System.Net NetworkInterface of its constructor; if reading the statistics fails (adapter removed / re-created with the same ID), it now looks the adapter up again by ID on the next tick (also if it was missing at start). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…changed while another tab was shown (CR4) SetConfigurationDefaults (and the static IP setter) only set one option of each radio button pair and relied on the RadioButton group to uncheck the other one, which only happens while the Configure tab is loaded. Selecting a DHCP adapter on the Information tab left static IP enabled with empty values (Apply / Add profile... used them). Both options are set now; static DNS is also selected for a static IP without DNS servers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… running (CR5) The reload after Apply / Release & Renew / Add / Remove IP address returned early if a reload started by NetworkAddressChanged was running, which may have read the adapters during the change. A reload requested meanwhile now runs once after the current one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…errors (CR6) C2 only covered the TextBoxes; the subnet mask is an editable ComboBox with its own style. Same trigger on the ComboBox in the profile dialog and on the Configure tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…owed an English message (CR7) Only Apply checked GetInvalidValue before the model; Add / Remove IPv4 address showed the (not localized) exception of NetworkInterface.ThrowIfInvalid. All three use ValidateConfiguration now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation after applying a bound profile (CR8) Apply (profile context menu) selects the bound network interface, which filled in its current configuration on the Configure tab. The values of the applied profile are filled in afterwards, so the tab shows what was applied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The subnet mask of a DHCP configuration is discarded anyway (no trim). Use Subnetmask.ConvertCidrToSubnetmask; Subnetmask.ConvertSubnetmaskOrCidrToCidr is not reused because it throws for invalid input, which GetInvalidValue reports. Behaviour unchanged (NetworkInterfaceConfigTests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e not found" dialog (A1) HelpMessage_* strings are the texts of help icons (tooltips). The hint is part of a dialog message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alog looked different (A2) Same item template (name + description in Gray3) as the network interface selection of the tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…methods (A3) Next to SetConfigurationDefaults instead of the variables region. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ddress without DNS servers (N3) "DNS autoconfiguration" (Information tab, export) was only read from the registry: an empty "NameServer" value. It is also empty for a static IP address without DNS servers, which Windows doesn't allow to obtain DNS servers automatically. Tested on Windows: a static IP address without DNS servers (with or without "set dnsservers source=dhcp" / "source=static address=none") has no DNS servers and "DhcpNameServer" is cleared, so the configuration itself was right and is not changed. DNS autoconfiguration now also requires DHCP for the IPv4 address (like the Configure tab), with tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and overrode the user (R8, R9, R10, R11) The request of the run command that waited for a load / configuration (R1, R5) had several problems: - R8: The status message was kept for every waiting request, e.g. the "not found" warning of another profile. - R9: After Apply, the success message was shown next to the values of the waiting profile, which was not applied. - R10: It overrode a profile or network interface selected by the user meanwhile, and filled in the old values of a profile that was changed meanwhile. - R11: Selecting / double-clicking a profile while the network interfaces were loaded (e.g. the tool was just opened) had the problem of R1: "not found" for its bound network interface, the values replaced by the load. Only the load of the network interfaces is waited for, for every way a profile is loaded (selection, double-click, run command): the last one is loaded afterwards, not if the user selected a network interface meanwhile or the profile was changed / deleted. The status message is hidden like for every loaded profile. While a configuration is applied, the run command shows a message dialog (not replaced by the result like a status message) instead of waiting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ut IPv4 (R12) N3 required DHCP for the IPv4 address, which is never enabled if IPv4 is not available (e.g. IPv6 only, DNS servers from router advertisements / DHCPv6): those adapters showed "No" although no static DNS servers are set. DHCP is only required if IPv4 is available, with tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rface" (R13) The profile dialog preselects the network interface saved in the settings (selected by the user or configured), since R2 not the one a profile selected in the tool. The docs said "last selected in the tool". Docs and comment name it exactly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pters were loaded (R14) Apply, Flush DNS, Release & Renew and Add / Remove IPv4 address could run while the network interfaces were (re)loaded. A profile selected or run (run command) during the load waits for it: it was dropped without a message if a configuration had started meanwhile, or hid the result of the configuration when it was loaded afterwards. Configuration actions are disabled while the network interfaces are loaded, like modify vs. refresh in the other tools (e.g. Firewall, Hosts File Editor). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ser actions (R15) A profile selected (or run) while the network interfaces were reloaded was loaded after the reload, also if the user deselected it, selected another profile or reset the Configure tab meanwhile. Waiting is only needed for the first load (the list is empty, the first selection replaces the values): a reload replaces the list at once on the UI thread and keeps the network interface of the profile (preferred, R2). A profile is only deferred during the first load, and any change of the selection by the user drops it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…out IPv4 with static IPv6 DNS servers (R16) The static DNS servers were only read from the IPv4 settings (Tcpip\...\NameServer). For a network adapter without IPv4 (R12: DHCP of IPv4 is not required), static IPv6 DNS servers (Tcpip6\...\NameServer) were not detected and DNS autoconfiguration showed "Yes". The IPv6 settings are read if IPv4 is not available. Changelog entry of N3 extended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st the old adapter list (R17) R15 only deferred a profile during the first load. A reload can add or remove the bound network interface (e.g. a VPN connects, a USB adapter is unplugged): the profile reported it as not found or filled in its values, and the reload then selected another network interface, which replaced them. A profile is deferred during every load again (as in R8-R11), any change of the profile selection by the user still drops it (R15). Reset is disabled while the network interfaces are loaded, like the configuration actions (R14), so a deferred profile can't override it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…own (R18) For an adapter without IPv4 (R16), the static DNS servers are read from Tcpip6\...\NameServer. If the value doesn't exist (DNS servers were never set statically), it was treated as unknown and DNS autoconfiguration showed "No" although the DNS servers are obtained via DHCPv6 / router advertisements. A missing value means no static DNS servers for IPv6 (a missing interface key is still unknown). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
This pull request is merged. |
With --screenshot, Network Interface showed the real adapters of the computer (names, MAC / IP addresses, DNS) and needed administrator rights for the Configure tab. Like the Dashboard, mDNS Discovery and LLDP / CDP Capture: - ScreenshotData.CreateNetworkInterfaces: a connected Ethernet adapter (computer / router of the shared sample home network, locally administered MAC addresses) and a disconnected Wi-Fi adapter. Also used by the profile dialog (Bind to network interface). - The bandwidth chart and statistics are filled with static samples (CreateBandwidthSamples) instead of a measurement. - Configuration actions are available without administrator rights and only show their result (no netsh / ipconfig), the selected adapter is not saved in the settings. Docs (--screenshot) and changelog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… until the adapters were loaded The network interfaces are only loaded when they are needed (Network Interface enabled and the profile bound, N2): a bound profile with Network Interface disabled showed an empty (disabled) drop-down. The bound network interface is shown with its stored name until the list is loaded, which replaces it (or marks it as not found). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Editing a profile replaces it with a new object (ProfileManager.ReplaceProfile). The profile lists (all tools and Settings > Profiles) select the previously selected profile again after the profiles were updated, which no longer existed, so the first profile was selected. ProfileManager remembers the replaced profiles (weak, old -> new) and GetCurrentProfile resolves the edited version, also for lists that are refreshed later (e.g. when a tool is shown). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reset was a text button in the bottom row, between the actions that change the system immediately (Flush DNS cache, Release & Renew, Additional config). It only resets the values of the form, so it is an icon (Undo2, like the reset buttons in the settings) next to the "Configure" header, like the reload button next to the network adapter. The bottom row keeps the system actions, Add profile... and Apply. Docs and changelog entry updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… button The Reset icon is at the right edge of the "Configure" header row, in one column with the reload button of the network adapter selection above (same button width, so both icons are centered on one line). Not aligned with the width of the form (fixed 420 px group boxes): that would need a fixed width for the header or a narrower adapter drop-down. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Add profile..." uses the values of the form, like Apply: it is next to Apply on the right of the bottom row. The actions on the left (Flush DNS cache, Release & Renew, Additional config) change the system right away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
See commits
Related issue
Closes #146
Ref #3722 #3609
Type of change
How has this been tested?