-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(isotp_sock.c): add CAN_ISOTP_WAIT_TX_DONE flag to ISOTP sockets #30
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @muehlke . Please address the feedback and consider adding yourself to AUTHORS.txt
test/test_tp_compliance.c
Outdated
// setup | ||
client = ENV_TpNew("client"); | ||
TPMockLogToStdout(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove these lines. They are not necessary and make the test fail on tp_c
// setup | |
client = ENV_TpNew("client"); | |
TPMockLogToStdout(); |
test/test_tp_compliance.c
Outdated
// teardown | ||
ENV_TpFree(client); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, please remove these lines.
// teardown | |
ENV_TpFree(client); |
test/test_tp_compliance.c
Outdated
int main() { | ||
const struct CMUnitTest tests[] = { | ||
// cmocka_unit_test_setup_teardown(TestSendRecv, setup, teardown), | ||
cmocka_unit_test_setup_teardown(TestSendRecvFunctional, setup, teardown), | ||
cmocka_unit_test_setup_teardown(TestISOTPSendLargestSingleFrame, setup, teardown), | ||
cmocka_unit_test_setup_teardown(TestISOTPSendLargerThanSingleFrameFails, setup, teardown), | ||
cmocka_unit_test_setup_teardown(TestISOTPSendRecvMaxLen, setup, teardown), | ||
cmocka_unit_test_setup_teardown(TestISOTPFlowControlFrameTimeout, NULL, NULL), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the default setup and teardown
cmocka_unit_test_setup_teardown(TestISOTPFlowControlFrameTimeout, NULL, NULL), | |
cmocka_unit_test_setup_teardown(TestISOTPFlowControlFrameTimeout, setup, teardown), |
test/test_tp_compliance.c
Outdated
// teardown | ||
ENV_TpFree(client); | ||
|
||
// -1 is expected as the elapsed 1s timeout raises an error on the ISOTP socket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make the comment match the assertion
// -1 is expected as the elapsed 1s timeout raises an error on the ISOTP socket | |
// failure is expected as the elapsed 1s timeout raises an error on the ISOTP socket |
As of now, an UDS client run on the Linux ISOTP kernel module was not able to recognize a timeout error of a Flow Control frame not arriving in time after a multi-frame request. To fix this, the flag CAN_ISOTP_WAIT_TX_DONE is set on the socket. Otherwise writing the bytes of the SEND buffer to the ISOTP socket would incorrectly return the expected SEND buffer size, creating further problems like e.g. a timeout waiting on the response of the "sent" request, since it was not really sent so the UDS server is not sending a response.
…n a client ISOTP socket with no responding server With this test it can be assured that by having set the CAN_ISOTP_WAIT_TX_DONE flag on an ISOTP socket a communication error will be raised after trying to send a multi-frame request to an UDS server that will not send a FC frame within 1s.
Hi @driftregion, could you please delete this pull request from the repo. I've made a new one #32. By mistake I committed with the wrong git username and email. I've pushed everything as you mentioned but with the right git username and email. |
As of now, an UDS client run on the Linux ISOTP kernel module was not able to recognize a timeout error of a Flow Control frame not arriving in time after a multi-frame request. To fix this, the flag CAN_ISOTP_WAIT_TX_DONE is set on the socket. Otherwise writing the bytes of the SEND buffer to the ISOTP socket would incorrectly return the expected SEND buffer size, creating further problems like e.g. a timeout waiting on the response of the "sent" request, since it was not really sent so the UDS server is not sending a response.