From 45772d7e0675d62fbd8076849b44c5ec83712e40 Mon Sep 17 00:00:00 2001 From: Jameel Al-Aziz Date: Thu, 19 Oct 2023 01:20:07 -0700 Subject: [PATCH] transport: Support passing CID for linux vsock Signed-off-by: Jameel Al-Aziz --- pkg/transport/listen_linux.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/transport/listen_linux.go b/pkg/transport/listen_linux.go index 6590e68b1..dfefecd3c 100644 --- a/pkg/transport/listen_linux.go +++ b/pkg/transport/listen_linux.go @@ -17,6 +17,15 @@ func listenURL(parsed *url.URL) (net.Listener, error) { if err != nil { return nil, err } + + if parsed.Hostname() != "" { + cid, err := strconv.Atoi(parsed.Hostname()) + if err != nil { + return nil, err + } + return mdlayhervsock.ListenContextID(uint32(cid), uint32(port), nil) + } + return mdlayhervsock.Listen(uint32(port), nil) case "unixpacket": return net.Listen(parsed.Scheme, parsed.Path)