OpenC3 / openc3-cosmos-cfdp

Other
1 stars 1 forks source link

PDU CRC length not included in the data length field #7

Closed avan989 closed 10 months ago

avan989 commented 10 months ago

According to the blue book 727.0-B-5 section 4.1.3.2, the CRC is supposed to be included in the data length field. It looks like the CFDP engine is not taking into account the CRC length (if calculated).

4.1.3.2 The CRC value shall be placed in the final octets of the PDU data field, and its
length shall be included in the PDU data field length. The CRC algorithm shall be applied
from the first octet of the PDU header to the last octet of the PDU data field prior to the CRC
value. 

Example:

https://github.com/OpenC3/openc3-cosmos-cfdp/blob/0994d0eea9161b0af0619e8e45df67904a66b497/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_file_data.rb#L45-L56

ryanmelt commented 10 months ago

The early pdu.length does include the two bytes for the CRC, so those two bytes should not be subtracted out of PDU_DATA_LENGTH.

ryanmelt commented 10 months ago

closed by #6