Skip to content

Commit

Permalink
gnrc: replace ng_pktbuf_add() with ng_pktbuf_mark() where it's needed
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Jul 25, 2015
1 parent 5ac7f39 commit e655e98
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions sys/net/application_layer/ng_zep/ng_zep.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ static ng_pktsnip_t *_create_received(ng_zep_t *dev, ng_pktsnip_t *pkt,
return NULL;
}

payload = ng_pktbuf_add(pkt, pkt->data, pkt->size - 2, dev->proto);
payload = ng_pktbuf_mark(pkt, pkt->size - 2, dev->proto);

if (payload == NULL) {
return NULL;
Expand All @@ -742,7 +742,7 @@ static ng_pktsnip_t *_create_received(ng_zep_t *dev, ng_pktsnip_t *pkt,
return NULL;
}

mhr = ng_pktbuf_add(pkt, pkt->data, mhr_len, NG_NETTYPE_UNDEF);
mhr = ng_pktbuf_mark(pkt, mhr_len, NG_NETTYPE_UNDEF);

/* TODO: send ACK */

Expand Down Expand Up @@ -776,7 +776,7 @@ static ng_pktsnip_t *_recv_v1(ng_zep_t *dev, ng_pktsnip_t *pkt)
return NULL;
}

zep = ng_pktbuf_add(pkt, pkt->data, sizeof(ng_zep_v1_hdr_t), NG_NETTYPE_UNDEF);
zep = ng_pktbuf_mark(pkt, sizeof(ng_zep_v1_hdr_t), NG_NETTYPE_UNDEF);

if (zep == NULL) {
return NULL;
Expand Down Expand Up @@ -807,7 +807,7 @@ static ng_pktsnip_t *_recv_v2(ng_zep_t *dev, ng_pktsnip_t *pkt)
return NULL;
}

zep = ng_pktbuf_add(pkt, pkt->data, sizeof(ng_zep_v2_data_hdr_t), NG_NETTYPE_UNDEF);
zep = ng_pktbuf_mark(pkt, sizeof(ng_zep_v2_data_hdr_t), NG_NETTYPE_UNDEF);

if (zep == NULL) {
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool ng_ipv6_ext_demux(kernel_pid_t iface, ng_pktsnip_t *pkt,
}
}

ext_snip = ng_pktbuf_add(pkt, pkt->data, offset, NG_NETTYPE_IPV6);
ext_snip = ng_pktbuf_mark(pkt, offset, NG_NETTYPE_IPV6);

if (ext_snip == NULL) {
return false;
Expand Down
3 changes: 1 addition & 2 deletions sys/net/network_layer/ng_ipv6/ng_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,7 @@ static void _receive(ng_pktsnip_t *pkt)

pkt = ipv6; /* reset pkt from temporary variable */

ipv6 = ng_pktbuf_add(pkt, pkt->data, sizeof(ng_ipv6_hdr_t),
NG_NETTYPE_IPV6);
ipv6 = ng_pktbuf_mark(pkt, sizeof(ng_ipv6_hdr_t), NG_NETTYPE_IPV6);

if (ipv6 == NULL) {
DEBUG("ipv6: error marking IPv6 header, dropping packet\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ bool ng_sixlowpan_iphc_decode(ng_pktsnip_t *pkt)
/* TODO: add next header decoding */

/* remove 6LoWPAN dispatch */
payload = ng_pktbuf_add(pkt, pkt->data, payload_offset, NG_NETTYPE_SIXLOWPAN);
payload = ng_pktbuf_mark(pkt, payload_offset, NG_NETTYPE_SIXLOWPAN);
pkt = ng_pktbuf_remove_snip(pkt, payload);

/* set IPv6 header payload length field to the length of whatever is left
Expand Down
3 changes: 1 addition & 2 deletions sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ static void _receive(ng_pktsnip_t *pkt)
}

/* packet is uncompressed: just mark and remove the dispatch */
sixlowpan = ng_pktbuf_add(payload, payload->data, sizeof(uint8_t),
NG_NETTYPE_SIXLOWPAN);
sixlowpan = ng_pktbuf_mark(payload, sizeof(uint8_t), NG_NETTYPE_SIXLOWPAN);

if (sixlowpan == NULL) {
DEBUG("6lo: can not mark 6LoWPAN dispatch\n");
Expand Down
2 changes: 1 addition & 1 deletion sys/net/transport_layer/ng_udp/ng_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static void _receive(ng_pktsnip_t *pkt)
return;
}
pkt = udp;
udp = ng_pktbuf_add(pkt, pkt->data, sizeof(ng_udp_hdr_t), NG_NETTYPE_UDP);
udp = ng_pktbuf_mark(pkt, sizeof(ng_udp_hdr_t), NG_NETTYPE_UDP);
if (udp == NULL) {
DEBUG("udp: error marking UDP header, dropping packet\n");
ng_pktbuf_release(pkt);
Expand Down

0 comments on commit e655e98

Please sign in to comment.