Skip to content

[client, android] Do not propagate empty routes #3805

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 2 commits into from
May 13, 2025
Merged

Conversation

pappz
Copy link
Contributor

@pappz pappz commented May 9, 2025

Describe your changes

If we get domain routes the Network prefix variable in route structure will be invalid (engine.go:1057). When we handower to Android the routes, we must to filter out the domain routes. If we do not do it the Android code will get "invalid prefix" string as a route.

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 9, 2025 11:27
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 an issue where domain routes were being propagated to the Android client by filtering out invalid network routes.

  • Added a filter in the route processing to exclude routes with invalid network prefixes before handing them off to Android.

@@ -32,6 +32,10 @@ func (n *Notifier) SetListener(listener listener.NetworkChangeListener) {
func (n *Notifier) SetInitialClientRoutes(clientRoutes []*route.Route) {
nets := make([]string, 0)
for _, r := range clientRoutes {
// filter out domain routes
if !r.Network.IsValid() {
Copy link
Preview

Copilot AI May 9, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding a debug log statement when filtering out an invalid route. This would help in troubleshooting by providing visibility into which routes are being filtered out at runtime.

Suggested change
if !r.Network.IsValid() {
if !r.Network.IsValid() {
log.Printf("Filtering out invalid route: %v", r.Network)

Copilot uses AI. Check for mistakes.

Copy link

sonarqubecloud bot commented May 9, 2025

@pappz pappz merged commit ee1cec4 into main May 13, 2025
32 checks passed
@pappz pappz deleted the fix/android-routes branch May 13, 2025 13:21
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