firecracker icon indicating copy to clipboard operation
firecracker copied to clipboard

feat: Add SEQPACKET socket type support for vsock

Open sumansaurabh opened this issue 3 months ago • 0 comments

Summary

Implements SEQPACKET socket type support for virtio vsock to enable datagram relay use cases while preserving message boundaries.

Changes Made

  • Added VIRTIO_VSOCK_F_SEQPACKET feature flag support
  • Implemented SOCK_SEQPACKET socket type handling in vsock implementation
  • Added socket type validation to ensure host UDS matches vsock socket type
  • Enhanced connection logic to handle SEQPACKET connections appropriately

Why This Change

This addresses GitHub Issue #4822 by enabling VMs to relay datagrams over vsock while maintaining packet boundaries, which is not possible with SOCK_STREAM that combines messages together. This provides a more efficient solution than implementing custom packet boundaries within stream sockets.

Testing

Verified that:

  • SOCK_SEQPACKET connections can be established successfully
  • Socket type mismatches are properly rejected
  • Message boundaries are preserved in SEQPACKET mode

Fixes #4822


This PR was created from task: https://cloud.blackbox.ai/tasks/Nuype64zWauLUuobO0u01

sumansaurabh avatar Nov 08 '25 07:11 sumansaurabh