From cc95939050dabf5283605a7ceda057b93ef16f8f Mon Sep 17 00:00:00 2001 From: Martine Lenders <mlenders@inf.fu-berlin.de> Date: Tue, 14 Apr 2015 17:09:07 +0200 Subject: [PATCH] pktdump: reply to netapi get/set Since some layers need to get options from their neighboring layers the previous behavior is potentially stack breaking when testing with this module since no reply is given to this requests, reply blocking the requesting thread in the process. --- sys/net/crosslayer/ng_pktdump/ng_pktdump.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/net/crosslayer/ng_pktdump/ng_pktdump.c b/sys/net/crosslayer/ng_pktdump/ng_pktdump.c index 2e794ca178..0d0d3db8d1 100644 --- a/sys/net/crosslayer/ng_pktdump/ng_pktdump.c +++ b/sys/net/crosslayer/ng_pktdump/ng_pktdump.c @@ -100,12 +100,15 @@ static void _dump(ng_pktsnip_t *pkt) static void *_eventloop(void *arg) { (void)arg; - msg_t msg; + msg_t msg, reply; msg_t msg_queue[NG_PKTDUMP_MSG_QUEUE_SIZE]; /* setup the message queue */ msg_init_queue(msg_queue, NG_PKTDUMP_MSG_QUEUE_SIZE); + reply.content.value = (uint32_t)(-ENOTSUP); + reply.type = NG_NETAPI_MSG_TYPE_ACK; + while (1) { msg_receive(&msg); @@ -118,6 +121,10 @@ static void *_eventloop(void *arg) puts("PKTDUMP: data to send:"); _dump((ng_pktsnip_t *)msg.content.ptr); break; + case NG_NETAPI_MSG_TYPE_GET: + case NG_NETAPI_MSG_TYPE_SET: + msg_reply(&msg, &reply); + break; default: puts("PKTDUMP: received something unexpected"); break; -- GitLab