mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-23 02:51:55 +00:00
proxy: listen on vsock before requesting a connection
The 9P operations tell the host to connect to the vsock port in the UDP case, so always listen before sending the 9P request. Signed-off-by: David Scott <dave.scott@docker.com>
This commit is contained in:
parent
caeb0d53cc
commit
e940e12abc
@ -14,17 +14,17 @@ import (
|
||||
func main() {
|
||||
host, port, container := parseHostContainerAddrs()
|
||||
|
||||
p, err := libproxy.NewProxy(&vsock.VsockAddr{Port: uint(port)}, container)
|
||||
if err != nil {
|
||||
sendError(err)
|
||||
}
|
||||
ctl, err := exposePort(host, port)
|
||||
if err != nil {
|
||||
sendError(err)
|
||||
}
|
||||
|
||||
p, err := libproxy.NewProxy(&vsock.VsockAddr{Port: uint(port)}, container)
|
||||
if err != nil {
|
||||
sendError(err)
|
||||
}
|
||||
|
||||
go handleStopSignals(p)
|
||||
// TODO: avoid this line if we are running in a TTY
|
||||
sendOK()
|
||||
p.Run()
|
||||
ctl.Close() // ensure ctl remains alive and un-GCed until here
|
||||
@ -32,7 +32,7 @@ func main() {
|
||||
}
|
||||
|
||||
func exposePort(host net.Addr, port int) (*os.File, error) {
|
||||
name := host.String()
|
||||
name := host.Network() + ":" + host.String()
|
||||
log.Printf("exposePort %s\n", name)
|
||||
err := os.Mkdir("/port/"+name, 0)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user