aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-01 12:12:26 -0400
committerGitHub <noreply@github.com>2021-09-01 12:12:26 -0400
commitfff12da70e1c5c467e1171faf0b5fb3ef1067cfc (patch)
treee10df2d00846508812232e15feffcb947973f833 /pkg
parentf5cfb0da29a8ab07836f5b71816e915e04d5850e (diff)
parentabdedc31a25e74866c8afef115d3f87c3b808741 (diff)
downloadpodman-fff12da70e1c5c467e1171faf0b5fb3ef1067cfc.tar.gz
podman-fff12da70e1c5c467e1171faf0b5fb3ef1067cfc.tar.bz2
podman-fff12da70e1c5c467e1171faf0b5fb3ef1067cfc.zip
Merge pull request #11391 from Luap99/rootlessport-socket
rootlessport: allow socket paths with more than 108 chars
Diffstat (limited to 'pkg')
-rw-r--r--pkg/rootlessport/rootlessport_linux.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/pkg/rootlessport/rootlessport_linux.go b/pkg/rootlessport/rootlessport_linux.go
index 9a2f93f8e..730d91aa2 100644
--- a/pkg/rootlessport/rootlessport_linux.go
+++ b/pkg/rootlessport/rootlessport_linux.go
@@ -218,10 +218,20 @@ outer:
// we only need to have a socket to reload ports when we run under rootless cni
if cfg.RootlessCNI {
- socket, err := net.Listen("unix", filepath.Join(socketDir, cfg.ContainerID))
+ // workaround to bypass the 108 char socket path limit
+ // open the fd and use the path to the fd as bind argument
+ fd, err := unix.Open(socketDir, unix.O_PATH, 0)
if err != nil {
return err
}
+ socket, err := net.ListenUnix("unixpacket", &net.UnixAddr{Name: fmt.Sprintf("/proc/self/fd/%d/%s", fd, cfg.ContainerID), Net: "unixpacket"})
+ if err != nil {
+ return err
+ }
+ err = unix.Close(fd)
+ if err != nil {
+ logrus.Warnf("failed to close the socketDir fd: %v", err)
+ }
defer socket.Close()
go serve(socket, driver)
}