I would like to be able to forward a host port to a guest port, with the host port automatically determined by the OS to avoid race conditions. I tried to do this by passing "host_port": 0 in a command to the API socket.
However, this returns an error that says bad arguments.host_port.
I found that this case is specifically excluded here:
|
fwd->host_port = (int)json_object_dotget_number(jo, "arguments.host_port"); |
|
if (fwd->host_port == 0) { |
|
const char *err = "{\"error\":{\"desc\":\"bad request: add_hostfwd: " |
|
"bad arguments.host_port\"}}"; |
|
wrc = write(fd, err, strlen(err)); |
|
g_free(fwd); |
|
goto finish; |
|
} |
Why is this not possible? Is it some limitation of libslirp? (This maybe an awkward time to ask as libslirp seems to be migrating its Gitlab instance and is down at the moment, so I'm having trouble checking over there...)
I would like to be able to forward a host port to a guest port, with the host port automatically determined by the OS to avoid race conditions. I tried to do this by passing
"host_port": 0in a command to the API socket.However, this returns an error that says
bad arguments.host_port.I found that this case is specifically excluded here:
slirp4netns/api.c
Lines 135 to 142 in 9996a4e
Why is this not possible? Is it some limitation of
libslirp? (This maybe an awkward time to ask aslibslirpseems to be migrating its Gitlab instance and is down at the moment, so I'm having trouble checking over there...)