-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unix socket path length problems #194
Comments
We should also report a proper error when the path length is too long |
Possible solutions:
|
Tentative patch for the 2nd option is diff --git a/pkg/vf/virtionet.go b/pkg/vf/virtionet.go
index 72fd73c..28e257d 100644
--- a/pkg/vf/virtionet.go
+++ b/pkg/vf/virtionet.go
@@ -19,20 +19,12 @@ type VirtioNet struct {
localAddr *net.UnixAddr
}
-func localUnixSocketPath() (string, error) {
- homeDir, err := os.UserHomeDir()
+func localUnixSocketPath(dir string) (string, error) {
+ tmpFile, err := os.CreateTemp(dir, fmt.Sprintf("vfkit-%d-*.sock", os.Getpid()))
if err != nil {
return "", err
}
- dir := filepath.Join(homeDir, "Library", "Application Support", "vfkit")
- if err := os.MkdirAll(dir, 0755); err != nil {
- return "", err
- }
- tmpFile, err := os.CreateTemp(dir, fmt.Sprintf("net-%d-*.sock", os.Getpid()))
- if err != nil {
- return "", err
- }
- // slightly racy, but this is in a directory only user-writable
+ // slightly racy, but hopefully this is in a directory only user-writable
defer tmpFile.Close()
defer os.Remove(tmpFile.Name())
@@ -44,7 +36,7 @@ func (dev *VirtioNet) connectUnixPath() error {
Name: dev.UnixSocketPath,
Net: "unixgram",
}
- localSocketPath, err := localUnixSocketPath()
+ localSocketPath, err := localUnixSocketPath(filepath.Dir(dev.UnixSocketPath))
if err != nil {
return err
} (not even compile tested) |
cfergeau
added a commit
to cfergeau/vfkit
that referenced
this issue
Sep 20, 2024
With unixgram sockets, we need to specify a client endpoint, which is a path on the filesystem with a maximum length of 104 bytes on macOS. When using -device virtio-net,unixSocketPath=/tmp/vnet.sock, we need to create a client endpoint before connecting to /tmp/vnet.sock. It's currently put into `/Users/user/Library/Application Support`, which is already fairly long. Depending on the username, the 104 bytes are easily exceeded, this has been causing problems to podman machine. This commit will create the client endpoint in the same directory as the server endpoint, which gives more control to the user of vfkit wrt where this socket is going. This fixes crc-org#194 Signed-off-by: Christophe Fergeau <[email protected]>
If the socket is created by vfkit, it can be under |
cfergeau
added a commit
to cfergeau/vfkit
that referenced
this issue
Oct 28, 2024
With unixgram sockets, we need to specify a client endpoint, which is a path on the filesystem with a maximum length of 104 bytes on macOS. When using -device virtio-net,unixSocketPath=/tmp/vnet.sock, we need to create a client endpoint before connecting to /tmp/vnet.sock. It's currently put into `/Users/user/Library/Application Support`, which is already fairly long. Depending on the username, the 104 bytes are easily exceeded, this has been causing problems to podman machine. This commit will create the client endpoint in the same directory as the server endpoint, which gives more control to the user of vfkit wrt where this socket is going. This fixes crc-org#194 Signed-off-by: Christophe Fergeau <[email protected]>
cfergeau
added a commit
to cfergeau/vfkit
that referenced
this issue
Oct 28, 2024
With unixgram sockets, we need to specify a client endpoint, which is a path on the filesystem with a maximum length of 104 bytes on macOS. When using -device virtio-net,unixSocketPath=/tmp/vnet.sock, we need to create a client endpoint before connecting to /tmp/vnet.sock. It's currently put into `/Users/user/Library/Application Support`, which is already fairly long. Depending on the username, the 104 bytes are easily exceeded, this has been causing problems to podman machine. This commit will create the client endpoint in the same directory as the server endpoint, which gives more control to the user of vfkit wrt where this socket is going. This fixes crc-org#194 Signed-off-by: Christophe Fergeau <[email protected]>
cfergeau
added a commit
to cfergeau/vfkit
that referenced
this issue
Oct 28, 2024
With unixgram sockets, we need to specify a client endpoint, which is a path on the filesystem with a maximum length of 104 bytes on macOS. When using -device virtio-net,unixSocketPath=/tmp/vnet.sock, we need to create a client endpoint before connecting to /tmp/vnet.sock. It's currently put into `/Users/user/Library/Application Support`, which is already fairly long. Depending on the username, the 104 bytes are easily exceeded, this has been causing problems to podman machine. This commit will create the client endpoint in the same directory as the server endpoint, which gives more control to the user of vfkit wrt where this socket is going. This fixes crc-org#194 Signed-off-by: Christophe Fergeau <[email protected]>
cfergeau
added a commit
to cfergeau/vfkit
that referenced
this issue
Oct 29, 2024
With unixgram sockets, we need to specify a client endpoint, which is a path on the filesystem with a maximum length of 104 bytes on macOS. When using -device virtio-net,unixSocketPath=/tmp/vnet.sock, we need to create a client endpoint before connecting to /tmp/vnet.sock. It's currently put into `/Users/user/Library/Application Support`, which is already fairly long. Depending on the username, the 104 bytes are easily exceeded, this has been causing problems to podman machine. This commit will create the client endpoint in the same directory as the server endpoint, which gives more control to the user of vfkit wrt where this socket is going. This fixes crc-org#194 Signed-off-by: Christophe Fergeau <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
unix socket paths have a very limited length, 104 bytes on macos, 108 on linux
Podman is currently hitting this limit with vfkit:
This path is generated in
vfkit/pkg/vf/virtionet.go
Lines 21 to 41 in 966a928
The text was updated successfully, but these errors were encountered: