diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-08-30 16:49:02 +0200 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-08-30 13:39:02 -0400 |
commit | 0103a0459a4de2a3e9384c4201e4f18c5cfe2e40 (patch) | |
tree | 9cd73202ab10b837aaf7300e873f723611052699 | |
parent | 77948c8b44451aa592d270e6d174d68b8e74f51e (diff) | |
download | podman-0103a0459a4de2a3e9384c4201e4f18c5cfe2e40.tar.gz podman-0103a0459a4de2a3e9384c4201e4f18c5cfe2e40.tar.bz2 podman-0103a0459a4de2a3e9384c4201e4f18c5cfe2e40.zip |
rootless cni: resolve absolute symlinks correctly
When /etc/resolv.conf is a symlink to an absolute path use it and not
join it the the previous path.
[NO TESTS NEEDED] This depends on the host layout.
Fixes #11358
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r-- | libpod/networking_linux.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 7eef04ddf..e41aebb4a 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -185,7 +185,13 @@ func (r *RootlessCNI) Do(toRun func() error) error { // if there is no symlink exit break } - resolvePath = filepath.Join(filepath.Dir(resolvePath), link) + if filepath.IsAbs(link) { + // link is as an absolute path + resolvePath = link + } else { + // link is as a relative, join it with the previous path + resolvePath = filepath.Join(filepath.Dir(resolvePath), link) + } if strings.HasPrefix(resolvePath, "/run/") { break } |