Skip to content

Commit

Permalink
Merge pull request #176 from jphickey/fix-172-decode-nak
Browse files Browse the repository at this point in the history
Fix #172, restore call to CF_CFDP_RecvNak
  • Loading branch information
astrogeco authored Jan 18, 2022
2 parents d04e98c + 2579b0c commit a590eeb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fsw/src/cf_cfdp_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph)
/* this function is only invoked for NAK PDU types */
nak = &ph->int_header.nak;

if (nak->segment_list.num_segments > 0)
if (CF_CFDP_RecvNak(t, ph) == 0 && nak->segment_list.num_segments > 0)
{
for (counter = 0; counter < nak->segment_list.num_segments; ++counter)
{
Expand Down
9 changes: 9 additions & 0 deletions unit-test/cf_cfdp_s_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,15 @@ void Test_CF_CFDP_S2_Nak(void)
UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph));
UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 6);
UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_INVALID_SR);

/* bad decode */
UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL);
UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvNak), 1, -1);
nak = &ph->int_header.nak;
nak->segment_list.num_segments = 1;
UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph));
UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 2);
UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_PDU_NAK);
}

void Test_CF_CFDP_S2_Nak_Arm(void)
Expand Down

0 comments on commit a590eeb

Please sign in to comment.