daemon: join detached netns when inspecting sysinfo

Join `$ROOTLESSKIT_STATE_DIR/netns` when inspecting
`net.ipv4.ip_forward`, to silence the bogus warning
"IPv4 forwarding is disabled".

Fix issue 52737

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2026-06-11 17:41:34 +09:00
parent efe6156e19
commit a2b90c7cee

View File

@@ -115,6 +115,7 @@ type Daemon struct {
root string
sysInfoOnce sync.Once
sysInfo *sysinfo.SysInfo
sysInfoErr error
shutdown bool
idMapping user.IdentityMapping
PluginStore *plugin.Store // TODO: remove
@@ -1877,11 +1878,14 @@ func (daemon *Daemon) RawSysInfo() (*sysinfo.SysInfo, error) {
// We check if sysInfo is not set here, to allow some test to
// override the actual sysInfo.
if daemon.sysInfo == nil {
daemon.sysInfo = getSysInfo(&daemon.config().Config)
daemon.sysInfoErr = daemon.runInNetNS(func() error {
daemon.sysInfo = getSysInfo(&daemon.config().Config)
return nil
})
}
})
return daemon.sysInfo, nil
return daemon.sysInfo, daemon.sysInfoErr
}
// imageBackend is used to satisfy the [executorpkg.ImageBackend] and