summaryrefslogtreecommitdiff
path: root/libpod/networking_linux.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-08-30 16:49:02 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-08-30 16:55:26 +0200
commit06f94dd09e52f89736012fafb65adb3774d795f6 (patch)
treed5e096444517ee1e1e2b801f4d6385d46c1beaf7 /libpod/networking_linux.go
parenta2acd04447a66027dc02a210d2961fcde6868985 (diff)
downloadpodman-06f94dd09e52f89736012fafb65adb3774d795f6.tar.gz
podman-06f94dd09e52f89736012fafb65adb3774d795f6.tar.bz2
podman-06f94dd09e52f89736012fafb65adb3774d795f6.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>
Diffstat (limited to 'libpod/networking_linux.go')
-rw-r--r--libpod/networking_linux.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 5ade0849d..9aa6cab15 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
}