mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gnrc_ipv6_ext_frag: propagate error up the stack on _snd_buf_free()
This commit is contained in:
parent
6303d962a3
commit
3295c833ca
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "byteorder.h"
|
#include "byteorder.h"
|
||||||
@ -85,8 +86,9 @@ static gnrc_ipv6_ext_frag_send_t *_snd_buf_alloc(void);
|
|||||||
* datagrams and fragments.
|
* datagrams and fragments.
|
||||||
*
|
*
|
||||||
* @param[in] snd_buf A fragmentation send buffer entry
|
* @param[in] snd_buf A fragmentation send buffer entry
|
||||||
|
* @param[in] error Error number for the error causing the release
|
||||||
*/
|
*/
|
||||||
static void _snd_buf_free(gnrc_ipv6_ext_frag_send_t *snd_buf);
|
static void _snd_buf_free(gnrc_ipv6_ext_frag_send_t *snd_buf, int error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Removes a fragmentation send buffer without releasing the stored
|
* @brief Removes a fragmentation send buffer without releasing the stored
|
||||||
@ -175,7 +177,7 @@ void gnrc_ipv6_ext_frag_send(gnrc_ipv6_ext_frag_send_t *snd_buf)
|
|||||||
gnrc_pktbuf_release(ptr);
|
gnrc_pktbuf_release(ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_snd_buf_free(snd_buf);
|
_snd_buf_free(snd_buf, ENOSPC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ptr = tmp;
|
ptr = tmp;
|
||||||
@ -212,7 +214,7 @@ void gnrc_ipv6_ext_frag_send(gnrc_ipv6_ext_frag_send_t *snd_buf)
|
|||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
DEBUG("ipv6_ext_frag: unable to create fragmentation header\n");
|
DEBUG("ipv6_ext_frag: unable to create fragmentation header\n");
|
||||||
gnrc_pktbuf_release(to_send);
|
gnrc_pktbuf_release(to_send);
|
||||||
_snd_buf_free(snd_buf);
|
_snd_buf_free(snd_buf, ENOSPC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
remaining -= sizeof(ipv6_ext_frag_t);
|
remaining -= sizeof(ipv6_ext_frag_t);
|
||||||
@ -237,7 +239,7 @@ void gnrc_ipv6_ext_frag_send(gnrc_ipv6_ext_frag_send_t *snd_buf)
|
|||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
DEBUG("ipv6_ext_frag: packet buffer full, canceling fragmentation\n");
|
DEBUG("ipv6_ext_frag: packet buffer full, canceling fragmentation\n");
|
||||||
gnrc_pktbuf_release(to_send);
|
gnrc_pktbuf_release(to_send);
|
||||||
_snd_buf_free(snd_buf);
|
_snd_buf_free(snd_buf, ENOSPC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert(snd_buf->pkt->next == ptr); /* we just created it with mark */
|
assert(snd_buf->pkt->next == ptr); /* we just created it with mark */
|
||||||
@ -258,7 +260,7 @@ void gnrc_ipv6_ext_frag_send(gnrc_ipv6_ext_frag_send_t *snd_buf)
|
|||||||
if (msg_try_send(&msg, gnrc_ipv6_pid) <= 0) {
|
if (msg_try_send(&msg, gnrc_ipv6_pid) <= 0) {
|
||||||
DEBUG("ipv6_ext_frag: Unable to send fragment, canceling fragmentation\n");
|
DEBUG("ipv6_ext_frag: Unable to send fragment, canceling fragmentation\n");
|
||||||
gnrc_pktbuf_release(to_send);
|
gnrc_pktbuf_release(to_send);
|
||||||
_snd_buf_free(snd_buf);
|
_snd_buf_free(snd_buf, ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (last_fragment) {
|
if (last_fragment) {
|
||||||
@ -274,7 +276,7 @@ void gnrc_ipv6_ext_frag_send(gnrc_ipv6_ext_frag_send_t *snd_buf)
|
|||||||
msg.content.ptr = snd_buf;
|
msg.content.ptr = snd_buf;
|
||||||
if (msg_try_send(&msg, gnrc_ipv6_pid) <= 0) {
|
if (msg_try_send(&msg, gnrc_ipv6_pid) <= 0) {
|
||||||
DEBUG("ipv6_ext_frag: Unable to continue fragmentation, canceling\n");
|
DEBUG("ipv6_ext_frag: Unable to continue fragmentation, canceling\n");
|
||||||
_snd_buf_free(snd_buf);
|
_snd_buf_free(snd_buf, ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,13 +301,13 @@ static void _snd_buf_del(gnrc_ipv6_ext_frag_send_t *snd_buf)
|
|||||||
snd_buf->pkt = NULL;
|
snd_buf->pkt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _snd_buf_free(gnrc_ipv6_ext_frag_send_t *snd_buf)
|
static void _snd_buf_free(gnrc_ipv6_ext_frag_send_t *snd_buf, int error)
|
||||||
{
|
{
|
||||||
if (snd_buf->per_frag) {
|
if (snd_buf->per_frag) {
|
||||||
gnrc_pktbuf_release(snd_buf->per_frag);
|
gnrc_pktbuf_release(snd_buf->per_frag);
|
||||||
}
|
}
|
||||||
if (snd_buf->pkt) {
|
if (snd_buf->pkt) {
|
||||||
gnrc_pktbuf_release(snd_buf->pkt);
|
gnrc_pktbuf_release_error(snd_buf->pkt, error);
|
||||||
}
|
}
|
||||||
_snd_buf_del(snd_buf);
|
_snd_buf_del(snd_buf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user