From 27de152b5a1f6226a02a23fae36ff2dde9e271db Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 9 Nov 2021 16:25:24 +0100 Subject: network reload without ports should not reload ports When run as rootless the podman network reload command tries to reload the rootlessport ports because the childIP could have changed. However if the containers has no ports we should skip this instead of printing a warning. Signed-off-by: Paul Holzinger --- libpod/networking_slirp4netns.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libpod') diff --git a/libpod/networking_slirp4netns.go b/libpod/networking_slirp4netns.go index 9da94fb44..8dbd12c6e 100644 --- a/libpod/networking_slirp4netns.go +++ b/libpod/networking_slirp4netns.go @@ -678,6 +678,9 @@ func getRootlessPortChildIP(c *Container, netStatus map[string]types.StatusBlock // reloadRootlessRLKPortMapping will trigger a reload for the port mappings in the rootlessport process. // This should only be called by network connect/disconnect and only as rootless. func (c *Container) reloadRootlessRLKPortMapping() error { + if len(c.config.PortMappings) == 0 { + return nil + } childIP := getRootlessPortChildIP(c, c.state.NetworkStatus) logrus.Debugf("reloading rootless ports for container %s, childIP is %s", c.config.ID, childIP) -- cgit v1.2.3-54-g00ecf From 3690532b3be186c03071d9c845295e7158a0f7f5 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Wed, 10 Nov 2021 21:16:30 +0100 Subject: network reload return error if we cannot reload ports As rootless we have to reload the port mappings. If it fails we should return an error instead of the warning. Signed-off-by: Paul Holzinger --- libpod/networking_slirp4netns.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'libpod') diff --git a/libpod/networking_slirp4netns.go b/libpod/networking_slirp4netns.go index 8dbd12c6e..674075e23 100644 --- a/libpod/networking_slirp4netns.go +++ b/libpod/networking_slirp4netns.go @@ -686,10 +686,7 @@ func (c *Container) reloadRootlessRLKPortMapping() error { conn, err := openUnixSocket(filepath.Join(c.runtime.config.Engine.TmpDir, "rp", c.config.ID)) if err != nil { - // This is not a hard error for backwards compatibility. A container started - // with an old version did not created the rootlessport socket. - logrus.Warnf("Could not reload rootless port mappings, port forwarding may no longer work correctly: %v", err) - return nil + return errors.Wrap(err, "could not reload rootless port mappings, port forwarding may no longer work correctly") } defer conn.Close() enc := json.NewEncoder(conn) -- cgit v1.2.3-54-g00ecf