Closed surendersampath closed 1 year ago
PD does not handle the incoming FILE TX command from CP with flag set as
OSDP_CMD_FILE_TX_FLAG_CANCEL
.
OSDP_CMD_FILE_TX_FLAG_CANCEL
is not sent to the PD, it is consumed by CP to make the decision of sending the ABORT command. When the CP receives a command that has the cancel bit set, and no transfer is in progress (or the file ID does not match) we fail the command!
So, I suspect something else is causing the failure. What do you need to do to reproduce this issue? The best thing to do is to write a unit test that can reproduce this issue (everything needed to write such a test can be found here).
You can also generate CP and PD logs with packet trace enabled and log level set to debug. I can try to take a look and figure out what is going wrong.
Suggested FIX : Add file_state_reset(f); in the TX_Decode if any error(such as length mistmatch) occurs?
Since the failure is between LibOSDP CP <==> PD, I'd prefer to root cause and fix the bug properly rather than mask the issue by fixing the symptom with file_state_reset().
Thanks for looking into this. I'll try and re-create this issue using your unit test set up.
@surendersampath, I have a potential fix for this issue. For now, I'm closing this issue but feel free to re-open if you can still reproduce it.
Describe the bug PD does not handle the incoming FILE TX command from CP with flag set as
OSDP_CMD_FILE_TX_FLAG_CANCEL
. Decode fails as the length is lesser than expected. -------------At PD.-------------At CP.
Expected behavior PD to handle the the file transfer command with
OSDP_CMD_FILE_TX_FLAG_CANCEL
. Observed behavior A description of what happened.Additional context I'm using the below code snipped to abort an on-going file transfer.
Additional context
CP
andPD
. Binary is sent toCP
via OTA ANDCP
forwards it.Sequence is :
libosdp
.OSDP_FILE_INPROG
.Suggested FIX : Add
file_state_reset(f);
in the TX_Decode if any error(such as length mistmatch) occurs?