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

Connect to gvproxy socket #263

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

nirs
Copy link

@nirs nirs commented Feb 4, 2025

Connecting to the socket set the remote address so we can use
send()/recv() or write()/read() instead of sendto()/recvfrom().

Advantages:

  • Simpler code, no need to keep the remote address.
  • The server will want to connect to the client address to ensure it
    receives frames only from the connected client. Such server will want
    to remove the unix socket once the client connected[2], which doe snot
    work with current code.
  • Once the socket is connected, the same backend can be used to handle
    passed file descriptor[1].
  • iperf3 -R is 1.33 times faster (46.6 Gbits/s vs 35.0 Gbits/s).

Tested with:

  • gvproxy
  • vmnet-helper

For testing results see
#264 (comment)

[1] containers/krunkit#24
[2] https://github.com/nirs/vmnet-helper/blob/5c6a595ba3e76314e1d0bef2b0160388439d69ec/helper.c#L475

Copy link
Member

@tylerfanelli tylerfanelli left a comment

Choose a reason for hiding this comment

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

Small nit. Otherwise LGTM.

src/devices/src/virtio/net/gvproxy.rs Outdated Show resolved Hide resolved
Connecting to the socket sets the remote address so we can use
send()/recv() or write()/read() instead of sendto()/recvfrom().

Advantages:
- Simpler code, no need to keep the remote address.
- The server will want to connect to the client address to ensure it
  receives frames only from the connected client. Such server will want
  to remove the unix socket once the client connected[2], which doe snot
  work with current code.
- Once the socket is connected, the same backend can be used to handle
  passed file descriptor[1].
- iperf3 -R is 1.33 times faster (46.6 Gbits/s vs 35.0 Gbits/s).

Tested with:
- [x] gvproxy
- [x] vmnet-helper

For testing results see
containers#264 (comment)

[1] containers/krunkit#24
[2] https://github.com/nirs/vmnet-helper/blob/5c6a595ba3e76314e1d0bef2b0160388439d69ec/helper.c#L475

Signed-off-by: Nir Soffer <[email protected]>
@slp
Copy link
Contributor

slp commented Feb 7, 2025

There was a reason why we couldn't connect and needed to keep the peer_addr around, but I can't remember why now. I'll take a deeper look next week.

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.

4 participants