Merged in antmerlino/nuttx/sixlowpan-d_buf-fix (pull request #795)

net/sixlowpan: Record and restore d_buf on entry/exit of sixlowpan_input. This avoids an issue where d_buf gets set to NULL by sixlowpan, and then is used by forwarding logic from another network interface before getting set back to the drivers internal b

Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino 2018-12-26 16:33:44 +00:00 committed by GregoryN
parent cdd42f6e5d
commit 5e1055dbfa
1 changed files with 11 additions and 0 deletions

View File

@ -716,9 +716,16 @@ int sixlowpan_input(FAR struct radio_driver_s *radio,
FAR struct iob_s *framelist, FAR const void *metadata)
{
int ret = -EINVAL;
uint8_t *d_buf_backup;
DEBUGASSERT(radio != NULL && framelist != NULL);
/* Sixlowpan modifies the d_buf to process fragments using reassembly buffers.
* Save the value of d_buf on entry and set it back before returning
*/
d_buf_backup = radio->r_dev.d_buf;
/* Verify that an frame has been provided. */
while (framelist != NULL)
@ -856,6 +863,10 @@ drop:
}
}
/* Restore the d_buf back to it's original state */
radio->r_dev.d_buf = d_buf_backup;
return ret;
}