derek-will / SocketCANSharp

.NET managed wrapper for SocketCAN on Linux
BSD 3-Clause "New" or "Revised" License
54 stars 13 forks source link

Update ISO-TP Read When Not Bound Unit Test to handle improved implementation in Linux kernel #32

Closed derek-will closed 2 years ago

derek-will commented 2 years ago

Currently on kernel 5.16.19, IsoTpCanSocket_Read_SocketCanException_Failure_Test will fail due to an update in the Linux kernel as it now internally checks to see if the ISO-TP socket is bound prior to attempting to read from the socket. The old implementation without the check would result in an indefinite block or timeout depending on the configuration of the socket and whether the read call was blocking or not. This update instead has the read call quickly fail and set errno EADDRNOTAVAIL.

Previous code: https://elixir.bootlin.com/linux/v5.16.18/source/net/can/isotp.c#L1012 New code: https://elixir.bootlin.com/linux/v5.16.19/source/net/can/isotp.c#L1015

Related Issue: https://github.com/linux-can/can-utils/issues/349

This unit test needs to be updated to handle both the new implementation and the previous one.