vhost-device-can: use the same socket for send/recv#937
vhost-device-can: use the same socket for send/recv#937MatiasVara wants to merge 5 commits intorust-vmm:mainfrom
Conversation
|
When fixing this, some tests started to fail since now the opening of the socket is happening in new(). Before, those tests did not require to open a socket to work. I fixed those tests by adding a few commits together with the fix. I wonder if these tests should be fixed here or in another PR. |
|
To run the tests, we require a virtual can interface in the host named |
Is this something new (i.e. added here) or was there before this PR? |
It was in the code before but it was not being tested. The tests were done to not use a can interface. I am not sure if that was done on purpose. |
|
I think we should wrap the CanFdSocket field into an enum, and add a This way we can add support in the future for classic Can sockets (i.e. not FD) which is something I wanted to do anyway. |
Maybe to avoid updating the container image xD (I have no idea). |
If the linux images contain the |
Thanks! I'll try that. I did not get it completely yet though. |
Use the same socket for send/receive in the backend to prevent the guest from receiving two copies of the message when it sends to the local CAN bus. Fix tests and remove test_can_read_socket_fail() test since read_can_socket() does not open the socket anymore. Fixes rust-vmm#925 Reported-by: Francesco Valla <francesco@valla.it> Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
Most of the tests were using `can0` as interface but some used `can`. Use `can0` interface for all tests and `canx` for those that expect an interface down. Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
To support 64 bytes packet, set CAN_FRMF_TYPE_FD flag in test_can_controller_operation test. Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
Rename this test that previously had to fail since the interface was down. The previous test was testing the NoOutputInterface path which does not exist anymore. Make the test pass when transmission succeeds. Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
Add a mock socket for tests so that tests no longer require a CAN interface on the host. Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
|
The PR has now a wider scope :(. I am OK to split if it is required. Bear in mind that I used Claude for the last commit. Claude proposed a single builder for both socket types but I ignored it for the moment. |
Summary of the PR
Use the same socket for send/receive in the backend to prevent guest to receiving two copies of the message when it sends to the local CAN bus.
Fixes #925
Reported-by: Francesco Valla francesco@valla.it
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafecode is properly documented.