Skip to content

[client] Ignore irrelevant route changes to tracked network monitor routes #3796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 9, 2025

Conversation

lixmal
Copy link
Contributor

@lixmal lixmal commented May 6, 2025

Describe your changes

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

@Copilot Copilot AI review requested due to automatic review settings May 6, 2025 17:46
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug by ensuring that irrelevant route changes are ignored for tracked network monitor routes. Key changes include updating the RouteUpdate structure to use a Nexthop type, refining error messages in route monitoring functions, and ensuring proper closure of event channels.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
client/internal/routemanager/systemops/systemops_windows.go Updates RouteUpdate to use a Nexthop type and adjusts logging to reflect this
client/internal/routemanager/systemops/systemops.go Introduces Nexthop methods (Equal and String) for enhanced type handling
client/internal/networkmonitor/monitor.go Adds a defer to close the event channel and adjusts logging for soft interfaces
client/internal/networkmonitor/check_change_windows.go Modifies error messages for route monitor creation
client/internal/networkmonitor/check_change_bsd.go Updates error messages for opening the routing socket
Comments suppressed due to low confidence (3)

client/internal/networkmonitor/monitor.go:42

  • [nitpick] Consider logging the soft interface name (e.g. route.NextHop.Intf.Name) instead of the entire nexthop to improve clarity, as the isSoftInterface check specifically evaluates the interface name.
log.Debugf("Network monitor: ignoring default route change for next hop with soft interface %s", route.NextHop)

client/internal/networkmonitor/check_change_windows.go:16

  • [nitpick] Reinstate a failure indicator in the error message (e.g. 'failed to create route monitor:') to clearly denote an error, which could improve error diagnosis.
return fmt.Errorf("create route monitor: %w", err)

client/internal/networkmonitor/check_change_bsd.go:22

  • [nitpick] Include a failure verb (e.g. 'failed to open routing socket:') in the error message to clearly reflect an error condition and aid troubleshooting.
return fmt.Errorf("open routing socket: %v", err)

hakansa
hakansa previously approved these changes May 7, 2025
Copy link

sonarqubecloud bot commented May 9, 2025

@lixmal lixmal merged commit d5b52e8 into main May 9, 2025
32 checks passed
@lixmal lixmal deleted the make-win-net-monitor-more-resilient branch May 9, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants