propagate client-side DisableComponentNetworkMap flag

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
Dmitri Dolguikh
2026-07-14 12:44:01 +02:00
parent 5d793985d4
commit 47a99768a4
6 changed files with 44 additions and 33 deletions
+1
View File
@@ -351,6 +351,7 @@ func (a *Auth) setSystemInfoFlags(info *system.Info) {
a.config.BlockLANAccess, a.config.BlockLANAccess,
a.config.BlockInbound, a.config.BlockInbound,
a.config.DisableIPv6, a.config.DisableIPv6,
a.config.DisableComponentNetworkMap,
a.config.EnableSSHRoot, a.config.EnableSSHRoot,
a.config.EnableSSHSFTP, a.config.EnableSSHSFTP,
a.config.EnableSSHLocalPortForwarding, a.config.EnableSSHLocalPortForwarding,
+9 -7
View File
@@ -611,13 +611,14 @@ func createEngineConfig(key wgtypes.Key, config *profilemanager.Config, peerConf
DisableSSHAuth: config.DisableSSHAuth, DisableSSHAuth: config.DisableSSHAuth,
DNSRouteInterval: config.DNSRouteInterval, DNSRouteInterval: config.DNSRouteInterval,
DisableClientRoutes: config.DisableClientRoutes, DisableClientRoutes: config.DisableClientRoutes,
DisableServerRoutes: config.DisableServerRoutes || config.BlockInbound, DisableServerRoutes: config.DisableServerRoutes || config.BlockInbound,
DisableDNS: config.DisableDNS, DisableDNS: config.DisableDNS,
DisableFirewall: config.DisableFirewall, DisableFirewall: config.DisableFirewall,
BlockLANAccess: config.BlockLANAccess, BlockLANAccess: config.BlockLANAccess,
BlockInbound: config.BlockInbound, BlockInbound: config.BlockInbound,
DisableIPv6: config.DisableIPv6, DisableIPv6: config.DisableIPv6,
DisableComponentNetworkMap: config.DisableComponentNetworkMap,
LazyConnection: lazyconn.ParseState(config.LazyConnection), LazyConnection: lazyconn.ParseState(config.LazyConnection),
@@ -693,6 +694,7 @@ func loginToManagement(ctx context.Context, client mgm.Client, pubSSHKey []byte,
config.BlockLANAccess, config.BlockLANAccess,
config.BlockInbound, config.BlockInbound,
config.DisableIPv6, config.DisableIPv6,
config.DisableComponentNetworkMap,
config.EnableSSHRoot, config.EnableSSHRoot,
config.EnableSSHSFTP, config.EnableSSHSFTP,
config.EnableSSHLocalPortForwarding, config.EnableSSHLocalPortForwarding,
+10 -7
View File
@@ -142,13 +142,14 @@ type EngineConfig struct {
DNSRouteInterval time.Duration DNSRouteInterval time.Duration
DisableClientRoutes bool DisableClientRoutes bool
DisableServerRoutes bool DisableServerRoutes bool
DisableDNS bool DisableDNS bool
DisableFirewall bool DisableFirewall bool
BlockLANAccess bool BlockLANAccess bool
BlockInbound bool BlockInbound bool
DisableIPv6 bool DisableIPv6 bool
DisableComponentNetworkMap bool
// LazyConnection is the MDM-sourced lazy-connection override; StateUnset defers to // LazyConnection is the MDM-sourced lazy-connection override; StateUnset defers to
// the env var and management feature flag. // the env var and management feature flag.
@@ -1228,6 +1229,7 @@ func (e *Engine) applyInfoFlags(info *system.Info) {
e.config.BlockLANAccess, e.config.BlockLANAccess,
e.config.BlockInbound, e.config.BlockInbound,
e.config.DisableIPv6, e.config.DisableIPv6,
e.config.DisableComponentNetworkMap,
e.config.EnableSSHRoot, e.config.EnableSSHRoot,
e.config.EnableSSHSFTP, e.config.EnableSSHSFTP,
e.config.EnableSSHLocalPortForwarding, e.config.EnableSSHLocalPortForwarding,
@@ -2096,6 +2098,7 @@ func (e *Engine) readInitialSettings() ([]*route.Route, *nbdns.Config, bool, err
e.config.BlockLANAccess, e.config.BlockLANAccess,
e.config.BlockInbound, e.config.BlockInbound,
e.config.DisableIPv6, e.config.DisableIPv6,
e.config.DisableComponentNetworkMap,
e.config.EnableSSHRoot, e.config.EnableSSHRoot,
e.config.EnableSSHSFTP, e.config.EnableSSHSFTP,
e.config.EnableSSHLocalPortForwarding, e.config.EnableSSHLocalPortForwarding,
+8 -7
View File
@@ -130,13 +130,14 @@ type Config struct {
DisableSSHAuth *bool DisableSSHAuth *bool
SSHJWTCacheTTL *int SSHJWTCacheTTL *int
DisableClientRoutes bool DisableClientRoutes bool
DisableServerRoutes bool DisableServerRoutes bool
DisableDNS bool DisableDNS bool
DisableFirewall bool DisableFirewall bool
BlockLANAccess bool BlockLANAccess bool
BlockInbound bool BlockInbound bool
DisableIPv6 bool DisableIPv6 bool
DisableComponentNetworkMap bool
DisableNotifications *bool DisableNotifications *bool
+10 -8
View File
@@ -66,13 +66,14 @@ type Info struct {
RosenpassPermissive bool RosenpassPermissive bool
ServerSSHAllowed bool ServerSSHAllowed bool
DisableClientRoutes bool DisableClientRoutes bool
DisableServerRoutes bool DisableServerRoutes bool
DisableDNS bool DisableDNS bool
DisableFirewall bool DisableFirewall bool
BlockLANAccess bool BlockLANAccess bool
BlockInbound bool BlockInbound bool
DisableIPv6 bool DisableIPv6 bool
DisableComponentNetworkMap bool
EnableSSHRoot bool EnableSSHRoot bool
EnableSSHSFTP bool EnableSSHSFTP bool
@@ -85,7 +86,7 @@ func (i *Info) SetFlags(
rosenpassEnabled, rosenpassPermissive bool, rosenpassEnabled, rosenpassPermissive bool,
serverSSHAllowed *bool, serverSSHAllowed *bool,
disableClientRoutes, disableServerRoutes, disableClientRoutes, disableServerRoutes,
disableDNS, disableFirewall, blockLANAccess, blockInbound, disableIPv6 bool, disableDNS, disableFirewall, blockLANAccess, blockInbound, disableIPv6, disableComponentNetworkMap bool,
enableSSHRoot, enableSSHSFTP, enableSSHLocalPortForwarding, enableSSHRemotePortForwarding *bool, enableSSHRoot, enableSSHSFTP, enableSSHLocalPortForwarding, enableSSHRemotePortForwarding *bool,
disableSSHAuth *bool, disableSSHAuth *bool,
) { ) {
@@ -102,6 +103,7 @@ func (i *Info) SetFlags(
i.BlockLANAccess = blockLANAccess i.BlockLANAccess = blockLANAccess
i.BlockInbound = blockInbound i.BlockInbound = blockInbound
i.DisableIPv6 = disableIPv6 i.DisableIPv6 = disableIPv6
i.DisableComponentNetworkMap = disableComponentNetworkMap
if enableSSHRoot != nil { if enableSSHRoot != nil {
i.EnableSSHRoot = *enableSSHRoot i.EnableSSHRoot = *enableSSHRoot
+6 -4
View File
@@ -1033,10 +1033,12 @@ func infoToMetaData(info *system.Info) *proto.PeerSystemMeta {
func peerCapabilities(info system.Info) []proto.PeerCapability { func peerCapabilities(info system.Info) []proto.PeerCapability {
caps := []proto.PeerCapability{ caps := []proto.PeerCapability{
proto.PeerCapability_PeerCapabilitySourcePrefixes, proto.PeerCapability_PeerCapabilitySourcePrefixes,
// PeerCapabilityComponentNetworkMap signals that this client can }
// decode the components-format SyncResponse.NetworkMapEnvelope and // PeerCapabilityComponentNetworkMap signals that this client can
// run Calculate() locally. // decode the components-format SyncResponse.NetworkMapEnvelope and
proto.PeerCapability_PeerCapabilityComponentNetworkMap, // run Calculate() locally.
if !info.DisableComponentNetworkMap {
caps = append(caps, proto.PeerCapability_PeerCapabilityComponentNetworkMap)
} }
if !info.DisableIPv6 { if !info.DisableIPv6 {
caps = append(caps, proto.PeerCapability_PeerCapabilityIPv6Overlay) caps = append(caps, proto.PeerCapability_PeerCapabilityIPv6Overlay)