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 packet boundaries.
Changes
- Added SEQPACKET socket type handling in vsock implementation
- Enhanced socket type validation to ensure host UDS matches vsock socket type
- Updated connection logic to support both SOCK_STREAM and SOCK_SEQPACKET
- Added proper error handling for socket type mismatches
Motivation
This change addresses the need for VMs to relay datagrams over vsock while maintaining packet boundaries, which SOCK_STREAM cannot provide as it combines packets together. The VIRTIO_VSOCK_F_SEQPACKET feature is part of the virtio specification v1.2.
Testing
- Verified SEQPACKET socket creation and connection
- Tested socket type validation between vsock and host UDS
- Ensured backward compatibility with existing SOCK_STREAM functionality
Fixes #4822
This PR was created from task: https://cloud.blackbox.ai/tasks/aXNtIycyRzvQrn_QJWmGj