You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The getifaddrs syscall is not working in lind-wasm since the memory allocation to ifaddrs struct seems to be wrong. The getifaddrs syscall takes a double pointers (struct ifaddrs **ifap), and it is underlying syscall that is responsible for allocating the memory for the ifap struct. In rawposix, getifaddrs_syscall treats the ifap as an one-dimensional pointer (*mut u8), and fill the pointer with the ifaddrs from libc. The correct steps should be something like:
*buf = malloc_wasm_memory(...)
fill(*buf, &ifap_from_libc)
... (malloc_wasm_memory for next ifap struct)
The main difficuly with this approach is that, it has to malloc the wasm memory inside rawposix, but the wasm memory is managed by glibc, so it would be kind tricky to let rawposix malloc the wasm memory.
Another approach would be using the getifaddrs_internal function provided by glibc. This function does not actually use getifaddrs syscall directly, but instead used some other network syscalls to simulate the getifaddrs. Currently this approach would fail since it used bind syscall on socket type that is not directly supported by rawposix (AF_NETLINK socket). However, this is an issue in rawposix (Lind-Project/RawPOSIX#3) and will be likely fixed soon.
The text was updated successfully, but these errors were encountered:
The getifaddrs syscall is not working in lind-wasm since the memory allocation to ifaddrs struct seems to be wrong. The getifaddrs syscall takes a double pointers (struct ifaddrs **ifap), and it is underlying syscall that is responsible for allocating the memory for the ifap struct. In rawposix, getifaddrs_syscall treats the ifap as an one-dimensional pointer (*mut u8), and fill the pointer with the ifaddrs from libc. The correct steps should be something like:
The main difficuly with this approach is that, it has to malloc the wasm memory inside rawposix, but the wasm memory is managed by glibc, so it would be kind tricky to let rawposix malloc the wasm memory.
Another approach would be using the
getifaddrs_internal
function provided by glibc. This function does not actually use getifaddrs syscall directly, but instead used some other network syscalls to simulate the getifaddrs. Currently this approach would fail since it used bind syscall on socket type that is not directly supported by rawposix (AF_NETLINK socket). However, this is an issue in rawposix (Lind-Project/RawPOSIX#3) and will be likely fixed soon.The text was updated successfully, but these errors were encountered: