Skip to content

Commit

Permalink
Linux legacy routing (#1774)
Browse files Browse the repository at this point in the history
* Add Linux legacy routing if ip rule functionality is not available

* Ignore exclusion route errors if host has no route

* Exclude iOS from route manager

* Also retrieve IPv6 routes

* Ignore loopback addresses not being in the main table

* Ignore "not supported" errors on cleanup

* Fix regression in ListenUDP not using fwmarks
  • Loading branch information
lixmal committed Apr 3, 2024
1 parent 7938295 commit bb0d5c5
Show file tree
Hide file tree
Showing 9 changed files with 655 additions and 568 deletions.
6 changes: 5 additions & 1 deletion client/internal/routemanager/routemanager.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//go:build !android
//go:build !android && !ios

package routemanager

import (
"errors"
"fmt"
"net/netip"
"sync"
Expand Down Expand Up @@ -53,6 +54,9 @@ func (rm *RouteManager) AddRouteRef(connID nbnet.ConnectionID, prefix netip.Pref
if ref.count == 0 {
log.Debugf("Adding route for prefix %s", prefix)
nexthop, intf, err := rm.addRoute(prefix)
if errors.Is(err, errRouteNotFound) {
return nil
}
if err != nil {
return fmt.Errorf("failed to add route for prefix %s: %w", prefix, err)
}
Expand Down

0 comments on commit bb0d5c5

Please sign in to comment.