summaryrefslogtreecommitdiff
path: root/src/vhost_user/slave_req_handler.rs
AgeCommit message (Collapse)Author
2021-03-03Fix clippy erros and warningsKeiichi Watanabe
Make `cargo clippy --all-features --all-targets` pass. Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
2021-03-01vhost_user: add more unit test casesLiu Jiang
Add more unit test cases for vhost-user protocol. Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-03-01vhost_user: use read_aligned() to access dataLiu Jiang
Use std::ptr::read_aligned() to safely access data buffer instead of directly accessing data struct in data buffer. Also enforce stricter message size validation. Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-03-01vhost_user: add VhostUserSlaveReqHandlerMut traitLiu Jiang
Rename the original VhostUserSlaveReqHandler trait as VhostUserSlaveReqHandlerMut, and add another VhostUserSlaveReqHandler trait with interior mutability. This also help to simplify caller implementations. Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-03-01vhost_user: fix a bug in SlaveReqHandlerLiu Jiang
An acknowlege reply message should be sent iif: 1) the VHOST_USER_PROTOCOL_F_REPLY_ACK feature is nogotiated, 2) the NEED_REPLY in header.flags is set. Also enforce stricter validation for message size. Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-03-01vhost_user: refine connection implementationLiu Jiang
Refine connection implementation by: 1) using "payload: &[u8]" for send_message_with_payload() 2) enabling all unit test cases Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2020-09-04vhost-user: Only check SLAVE_REQ for SLAVE_REQ_FDSergio Lopez
SLAVE_SEND_FD and SLAVE_REQ are different protocol features. Check for SLAVE_REQ instead. Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-09-04vhost-user: add the ability to set slave req fdLiu Bo
This adds the missing part of supporting virtiofs dax on the slave end, that is, receiving a socket pair fd from the master end to set up a communication channel for sending setupmapping & removemapping messages. Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
2020-09-04vhost-user: fix VhostUserConfig payload managementSergio Lopez
The VhostUserConfig carries a message with a payload, the contents of which depend on the kind of device being emulated. With this change, we calculate the offset of the payload within the message, check its size corresponds to the expected one, and pass it to the backend as a reference to a slice adjusted to the payload dimensions. The backend will be responsible of validating the payload, as it's the one aware of its expected contents. Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-09-04Implement vhost-user slave side endpointLiu Jiang
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel Prilik <daniel@prilik.com>