mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-09-05 17:32:26 +00:00
Merge commit from fork
If `--addr-pool=1.2.3.4`, the runtime will return an error. The value must be in the form of ADDRESS/MASK.
This commit is contained in:
parent
c080aa80d0
commit
121232a995
|
@ -3810,7 +3810,15 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
|
||||||
address = strtok(cp, "/");
|
address = strtok(cp, "/");
|
||||||
mask = strtok(NULL, "/");
|
mask = strtok(NULL, "/");
|
||||||
|
|
||||||
ret = addr_pool_insert(apool, address, (uint8)(mask ? atoi(mask) : 0));
|
if (!mask) {
|
||||||
|
snprintf(error_buf, error_buf_size,
|
||||||
|
"Invalid address pool entry: %s, must be in the format of "
|
||||||
|
"ADDRESS/MASK",
|
||||||
|
addr_pool[i]);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = addr_pool_insert(apool, address, (uint8)atoi(mask));
|
||||||
wasm_runtime_free(cp);
|
wasm_runtime_free(cp);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
set_error_buf(error_buf, error_buf_size,
|
set_error_buf(error_buf, error_buf_size,
|
||||||
|
|
|
@ -58,7 +58,8 @@ enabled.
|
||||||
|
|
||||||
_iwasm_ accepts address ranges via an option, `--addr-pool`, to implement
|
_iwasm_ accepts address ranges via an option, `--addr-pool`, to implement
|
||||||
the capability control. All IP address the WebAssembly application may need to `bind()` or `connect()`
|
the capability control. All IP address the WebAssembly application may need to `bind()` or `connect()`
|
||||||
should be announced first. Every IP address should be in CIDR notation.
|
should be announced first. Every IP address should be in CIDR notation. If not, _iwasm_ will return
|
||||||
|
an error.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ iwasm --addr-pool=1.2.3.4/15,2.3.4.6/16 socket_example.wasm
|
$ iwasm --addr-pool=1.2.3.4/15,2.3.4.6/16 socket_example.wasm
|
||||||
|
|
|
@ -45,7 +45,7 @@ libc_wasi_print_help(void)
|
||||||
"path, for example:\n");
|
"path, for example:\n");
|
||||||
printf(" --map-dir=<guest-path1::host-path1> "
|
printf(" --map-dir=<guest-path1::host-path1> "
|
||||||
"--map-dir=<guest-path2::host-path2>\n");
|
"--map-dir=<guest-path2::host-path2>\n");
|
||||||
printf(" --addr-pool=<addrs> Grant wasi access to the given network "
|
printf(" --addr-pool=<addr/mask> Grant wasi access to the given network "
|
||||||
"addresses in\n");
|
"addresses in\n");
|
||||||
printf(" CIDR notation to the program, separated "
|
printf(" CIDR notation to the program, separated "
|
||||||
"with ',',\n");
|
"with ',',\n");
|
||||||
|
|
|
@ -171,6 +171,7 @@ set(WAMR_BUILD_JIT 0)
|
||||||
set(WAMR_BUILD_LIBC_BUILTIN 1)
|
set(WAMR_BUILD_LIBC_BUILTIN 1)
|
||||||
set(WAMR_BUILD_LIBC_WASI 1)
|
set(WAMR_BUILD_LIBC_WASI 1)
|
||||||
set(WAMR_BUILD_LIB_PTHREAD 1)
|
set(WAMR_BUILD_LIB_PTHREAD 1)
|
||||||
|
set(WAMR_BUILD_REF_TYPES 1)
|
||||||
|
|
||||||
# compiling and linking flags
|
# compiling and linking flags
|
||||||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user