mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-11-27 10:00:59 +00:00
Compare commits
7 Commits
e7f52b7ea8
...
0c273e1e81
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c273e1e81 | ||
|
|
418be9dfee | ||
|
|
29c4d906de | ||
|
|
c8a2956c4e | ||
|
|
7c134400ae | ||
|
|
02f59f10b2 | ||
|
|
4e99b35fe5 |
|
|
@ -3898,7 +3898,8 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
|
||||||
|
|
||||||
/* addr_pool(textual) -> apool */
|
/* addr_pool(textual) -> apool */
|
||||||
for (i = 0; i < addr_pool_size; i++) {
|
for (i = 0; i < addr_pool_size; i++) {
|
||||||
char *cp, *address, *mask;
|
char *cp, *address, *mask, *nextptr, *endptr;
|
||||||
|
long mask_val;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
cp = bh_strdup(addr_pool[i]);
|
cp = bh_strdup(addr_pool[i]);
|
||||||
|
|
@ -3908,18 +3909,40 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
address = strtok(cp, "/");
|
#ifdef BH_PLATFORM_WINDOWS
|
||||||
mask = strtok(NULL, "/");
|
address = strtok_s(cp, "/", &nextptr);
|
||||||
|
mask = strtok_s(NULL, "/", &nextptr);
|
||||||
|
#else
|
||||||
|
address = strtok_r(cp, "/", &nextptr);
|
||||||
|
mask = strtok_r(NULL, "/", &nextptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!mask) {
|
if (!mask) {
|
||||||
snprintf(error_buf, error_buf_size,
|
snprintf(error_buf, error_buf_size,
|
||||||
"Invalid address pool entry: %s, must be in the format of "
|
"Invalid address pool entry: %s, must be in the format of "
|
||||||
"ADDRESS/MASK",
|
"ADDRESS/MASK",
|
||||||
addr_pool[i]);
|
addr_pool[i]);
|
||||||
|
wasm_runtime_free(cp);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = addr_pool_insert(apool, address, (uint8)atoi(mask));
|
errno = 0;
|
||||||
|
mask_val = strtol(mask, &endptr, 10);
|
||||||
|
|
||||||
|
if (mask == endptr || *endptr != '\0') {
|
||||||
|
snprintf(error_buf, error_buf_size,
|
||||||
|
"Invalid address pool entry: mask must be a number");
|
||||||
|
wasm_runtime_free(cp);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if (errno != 0 || mask_val < 0) {
|
||||||
|
snprintf(error_buf, error_buf_size,
|
||||||
|
"Init wasi environment failed: invalid mask number");
|
||||||
|
wasm_runtime_free(cp);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = addr_pool_insert(apool, address, (uint8)mask_val);
|
||||||
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,
|
||||||
|
|
|
||||||
|
|
@ -3105,7 +3105,6 @@ addr_pool_insert(struct addr_pool *addr_pool, const char *addr, uint8 mask)
|
||||||
}
|
}
|
||||||
|
|
||||||
next->next = NULL;
|
next->next = NULL;
|
||||||
next->mask = mask;
|
|
||||||
|
|
||||||
if (os_socket_inet_network(true, addr, &target) != BHT_OK) {
|
if (os_socket_inet_network(true, addr, &target) != BHT_OK) {
|
||||||
// If parsing IPv4 fails, try IPv6
|
// If parsing IPv4 fails, try IPv6
|
||||||
|
|
@ -3116,10 +3115,20 @@ addr_pool_insert(struct addr_pool *addr_pool, const char *addr, uint8 mask)
|
||||||
next->type = IPv6;
|
next->type = IPv6;
|
||||||
bh_memcpy_s(next->addr.ip6, sizeof(next->addr.ip6), target.ipv6,
|
bh_memcpy_s(next->addr.ip6, sizeof(next->addr.ip6), target.ipv6,
|
||||||
sizeof(target.ipv6));
|
sizeof(target.ipv6));
|
||||||
|
if (mask > 128) {
|
||||||
|
wasm_runtime_free(next);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
next->mask = mask;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
next->type = IPv4;
|
next->type = IPv4;
|
||||||
next->addr.ip4 = target.ipv4;
|
next->addr.ip4 = target.ipv4;
|
||||||
|
if (mask > 32) {
|
||||||
|
wasm_runtime_free(next);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
next->mask = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attach with */
|
/* attach with */
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
This document is intended to describe the current status of WebAssembly proposals and WASI proposals in WAMR.
|
This document is intended to describe the current status of WebAssembly proposals and WASI proposals in WAMR.
|
||||||
|
|
||||||
Only track proposals that are followed in the [WebAssembly proposals](https://github.com/WebAssembly/proposals) and [WASI proposals](https://github.com/WebAssembly/WASI/blob/main/Proposals.md).
|
Only track proposals that are followed in the [WebAssembly proposals](https://github.com/WebAssembly/proposals) and [WASI proposals](https://github.com/WebAssembly/WASI/blob/main/docs/Proposals.md).
|
||||||
|
|
||||||
Normally, the document tracks proposals that are in phase 4. However, if a proposal in an earlier phase receives support, it will be added to the list below.
|
Normally, the document tracks proposals that are in phase 4. However, if a proposal in an earlier phase receives support, it will be added to the list below.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user