Skip to content

Commit 64006e1

Browse files
authored
fix(wamr): Fix networking capability for all platforms (#174)
In instance create, wamr's wasm_runtime_set_wasi_*_pool() functions are storing addr_pool and ns_lookup_pool as pointers. These variables are lost the moment we leave the instance create part, and wamr tries to access them afterwards during the instance execution. We need to store these even if we leave the funtion. Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>
1 parent c19b90d commit 64006e1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/runtime/wamr-wasip1/wamr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,14 @@ static void *instance_create(const char *container_id, const char *img_path, con
314314
}
315315
#if CONFIG_OCRE_NETWORKING
316316
else if (!strcmp(*cap, "networking")) {
317-
const char *addr_pool[] = {
317+
static const char *addr_pool[] = {
318318
"0.0.0.0/0",
319319
};
320320

321321
wasm_runtime_set_wasi_addr_pool(context->module, addr_pool,
322322
sizeof(addr_pool) / sizeof(addr_pool[0]));
323323

324-
const char *ns_lookup_pool[] = {"*"};
324+
static const char *ns_lookup_pool[] = {"*"};
325325

326326
wasm_runtime_set_wasi_ns_lookup_pool(context->module, ns_lookup_pool,
327327
sizeof(ns_lookup_pool) / sizeof(ns_lookup_pool[0]));

0 commit comments

Comments
 (0)