-
Notifications
You must be signed in to change notification settings - Fork 13.8k
std: sys: net: uefi: tcp: Initial TcpListener support #145339
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
base: master
Are you sure you want to change the base?
Conversation
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
Passing this along to someone else, who hopefully has more context. r? libs |
@rustbot label +O-UEFI |
Thom is off the review rotation Also gentle ping @nicholasbishop for a review since we usually defer UEFI to you |
// The spec does not seem to state if we need to call ServiceBinding->DestroyChild for | ||
// this handle |
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.
Is there a reference implementation that does or doesn't do this? Or a way to check whether or not the handle is valid after this call?
54d3d51
to
5459fc4
Compare
☔ The latest upstream changes (presumably #146418) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
Generally LGTM but left a few remarks
5459fc4
to
9f020a9
Compare
This comment has been minimized.
This comment has been minimized.
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.
I assume the waiting-on-author label isn't actually accurate?
This LGTM, with the note that if you are following some sort of reference implementation for #145339 (comment) then it would be good to mention what that is in a comment.
You should probably rebase before merge and verify that it still builds, since sys::net
has had some changes in recent weeks. Also cc @nicholasbishop if you'd like to double check this.
let completion_token = | ||
tcp4::CompletionToken { event: evt.as_ptr(), status: Status::SUCCESS }; | ||
let mut listen_token = | ||
tcp4::ListenToken { completion_token, new_child_handle: crate::ptr::null_mut() }; |
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.
Should probably just import crate::ptr
, it's used a lot of places in this module and will likely wind up in more in the future. (totally optional here ofc)
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.
Added
9f020a9
to
a452682
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
So, just looked at the internals of edk2 again, and it does seem like I need to use service binding protocol to clean it up. From what I gather of the implementation of TcpServiceBindingDestroyChild, it seems like at least edk2 assumes there to be only one service binding protocol for both tcp4 and tcp6. In fact, no data from service binding protocol is passed or used to destroy the socket (other than then service binding protocol not being null). So will adjust the PR once I get time. |
a452682
to
e2521f5
Compare
I am now using the parent service binding protocol to handle in any connections accepted by TCP4. On EDK2, this is not really required, since there seems to be an assumption of a single service binding protocol for both TCP4 and TCP6. However, best to be safe. I have also refactored service binding wrapper a bit. It's best to cleanup tcp4 protcol handles in it's own drop. @rustbot ready |
Add support for binding and accepting TCP4 connections. While testing, the following network options were used with QEMU + OVMF: -nic user,hostfwd=tcp::12345-:12345 The default localhost address on qemu seems to be 10.0.2.15. UEFI spec does not seem to state that the TCP Handle returned by the Accept method has a ServiceBinding Protocol. So have made the ServiceBinding Protocol optional. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
e2521f5
to
ba446c9
Compare
Add support for binding and accepting TCP4 connections.
While testing, the following network options were used with QEMU + OVMF: -nic user,hostfwd=tcp::12345-:12345
The default localhost address on qemu seems to be 10.0.2.15.
UEFI spec does not seem to state that the TCP Handle returned by the Accept method has a ServiceBinding Protocol. So have made the ServiceBinding Protocol optional.
cc @nicholasbishop