Skip to content

Commit

Permalink
[SQUASH ME] ng_sixlowpan: this was supposed to be temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Apr 9, 2015
1 parent 2a3ad06 commit 2841b18
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@
#include "net/ng_netbase.h"
#include "thread.h"
#include "utlist.h"
#include "od.h"

#include "net/ng_sixlowpan.h"

#define ENABLE_DEBUG (1)
#define ENABLE_DEBUG (0)
#include "debug.h"

static kernel_pid_t _sixlowpan_pid = KERNEL_PID_UNDEF;
static char _sixlowpan_stack[NG_SIXLOWPAN_STACK_SIZE];

void _handle_receive(ng_pktsnip_t *pkt)
{
ng_pktsnip_t *sixlowpan, *payload;
ng_pktsnip_t *payload;
uint8_t *dispatch;
ng_netreg_entry_t *entry;

Expand All @@ -39,23 +38,23 @@ void _handle_receive(ng_pktsnip_t *pkt)
ng_pktbuf_release(pkt);
}

payload = ng_pktbuf_start_write(payload);
dispatch = payload->data;

if (payload == NULL) {
DEBUG("sixlowpan: no space left in packet buffer\n");
if (dispatch[0] == NG_SIXLOWPAN_DISPATCH_IPV6) {
payload = ng_pktbuf_start_write(payload);

if (payload == NULL) {
DEBUG("sixlowpan: no space left in packet buffer\n");
#if defined(DEVELHELP) && defined(ENABLE_DEBUG)
ng_pktbuf_stats();
ng_pktbuf_stats();
#endif
ng_pktbuf_release(pkt);
return;
}

dispatch = payload->data;
ng_pktbuf_release(pkt);
return;
}

if (dispatch[0] == NG_SIXLOWPAN_DISPATCH_IPV6) {
/* packet is uncompressed: just mark and remove the dispatch */
sixlowpan = ng_pktbuf_add(payload, payload->data, sizeof(uint8_t),
NG_NETTYPE_SIXLOWPAN);
ng_pktsnip_t *sixlowpan = ng_pktbuf_add(payload, payload->data, sizeof(uint8_t),
NG_NETTYPE_SIXLOWPAN);
LL_DELETE(pkt, sixlowpan);
ng_pktbuf_release(sixlowpan);
}
Expand Down Expand Up @@ -133,11 +132,6 @@ void _handle_send(ng_pktsnip_t *pkt)
disp = sixlowpan->data;
disp[0] = NG_SIXLOWPAN_DISPATCH_IPV6;

while (sixlowpan) {
od_hex_dump(sixlowpan->data, sixlowpan->size, 0);
sixlowpan = sixlowpan->next;
}

DEBUG("sixlowpan: Send receive command for %p to %" PRIu16 "\n",
(void *)pkt, hdr->if_pid);
ng_netapi_send(hdr->if_pid, pkt);
Expand Down

0 comments on commit 2841b18

Please # to comment.