Merge pull request #13244 from miri64/gnrc_ipv6_ext/enh/rbuf-do-not-override

gnrc_ipv6_ext_frag: add configuration option to keep oldest entry
This commit is contained in:
Martine Lenders 2020-02-03 13:23:20 +01:00 committed by GitHub
commit 02c16479cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -88,6 +88,19 @@ extern "C" {
#define CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US (10U * US_PER_SEC) #define CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US (10U * US_PER_SEC)
#endif #endif
/**
* @brief Do not override oldest datagram when reassembly buffer is full
*
* @note Only applicable with [gnrc_ipv6_ext_frag](@ref net_gnrc_ipv6_ext_frag) module
*
* When not set, it will cause the reassembly buffer to override the oldest
* entry when a fragment for a new datagram is received. When set to 1, no entry
* will be overwritten (they will still timeout normally)
*/
#ifdef DOXYGEN
#define CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_DO_NOT_OVERRIDE
#endif
/** @} **/ /** @} **/
/** /**

View File

@ -40,4 +40,11 @@ config GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US
help help
This value is expressed in microseconds. This value is expressed in microseconds.
config GNRC_IPV6_EXT_FRAG_RBUF_DO_NOT_OVERRIDE
bool "Do not override oldest datagram when reassembly buffer is full"
help
When not set, it will cause the reassembly buffer to override the oldest
entry when a fragment for a new datagram is received. When set to 1, no
entry will be overwritten (they will still timeout normally)
endif # KCONFIG_MODULE_GNRC_IPV6_EXT_FRAG endif # KCONFIG_MODULE_GNRC_IPV6_EXT_FRAG

View File

@ -557,7 +557,8 @@ gnrc_ipv6_ext_frag_rbuf_t *gnrc_ipv6_ext_frag_rbuf_get(ipv6_hdr_t *ipv6,
oldest = tmp; oldest = tmp;
} }
} }
if (res == NULL) { if ((res == NULL) &&
!IS_ACTIVE(CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_DO_NOT_OVERRIDE)) {
assert(oldest != NULL); /* reassembly buffer is full, so there needs assert(oldest != NULL); /* reassembly buffer is full, so there needs
* to be an oldest entry */ * to be an oldest entry */
DEBUG("ipv6_ext_frag: dropping oldest entry\n"); DEBUG("ipv6_ext_frag: dropping oldest entry\n");