Skip to content

Conversation

@JamesMenetrey
Copy link
Contributor

Hey,

Nothing crazy here, implemented some of the popular socket APIs left unimplemented for SGX, following the merge of dev/socket.

An orthogonal note to this PR: I notice that posix_socket.c (the backend of POSIX) now handles the structures for ipv4 and ipv6. A next step would also be to port that adaptation for the POSIX backend of SGX.

Cheers

@JamesMenetrey
Copy link
Contributor Author

Thanks @wenyongh for the thorough feedback! While applying the requested changes, I noticed TRACE_OCALL_FAIL was also missing for recv and send. I have added those accordingly.

Furthermore, I have also handled any returned error by sockaddr_to_bh_sockaddr in the POSIX implementation, similar to what has been requested for the SGX implementation.

Don't hesitate to share any further observations.

}

static int
sockaddr_to_bh_sockaddr(const struct sockaddr *sockaddr, socklen_t socklen,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a clone of a function that we have in the posix_socket.c - do you think we can share the code instead of replicating it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, maybe we add folder core/shared/platform/common/socket and a file under it to implement sockaddr_to_bh_sockaddr and bh_sockaddr_to_sockaddr. But here SGX only supports AF_INET and bh_sockaddr->is_ipv4, the code is a little different from posix's implementation, I think we can merge this PR firstly and refine the code later.

@wenyongh
Copy link
Collaborator

wenyongh commented Oct 6, 2022

LGTM

@wenyongh wenyongh merged commit e2a3f0f into bytecodealliance:main Oct 6, 2022
vickiegpt pushed a commit to vickiegpt/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
…ecodealliance#1556)

Implement some of the popular socket APIs left unimplemented for SGX,
following the merge of dev/socket.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants