-
Notifications
You must be signed in to change notification settings - Fork 735
Implement sock_addr_local syscall #1320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement sock_addr_local syscall #1320
Conversation
838706b to
91de2e8
Compare
core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
Outdated
Show resolved
Hide resolved
core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
Outdated
Show resolved
Hide resolved
core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
Outdated
Show resolved
Hide resolved
e508289 to
a74f1cd
Compare
lum1n0us
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only some code-style problems
Thanks, already replied. |
7f61c25 to
b5f8ce6
Compare
core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
Outdated
Show resolved
Hide resolved
b38dda4 to
a0a6ea8
Compare
|
@loganek There are compilation errors on linux-sgx platform: These functions are not provided by sgx-sdk, but they were implemented in linux-sgx sgx_socket.c as static functions: Could you please add the API declarations in core/shared/platform/linux-sgx/platform_internal.h, and move the implementation into core/shared/platform/linux-sgx/platform_init.c and remove static flag? |
a0a6ea8 to
eefbfd9
Compare
a3864d7 to
77448c0
Compare
I also slightly changed the interface - since we already have a `__wasi_addr_t` structure which is an union, there's no need for passing length around - the address buffer will always have the right length (i.e. max of all address families).
77448c0 to
6a3ddd7
Compare
Hi @wenyongh , I've kept the implementation in sgx_socket.c but made it non-static. Is there any reason we'd prefer to move it to platform_init.c? What's the purpose of that file? I think similar functions follow the same pattern (i.e. the implementation exists in sgx_socket file). Regarding the header file - I added the declaration to sgx_socket.h, as it looked like other functions are declared there, and the file is already included through other headers. |
@loganek It should be also OK, platform_init.c is to implement some common APIs for the platform, here it should be sgx_platform.c, for linux/windows/darwin, we named it platform_init.c. I will review the code again and merge it if there is no issue found. |
Implement more socket APIs, refer to #1336 and below PRs: - Implement wasi_addr_resolve function (#1319) - Fix socket-api byte order issue when host/network order are the same (#1327) - Enhance sock_addr_local syscall (#1320) - Implement sock_addr_remote syscall (#1360) - Add support for IPv6 in WAMR (#1411) - Implement ns lookup allowlist (#1420) - Implement sock_send_to and sock_recv_from system calls (#1457) - Added http downloader and multicast socket options (#1467) - Fix `bind()` calls to receive the correct size of `sockaddr` structure (#1490) - Assert on correct parameters (#1505) - Copy only received bytes from socket recv buffer into the app buffer (#1497) Co-authored-by: Marcin Kolny <[email protected]> Co-authored-by: Marcin Kolny <[email protected]> Co-authored-by: Callum Macmillan <[email protected]>
Slightly change the __wasi_sock_addr_local interface - since we already have a `__wasi_addr_t` structure which is an union, there's no need for passing the length around - the address buffer will always have the right length (i.e. max of all address families).
Implement more socket APIs, refer to bytecodealliance#1336 and below PRs: - Implement wasi_addr_resolve function (bytecodealliance#1319) - Fix socket-api byte order issue when host/network order are the same (bytecodealliance#1327) - Enhance sock_addr_local syscall (bytecodealliance#1320) - Implement sock_addr_remote syscall (bytecodealliance#1360) - Add support for IPv6 in WAMR (bytecodealliance#1411) - Implement ns lookup allowlist (bytecodealliance#1420) - Implement sock_send_to and sock_recv_from system calls (bytecodealliance#1457) - Added http downloader and multicast socket options (bytecodealliance#1467) - Fix `bind()` calls to receive the correct size of `sockaddr` structure (bytecodealliance#1490) - Assert on correct parameters (bytecodealliance#1505) - Copy only received bytes from socket recv buffer into the app buffer (bytecodealliance#1497) Co-authored-by: Marcin Kolny <[email protected]> Co-authored-by: Marcin Kolny <[email protected]> Co-authored-by: Callum Macmillan <[email protected]>
I also slightly changed the interface - since we already have a
__wasi_addr_tstructure which is an union, there's no need for passing length around - the
address buffer will always have the right length (i.e. max of all address
families).