ipn/ipnlocal: remove the pointer from appc.RouteInfo

Change-Id: I77ddb19619f45d93ffbf2f8981d59506e347706b
This commit is contained in:
M. J. Fromberger 2025-09-17 12:58:56 -07:00
parent 9e4c16292a
commit aeeb434576
2 changed files with 5 additions and 7 deletions

View File

@ -651,9 +651,7 @@ func (b *LocalBackend) consumeEventbusTopics() {
// Whether or not routes should be stored can change over time. // Whether or not routes should be stored can change over time.
shouldStoreRoutes := b.ControlKnobs().AppCStoreRoutes.Load() shouldStoreRoutes := b.ControlKnobs().AppCStoreRoutes.Load()
if shouldStoreRoutes { if shouldStoreRoutes {
// TODO(creachdadair, 2025-09-13): This is a pointer for historical if err := b.storeRouteInfo(ri); err != nil {
// reasons, which should go away along with the callback.
if err := b.storeRouteInfo(&ri); err != nil {
b.logf("appc: failed to store route info: %v", err) b.logf("appc: failed to store route info: %v", err)
} }
} }
@ -7414,7 +7412,7 @@ func namespaceKeyForCurrentProfile(pm *profileManager, key ipn.StateKey) ipn.Sta
const routeInfoStateStoreKey ipn.StateKey = "_routeInfo" const routeInfoStateStoreKey ipn.StateKey = "_routeInfo"
func (b *LocalBackend) storeRouteInfo(ri *appc.RouteInfo) error { func (b *LocalBackend) storeRouteInfo(ri appc.RouteInfo) error {
b.mu.Lock() b.mu.Lock()
defer b.mu.Unlock() defer b.mu.Unlock()
if b.pm.CurrentProfile().ID() == "" { if b.pm.CurrentProfile().ID() == "" {

View File

@ -2534,7 +2534,7 @@ func TestBackfillAppConnectorRoutes(t *testing.T) {
// Store the test IP in profile data, but not in Prefs.AdvertiseRoutes. // Store the test IP in profile data, but not in Prefs.AdvertiseRoutes.
b.ControlKnobs().AppCStoreRoutes.Store(true) b.ControlKnobs().AppCStoreRoutes.Store(true)
if err := b.storeRouteInfo(&appc.RouteInfo{ if err := b.storeRouteInfo(appc.RouteInfo{
Domains: map[string][]netip.Addr{ Domains: map[string][]netip.Addr{
"example.com": {ip}, "example.com": {ip},
}, },
@ -5485,10 +5485,10 @@ func TestReadWriteRouteInfo(t *testing.T) {
b.pm.currentProfile = prof1.View() b.pm.currentProfile = prof1.View()
// set up routeInfo // set up routeInfo
ri1 := &appc.RouteInfo{} ri1 := appc.RouteInfo{}
ri1.Wildcards = []string{"1"} ri1.Wildcards = []string{"1"}
ri2 := &appc.RouteInfo{} ri2 := appc.RouteInfo{}
ri2.Wildcards = []string{"2"} ri2.Wildcards = []string{"2"}
// read before write // read before write