firecracker
firecracker copied to clipboard
feat: Add SEQPACKET socket type support for vsock
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