From 04d7154300befeac4929cfd41a75f2e663fcb488 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Sat, 25 Jul 2015 02:14:42 +0200 Subject: [PATCH] gnrc: replace ng_pktbuf_add() with ng_pktbuf_mark() where it's needed --- sys/net/application_layer/ng_zep/ng_zep.c | 8 ++++---- sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c | 2 +- sys/net/network_layer/ng_ipv6/ng_ipv6.c | 3 +-- .../network_layer/ng_sixlowpan/iphc/ng_sixlowpan_iphc.c | 2 +- sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c | 3 +-- sys/net/transport_layer/ng_udp/ng_udp.c | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/sys/net/application_layer/ng_zep/ng_zep.c b/sys/net/application_layer/ng_zep/ng_zep.c index 4b3a887440e33..4c53efd79c6d9 100644 --- a/sys/net/application_layer/ng_zep/ng_zep.c +++ b/sys/net/application_layer/ng_zep/ng_zep.c @@ -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; @@ -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 */ @@ -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; @@ -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; diff --git a/sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c b/sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c index 1f746e0ad0f0e..f1b6ef95409de 100644 --- a/sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c +++ b/sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c @@ -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; diff --git a/sys/net/network_layer/ng_ipv6/ng_ipv6.c b/sys/net/network_layer/ng_ipv6/ng_ipv6.c index 328d7f5ebb39b..5deee0c335c49 100644 --- a/sys/net/network_layer/ng_ipv6/ng_ipv6.c +++ b/sys/net/network_layer/ng_ipv6/ng_ipv6.c @@ -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"); diff --git a/sys/net/network_layer/ng_sixlowpan/iphc/ng_sixlowpan_iphc.c b/sys/net/network_layer/ng_sixlowpan/iphc/ng_sixlowpan_iphc.c index eb29da9a89b2d..9fe0043f4dffc 100644 --- a/sys/net/network_layer/ng_sixlowpan/iphc/ng_sixlowpan_iphc.c +++ b/sys/net/network_layer/ng_sixlowpan/iphc/ng_sixlowpan_iphc.c @@ -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 diff --git a/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c b/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c index f2c60f199e3b7..2cfa09986b9a9 100644 --- a/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c +++ b/sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c @@ -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"); diff --git a/sys/net/transport_layer/ng_udp/ng_udp.c b/sys/net/transport_layer/ng_udp/ng_udp.c index 4e3f0ce27dae9..5910bf19c3bbc 100644 --- a/sys/net/transport_layer/ng_udp/ng_udp.c +++ b/sys/net/transport_layer/ng_udp/ng_udp.c @@ -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);