diff --git a/client/system/info.go b/client/system/info.go index a180be4c0..fa954b44d 100644 --- a/client/system/info.go +++ b/client/system/info.go @@ -96,6 +96,21 @@ func (i *Info) SetFlags( i.LazyConnectionEnabled = lazyConnectionEnabled } +func (i *Info) CopyFlagsFrom(other *Info) { + i.SetFlags( + other.RosenpassEnabled, + other.RosenpassPermissive, + &other.ServerSSHAllowed, + other.DisableClientRoutes, + other.DisableServerRoutes, + other.DisableDNS, + other.DisableFirewall, + other.BlockLANAccess, + other.BlockInbound, + other.LazyConnectionEnabled, + ) +} + // extractUserAgent extracts Netbird's agent (client) name and version from the outgoing context func extractUserAgent(ctx context.Context) string { md, hasMeta := metadata.FromOutgoingContext(ctx) diff --git a/shared/management/client/grpc.go b/shared/management/client/grpc.go index 9c66875c2..14778e105 100644 --- a/shared/management/client/grpc.go +++ b/shared/management/client/grpc.go @@ -229,18 +229,7 @@ func (c *GrpcClient) connectToStream(ctx context.Context, serverPubKey wgtypes.K // Always compute latest system info to ensure up-to-date PeerSystemMeta on first and subsequent syncs recomputed := system.GetInfo(c.ctx) if sysInfo != nil { - recomputed.SetFlags( - sysInfo.RosenpassEnabled, - sysInfo.RosenpassPermissive, - &sysInfo.ServerSSHAllowed, - sysInfo.DisableClientRoutes, - sysInfo.DisableServerRoutes, - sysInfo.DisableDNS, - sysInfo.DisableFirewall, - sysInfo.BlockLANAccess, - sysInfo.BlockInbound, - sysInfo.LazyConnectionEnabled, - ) + recomputed.CopyFlagsFrom(sysInfo) // carry over posture files if any were computed if len(sysInfo.Files) > 0 { recomputed.Files = sysInfo.Files