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

Add vfkit support #231

Merged
merged 2 commits into from
Jun 22, 2023
Merged

Add vfkit support #231

merged 2 commits into from
Jun 22, 2023

Conversation

cfergeau
Copy link
Contributor

@cfergeau cfergeau commented Jun 7, 2023

Communication must happen over a connected datagram unix socket. This
reuses most of the work which was done for bess.
Since there is no 'accept' with unixgram sockets which could be used to
get the address to send the data back to (ie the VM address), this adds
a handshake between the VM and gvproxy:

  • gvproxy listens on a unixgram socket at a known location
  • vfkit connects to this location
  • vfkit sends "VFKT"
  • gvproxy receives this message and gets the VM address from it
  • network traffic can now happen between gvproxy and vfkit

@openshift-ci openshift-ci bot added the approved label Jun 7, 2023
@cfergeau
Copy link
Contributor Author

cfergeau commented Jun 7, 2023

The corresponding vfkit code can be found in https://github.com/cfergeau/vfkit/tree/gvproxy

@gbraad gbraad self-requested a review June 7, 2023 17:27
@@ -101,6 +105,18 @@ func main() {
exitWithError(errors.Errorf("%q already exists", uri.Path))
}
}
Copy link
Member

Choose a reason for hiding this comment

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

all other sockets compare to "" to determine empty. why length?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The blocks just above if len(vfkitSocket) > 0 { ... } are if len(qemuSocket) > 0 { ... } and if len(bessSocket) > 0 { ... }.

There are "" comparisons after this block but for a different purpose (error checks for conflicting options) which I forgot to add to this PR, I'll do this.

@@ -124,6 +140,9 @@ func main() {
if bessSocket != "" {
protocol = types.BessProtocol
}
if vfkitSocket != "" {
Copy link
Member

Choose a reason for hiding this comment

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

this seems it can be combined with previous check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took a very basic approach, and added an additional block where there were pre-existing references to qemuSocket and bessSocket. All of this could probably be refactored/simplified, but I haven't thought about it.

Communication must happen over a connected datagram unix socket. This
reuses most of the work which was done for bess.
Since there is no 'accept' with unixgram sockets which could be used to
get the address to send the data back to (ie the VM address), this adds
a handshake between the VM and gvproxy:
- gvproxy listens on a unixgram socket at a known location
- vfkit connects to this location
- vfkit sends "VFKT"
- gvproxy receives this message and gets the VM address from it
- network traffic can now happen between gvproxy and vfkit

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
It defines multiple protocols, not just one.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
@baude
Copy link
Member

baude commented Jun 22, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Jun 22, 2023
@baude baude self-requested a review June 22, 2023 14:00
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude, cfergeau

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants