mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
gnrc_sixlowpan_frag_vrb: fix for draft update
Due to some changes to the minimal forwarding draft and in preparation for Selective Fragment Recovery some changes to the VRB API were needed. Now the index of a VRB entry is only (L2 src, tag) not as before (L2 src, L2 dst, length, tag). I know that the current `rbuf_base` causes waste, as all the fields not used by the new index are effectively not used by the VRB. I'd like to fix that however in a later change, since that also requires some modifications of the classic reassembly buffer, and thus would complicate the review and testing of the change. Sources for the index change: - https://tools.ietf.org/html/draft-ietf-6lo-minimal-fragment-04#section-1 - https://mailarchive.ietf.org/arch/browse/6lo/?gbt=1&index=DLCTxC2X4bRNtYPHhtEkavMWlz4
This commit is contained in:
parent
fb8b8ad8dc
commit
45f7966364
@ -89,10 +89,6 @@ void gnrc_sixlowpan_frag_vrb_gc(void);
|
||||
*
|
||||
* @param[in] src Link-layer source address of the original fragment.
|
||||
* @param[in] src_len Length of @p src.
|
||||
* @param[in] dst Link-layer destination address of the original
|
||||
* fragment.
|
||||
* @param[in] dst_len Length of @p dst.
|
||||
* @param[in] datagram_size The original fragment's datagram size.
|
||||
* @param[in] src_tag Tag of the original fragment.
|
||||
*
|
||||
* @return The VRB entry identified by the given parameters.
|
||||
@ -100,9 +96,7 @@ void gnrc_sixlowpan_frag_vrb_gc(void);
|
||||
* by the given parameters.
|
||||
*/
|
||||
gnrc_sixlowpan_frag_vrb_t *gnrc_sixlowpan_frag_vrb_get(
|
||||
const uint8_t *src, size_t src_len,
|
||||
const uint8_t *dst, size_t dst_len,
|
||||
size_t datagram_size, unsigned src_tag);
|
||||
const uint8_t *src, size_t src_len, unsigned src_tag);
|
||||
|
||||
/**
|
||||
* @brief Removes an entry from the VRB
|
||||
@ -114,8 +108,8 @@ static inline void gnrc_sixlowpan_frag_vrb_rm(gnrc_sixlowpan_frag_vrb_t *vrb)
|
||||
#ifdef MODULE_GNRC_SIXLOWPAN_FRAG
|
||||
gnrc_sixlowpan_frag_rb_base_rm(&vrb->super);
|
||||
#elif defined(TEST_SUITES)
|
||||
/* for testing just zero datagram_size */
|
||||
vrb->super.datagram_size = 0;
|
||||
/* for testing just zero src_len */
|
||||
vrb->super.src_len = 0;
|
||||
#endif /* MODULE_GNRC_SIXLOWPAN_FRAG */
|
||||
}
|
||||
|
||||
@ -129,7 +123,7 @@ static inline void gnrc_sixlowpan_frag_vrb_rm(gnrc_sixlowpan_frag_vrb_t *vrb)
|
||||
*/
|
||||
static inline bool gnrc_sixlowpan_frag_vrb_entry_empty(gnrc_sixlowpan_frag_vrb_t *vrb)
|
||||
{
|
||||
return (vrb->super.datagram_size == 0);
|
||||
return (vrb->super.src_len == 0);
|
||||
}
|
||||
|
||||
#if defined(TEST_SUITES) || defined(DOXYGEN)
|
||||
|
@ -82,24 +82,16 @@ gnrc_sixlowpan_frag_vrb_t *gnrc_sixlowpan_frag_vrb_add(
|
||||
}
|
||||
|
||||
gnrc_sixlowpan_frag_vrb_t *gnrc_sixlowpan_frag_vrb_get(
|
||||
const uint8_t *src, size_t src_len,
|
||||
const uint8_t *dst, size_t dst_len,
|
||||
size_t datagram_size, unsigned src_tag)
|
||||
const uint8_t *src, size_t src_len, unsigned src_tag)
|
||||
{
|
||||
DEBUG("6lo vrb: trying to get entry for (%s, ",
|
||||
gnrc_netif_addr_to_str(src, src_len, l2addr_str));
|
||||
DEBUG("%s, %u, %u)\n",
|
||||
gnrc_netif_addr_to_str(dst, dst_len, l2addr_str),
|
||||
(unsigned)datagram_size, src_tag);
|
||||
DEBUG("6lo vrb: trying to get entry for (%s, %u)\n",
|
||||
gnrc_netif_addr_to_str(src, src_len, l2addr_str), src_tag);
|
||||
for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) {
|
||||
gnrc_sixlowpan_frag_vrb_t *vrbe = &_vrb[i];
|
||||
|
||||
if ((vrbe->super.datagram_size == datagram_size) &&
|
||||
(vrbe->super.tag == src_tag) &&
|
||||
if ((vrbe->super.tag == src_tag) &&
|
||||
(vrbe->super.src_len == src_len) &&
|
||||
(vrbe->super.dst_len == dst_len) &&
|
||||
(memcmp(vrbe->super.src, src, src_len) == 0) &&
|
||||
(memcmp(vrbe->super.dst, dst, dst_len) == 0)) {
|
||||
(memcmp(vrbe->super.src, src, src_len) == 0)) {
|
||||
DEBUG("6lo vrb: got VRB to (%s, %u)\n",
|
||||
gnrc_netif_addr_to_str(vrbe->out_dst,
|
||||
vrbe->out_dst_len,
|
||||
|
Loading…
Reference in New Issue
Block a user