Skip to content
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

Model TCP protocol and implement a client #1130

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

codyd51
Copy link

@codyd51 codyd51 commented Apr 14, 2024

Hi!

Following up on this discussion in UEFIRC, a downstream consumer of uefi-rs in which I implemented a UEFI TCP client, this PR ports this TCP protocol modelling / client implementation to uefi-rs proper.

I made a basic effort to triage some things that were directly modelled with no accoutrements into uefi-raw, but I'm sure more can be moved here. It would be nice to place types such as TCPv4Protocol in uefi-raw, but this currently contains 'client business logic' and therefore is placed in uefi.

Here are some samples on how the client introduced in this PR can be used to communicate over TCP:

Notes

  • I believe the TCPv4* types introduced by this PR should be renamed to Tcpv4 or Tcp4 for consistency across the project?
  • Ip4RouteTable (and the Ip4IcmpType, Ip4ModeData, and Ip4ConfigData types introduced by this PR) should perhaps be renamed to Ipv4* for consistency with Ipv4Address.
  • I made a fair bit of effort during the development of this code to squash memory leaks, UAFs, and other shenanigans. However, I am not absolutely certain that no issues exist. The code works fine for my use case (mostly receiving, occasional transmitting) and I have not noticed memory leaks.
  • The client implementation is incomplete. For example, I have not bothered to implement acting as a TCP server.
  • The client code currently contains some 'business logic' that may not be desirable to include in uefi-rs, or may not be desirable to include as-is. For example, the client currently internally waits up to 10 seconds for a DHCP-assigned IP. You might wish to just include the protocol definitions in uefi-raw and omit all the business logic, which would be fine and makes sense.

Thank you for taking the time to get this PR ready for upstream inclusion!

Checklist

  • [☑️] Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • [☑️] Update the changelog (if necessary)

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.

None yet

1 participant