Skip to content

Conversation

@lixmal
Copy link
Collaborator

@lixmal lixmal commented Oct 23, 2025

Describe your changes

This marks routes with the flag RTF_PROTO1 (configurable via NB_ROUTE_PROTO_FLAG env) so they can be removed even if the state file is corrupted or unavailable.

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)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Copilot AI review requested due to automatic review settings October 23, 2025 14:53
Copy link
Contributor

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 implements independent cleanup of BSD routes by marking them with a configurable RTF_PROTO flag, allowing route removal even when the state file is corrupted or unavailable.

  • Routes are now marked with RTF_PROTO1 flag (configurable via NB_ROUTE_PROTO_FLAG environment variable)
  • New FlushMarkedRoutes() method removes all marked routes independently of the state file
  • Renamed NewSysOps() to New() for consistency

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
client/server/state.go Calls FlushMarkedRoutes during residual state restoration for non-advanced routing
client/internal/statemanager/manager.go Improved debug message to include file path
client/internal/routemanager/systemops/systemops_unix.go Adds route marking logic, FlushMarkedRoutes implementation, and configurable RTF_PROTO flag
client/internal/routemanager/systemops/systemops_generic_test.go Updates test calls to use renamed New() function
client/internal/routemanager/systemops/systemops_bsd_test.go Updates test calls to use renamed New() function
client/internal/routemanager/systemops/systemops.go Renames NewSysOps to New
client/internal/routemanager/systemops/state.go Updates cleanup code to use New() and fixes variable naming
client/internal/routemanager/systemops/flush_nonbsd.go Provides no-op FlushMarkedRoutes implementation for non-BSD platforms
client/internal/routemanager/manager.go Updates manager initialization to use renamed New() function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sonarqubecloud
Copy link

@lixmal lixmal merged commit eddea14 into main Oct 27, 2025
49 of 51 checks passed
@lixmal lixmal deleted the bsd-route-cleanup branch October 27, 2025 17:54
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.

3 participants