Skip to content
Snippets Groups Projects
Commit cc959390 authored by Martine Lenders's avatar Martine Lenders
Browse files

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.
parent e9fb853a
No related branches found
No related tags found
No related merge requests found
...@@ -100,12 +100,15 @@ static void _dump(ng_pktsnip_t *pkt) ...@@ -100,12 +100,15 @@ static void _dump(ng_pktsnip_t *pkt)
static void *_eventloop(void *arg) static void *_eventloop(void *arg)
{ {
(void)arg; (void)arg;
msg_t msg; msg_t msg, reply;
msg_t msg_queue[NG_PKTDUMP_MSG_QUEUE_SIZE]; msg_t msg_queue[NG_PKTDUMP_MSG_QUEUE_SIZE];
/* setup the message queue */ /* setup the message queue */
msg_init_queue(msg_queue, NG_PKTDUMP_MSG_QUEUE_SIZE); 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) { while (1) {
msg_receive(&msg); msg_receive(&msg);
...@@ -118,6 +121,10 @@ static void *_eventloop(void *arg) ...@@ -118,6 +121,10 @@ static void *_eventloop(void *arg)
puts("PKTDUMP: data to send:"); puts("PKTDUMP: data to send:");
_dump((ng_pktsnip_t *)msg.content.ptr); _dump((ng_pktsnip_t *)msg.content.ptr);
break; break;
case NG_NETAPI_MSG_TYPE_GET:
case NG_NETAPI_MSG_TYPE_SET:
msg_reply(&msg, &reply);
break;
default: default:
puts("PKTDUMP: received something unexpected"); puts("PKTDUMP: received something unexpected");
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment