Browse Source

ipv6: move non-GNRC types and functions in their own modules

dev/timer
Martine Lenders 8 years ago
parent
commit
4f650b31f9
  1. 13
      Makefile.dep
  2. 18
      sys/Makefile
  3. 2
      sys/include/net/ipv6.h
  4. 64
      sys/include/net/ipv6/ext.h
  5. 20
      sys/include/net/ipv6/ext/rh.h
  6. 311
      sys/include/net/ipv6/hdr.h
  7. 2
      sys/include/net/ng_icmpv6.h
  8. 6
      sys/include/net/ng_icmpv6/echo.h
  9. 1
      sys/include/net/ng_icmpv6/error.h
  10. 36
      sys/include/net/ng_ipv6/ext.h
  11. 280
      sys/include/net/ng_ipv6/hdr.h
  12. 4
      sys/include/net/ng_ndp.h
  13. 5
      sys/include/net/ng_ndp/internal.h
  14. 3
      sys/include/net/ng_rpl/srh.h
  15. 2
      sys/include/net/protnum.h
  16. 4
      sys/net/crosslayer/ng_pktdump/ng_pktdump.c
  17. 9
      sys/net/link_layer/ng_netdev_eth/ng_netdev_eth.c
  18. 4
      sys/net/link_layer/ng_slip/ng_slip.c
  19. 2
      sys/net/network_layer/ipv6/ext/rh/Makefile
  20. 8
      sys/net/network_layer/ipv6/ext/rh/ipv6_ext_rh.c
  21. 3
      sys/net/network_layer/ipv6/hdr/Makefile
  22. 13
      sys/net/network_layer/ipv6/hdr/ipv6_hdr_print.c
  23. 2
      sys/net/network_layer/ng_icmpv6/echo/ng_icmpv6_echo.c
  24. 9
      sys/net/network_layer/ng_icmpv6/ng_icmpv6.c
  25. 20
      sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c
  26. 6
      sys/net/network_layer/ng_ipv6/hdr/ng_ipv6_hdr.c
  27. 18
      sys/net/network_layer/ng_ipv6/ng_ipv6.c
  28. 7
      sys/net/network_layer/ng_ndp/ng_ndp.c
  29. 44
      sys/net/network_layer/ng_sixlowpan/iphc/ng_sixlowpan_iphc.c
  30. 10
      sys/net/network_layer/ng_sixlowpan/ng_sixlowpan_print.c
  31. 7
      sys/net/transport_layer/ng_udp/ng_udp.c
  32. 1
      tests/unittests/tests-ipv6_hdr/Makefile.include
  33. 40
      tests/unittests/tests-ipv6_hdr/tests-ipv6_hdr.c

13
Makefile.dep

@ -108,19 +108,24 @@ ifneq (,$(filter ng_icmpv6,$(USEMODULE)))
endif
ifneq (,$(filter ng_ipv6_hdr,$(USEMODULE)))
USEMODULE += inet_csum
USEMODULE += ipv6_hdr
USEMODULE += ng_pktbuf
endif
ifneq (,$(filter ipv6_hdr,$(USEMODULE)))
USEMODULE += inet_csum
endif
ifneq (,$(filter ng_rpl_srh,$(USEMODULE)))
USEMODULE += ng_ipv6_ext_rh
USEMODULE += ipv6_ext_rh
endif
ifneq (,$(filter ng_ipv6_ext_rh,$(USEMODULE)))
USEMODULE += ng_ipv6_ext
ifneq (,$(filter ipv6_ext_rh,$(USEMODULE)))
USEMODULE += ipv6_ext
endif
ifneq (,$(filter ng_ipv6_ext,$(USEMODULE)))
USEMODULE += ipv6_ext
USEMODULE += ng_ipv6
endif

18
sys/Makefile

@ -16,6 +16,18 @@ endif
ifneq (,$(filter oneway_malloc,$(USEMODULE)))
DIRS += oneway-malloc
endif
ifneq (,$(filter ipv6_addr,$(USEMODULE)))
DIRS += net/network_layer/ipv6/addr
endif
ifneq (,$(filter ipv6_ext_rh,$(USEMODULE)))
DIRS += net/network_layer/ipv6/ext/rh
endif
ifneq (,$(filter ipv6_ext,$(USEMODULE)))
DIRS += net/network_layer/ipv6/ext
endif
ifneq (,$(filter ipv6_hdr,$(USEMODULE)))
DIRS += net/network_layer/ipv6/hdr
endif
ifneq (,$(filter ng_icmpv6,$(USEMODULE)))
DIRS += net/network_layer/ng_icmpv6
endif
@ -25,15 +37,9 @@ endif
ifneq (,$(filter ng_ipv6,$(USEMODULE)))
DIRS += net/network_layer/ng_ipv6
endif
ifneq (,$(filter ipv6_addr,$(USEMODULE)))
DIRS += net/network_layer/ipv6/addr
endif
ifneq (,$(filter ng_ipv6_ext,$(USEMODULE)))
DIRS += net/network_layer/ng_ipv6/ext
endif
ifneq (,$(filter ng_ipv6_ext_rh,$(USEMODULE)))
DIRS += net/network_layer/ng_ipv6/ext/rh
endif
ifneq (,$(filter ng_ipv6_hdr,$(USEMODULE)))
DIRS += net/network_layer/ng_ipv6/hdr
endif

2
sys/include/net/ipv6.h

@ -25,6 +25,8 @@
#define IPV6_H_
#include "ipv6/addr.h"
#include "ipv6/ext.h"
#include "ipv6/hdr.h"
#ifdef __cplusplus
extern "C" {

64
sys/include/net/ipv6/ext.h

@ -0,0 +1,64 @@
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup net_ipv6_ext IPv6 extension headers
* @ingroup net_ipv6
* @brief Provides IPv6 extension header definitions and helper functions.
* @{
*
* @file
* @brief IPv6 extension header definitions.
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef IPV6_EXT_H_
#define IPV6_EXT_H_
#include <stdint.h>
#include "net/ipv6/ext/rh.h"
#ifdef __cplusplus
extern "C" {
#endif
#define IPV6_EXT_LEN_UNIT (8U) /**< Unit in byte for the extension header's
* length field */
/**
* @brief IPv6 extension headers.
*
* @see <a href="https://tools.ietf.org/html/rfc2460#section-4">
* RFC 2460, section 4.1
* </a>
*/
typedef struct __attribute__((packed)) {
uint8_t nh; /**< next header */
uint8_t len; /**< length in 8 octets without first octet */
} ipv6_ext_t;
/**
* @brief Gets the next extension header in a packet.
*
* @param[in] ext The current extension header.
*
* @return The next extension header.
*/
static inline ipv6_ext_t *ipv6_ext_get_next(ipv6_ext_t *ext)
{
return (ipv6_ext_t *)((uint8_t *)(ext) + (ext->len * IPV6_EXT_LEN_UNIT) +
IPV6_EXT_LEN_UNIT);
}
#ifdef __cplusplus
}
#endif
#endif /* IPV6_EXT_H_ */
/** @} */

20
sys/include/net/ng_ipv6/ext/rh.h → sys/include/net/ipv6/ext/rh.h

@ -7,8 +7,8 @@
*/
/**
* @defgroup net_ng_ipv6_ext_rh IPv6 routing header extension
* @ingroup net_ng_ipv6_ext
* @defgroup net_ipv6_ext_rh IPv6 routing header extension
* @ingroup net_ipv6_ext
* @brief Implementation of IPv6 routing header extension.
* @{
*
@ -17,11 +17,13 @@
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef NG_IPV6_EXT_RH_H_
#define NG_IPV6_EXT_RH_H_
#ifndef IPV6_EXT_RH_H_
#define IPV6_EXT_RH_H_
#include <stdint.h>
#include "net/ipv6/addr.h"
#include "net/ng_ipv6/hdr.h"
#include "net/ipv6/hdr.h"
#ifdef __cplusplus
extern "C" {
@ -34,14 +36,14 @@ extern "C" {
* RFC 2460, section 4.4
* </a>
*
* @extends ng_ipv6_ext_t
* @extends ipv6_ext_t
*/
typedef struct __attribute__((packed)) {
uint8_t nh; /**< next header */
uint8_t len; /**< length in 8 octets without first octet */
uint8_t type; /**< identifier of a particular routing header type */
uint8_t seg_left; /**< number of route segments remaining */
} ng_ipv6_ext_rh_t;
} ipv6_ext_rh_t;
/**
* @brief Extract next hop from the routing header of an IPv6 packet.
@ -51,11 +53,11 @@ typedef struct __attribute__((packed)) {
* @return next hop on success, on success
* @return NULL, if not found.
*/
ipv6_addr_t *ng_ipv6_ext_rh_next_hop(ng_ipv6_hdr_t *ipv6);
ipv6_addr_t *ipv6_ext_rh_next_hop(ipv6_hdr_t *ipv6);
#ifdef __cplusplus
}
#endif
#endif /* NG_IPV6_EXT_RH_H_ */
#endif /* IPV6_EXT_RH_H_ */
/** @} */

311
sys/include/net/ipv6/hdr.h

@ -0,0 +1,311 @@
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup net_ipv6_hdr IPv6 header
* @ingroup net_ipv6
* @brief IPv6 header types and helper functions
* @{
*
* @file
* @brief IPv6 header type and helper function definitions
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef IPV6_HDR_H_
#define IPV6_HDR_H_
#include <stdint.h>
#include "byteorder.h"
#include "net/ipv6/addr.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Data type to represent an IPv6 packet header
*
* @details The structure of the header is as follows:
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.unparsed}
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |Version| Traffic Class | Flow Label |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Payload Length | Next Header | Hop Limit |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* + +
* | |
* + Source Address +
* | |
* + +
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* + +
* | |
* + Destination Address +
* | |
* + +
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* @see <a href="http://tools.ietf.org/html/rfc2460#section-3">
* RFC 2460, section 3
* </a>
*/
typedef struct __attribute__((packed)) {
/**
* @brief Version, traffic class, and flow label
*
* @details The version are the 4 most significant bits, the traffic class
* the 8 next bit, and the remainding 20 bits are the flow label (see
* above).
*
* This module provides helper functions to set, get, and check these
* fields accordingly:
* * ipv6_hdr_set_version()
* * ipv6_hdr_get_version()
* * ipv6_hdr_is()
* * ipv6_hdr_set_tc()
* * ipv6_hdr_set_tc_ecn()
* * ipv6_hdr_set_tc_dscp()
* * ipv6_hdr_get_tc()
* * ipv6_hdr_get_tc_ecn()
* * ipv6_hdr_get_tc_dscp()
* * ipv6_hdr_set_fl()
* * ipv6_hdr_get_fl()
*/
network_uint32_t v_tc_fl;
network_uint16_t len; /**< payload length of this packet. */
uint8_t nh; /**< type of next header in this packet. */
uint8_t hl; /**< hop limit for this packet. */
ipv6_addr_t src; /**< source address of this packet. */
ipv6_addr_t dst; /**< destination address of this packet. */
} ipv6_hdr_t;
/**
* @brief Sets the version field of @p hdr to 6
*
* @param[out] hdr Pointer to an IPv6 header.
*/
static inline void ipv6_hdr_set_version(ipv6_hdr_t *hdr)
{
hdr->v_tc_fl.u8[0] &= 0x0f;
hdr->v_tc_fl.u8[0] |= 0x60;
}
/**
* @brief Gets the value of the version field of @p hdr
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the version field of @p hdr.
*/
static inline uint8_t ipv6_hdr_get_version(const ipv6_hdr_t *hdr)
{
return ((hdr->v_tc_fl.u8[0]) >> 4);
}
/**
* @brief Checks if the version field is set to 6
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return true, if version field is 6
* @return false, otherwise
*/
static inline bool ipv6_hdr_is(const ipv6_hdr_t *hdr)
{
return (((hdr->v_tc_fl.u8[0]) & 0xf0) == 0x60);
}
/**
* @brief Sets the traffic class field of @p hdr
*
* @param[out] hdr Pointer to an IPv6 header.
* @param[in] tc The new value for the traffic class field.
*/
static inline void ipv6_hdr_set_tc(ipv6_hdr_t *hdr, uint8_t tc)
{
hdr->v_tc_fl.u8[0] &= 0xf0;
hdr->v_tc_fl.u8[0] |= (0x0f & (tc >> 4));
hdr->v_tc_fl.u8[1] &= 0x0f;
hdr->v_tc_fl.u8[1] |= (0xf0 & (tc << 4));
}
/**
* @brief Sets the value of the Explicit Congestion Notification (ECN) part
* of the traffic class field of @p hdr
*
* @details The field is needed e.g. in context of 6LoWPAN header compression
*
* @see <a href="https://tools.ietf.org/html/rfc3168#section-5">
* RFC 3168, section 5
* </a>
*
* @param[out] hdr Pointer to an IPv6 header.
* @param[in] ecn The new value for the 2-bit ECN part of the traffic class
* field.
*/
static inline void ipv6_hdr_set_tc_ecn(ipv6_hdr_t *hdr, uint8_t ecn)
{
hdr->v_tc_fl.u8[0] &= 0xf3;
hdr->v_tc_fl.u8[0] |= (0x0c & (ecn << 2));
}
/**
* @brief Sets the value of the Differentiated Service Codepoint (DSCP) part
* of the traffic class field of @p hdr
*
* @details The field is needed e.g. in context of 6LoWPAN header compression
*
* @see <a href="https://tools.ietf.org/html/rfc2474#section-3">
* RFC 2474, section 3
* </a>
*
* @param[out] hdr Pointer to an IPv6 header.
* @param[in] dscp The new value for the 6-bit DSCP ng_part of the traffic class
* field.
*/
static inline void ipv6_hdr_set_tc_dscp(ipv6_hdr_t *hdr, uint8_t dscp)
{
hdr->v_tc_fl.u8[0] &= 0xfc;
hdr->v_tc_fl.u8[0] |= (0x03 & (dscp >> 4));
hdr->v_tc_fl.u8[1] &= 0x0f;
hdr->v_tc_fl.u8[1] |= (0xf0 & (dscp << 4));
}
/**
* @brief Gets the value of the traffic class field of @p hdr
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the traffic class field of @p hdr.
*/
static inline uint8_t ipv6_hdr_get_tc(const ipv6_hdr_t *hdr)
{
return ((((hdr->v_tc_fl.u8[0]) & 0x0f) << 4) |
((hdr->v_tc_fl.u8[1] & 0xf0) >> 4));
}
/**
* @brief Gets the value of the Explicit Congestion Notification (ECN) part
* of the traffic class field of @p hdr
*
* @details The field is needed e.g. in context of 6LoWPAN header compression
*
* @see <a href="https://tools.ietf.org/html/rfc3168#section-5">
* RFC 3168, section 5
* </a>
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the ECN part of the traffic class field of @p hdr.
*/
static inline uint8_t ipv6_hdr_get_tc_ecn(const ipv6_hdr_t *hdr)
{
return (((hdr->v_tc_fl.u8[0]) & 0x0c) >> 2);
}
/**
* @brief Gets the value of the Differentiated Service Codepoint (DSCP) part
* of the traffic class field of @p hdr
*
* @details The field is needed e.g. in context of 6LoWPAN header compression
*
* @see <a href="https://tools.ietf.org/html/rfc2474#section-3">
* RFC 2474, section 3
* </a>
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the DSCP part of the traffic class field of @p hdr.
*/
static inline uint8_t ipv6_hdr_get_tc_dscp(const ipv6_hdr_t *hdr)
{
return ((((hdr->v_tc_fl.u8[0]) & 0x03) << 4) |
((hdr->v_tc_fl.u8[1] & 0xf0) >> 4));
}
/**
* @brief Sets the flow label field of @p hdr
*
* @param[out] hdr Pointer to an IPv6 header.
* @param[in] fl The new value for the flow label field in host byte order.
*/
static inline void ipv6_hdr_set_fl(ipv6_hdr_t *hdr, uint32_t fl)
{
hdr->v_tc_fl.u8[1] &= 0xf0;
hdr->v_tc_fl.u8[1] |= (0x0f & (byteorder_htonl(fl).u8[1]));
hdr->v_tc_fl.u16[1] = byteorder_htonl(fl).u16[1];
}
/**
* @brief Gets the value of the flow label field of @p hdr
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the flow label field of @p hdr.
*/
static inline uint32_t ipv6_hdr_get_fl(const ipv6_hdr_t *hdr)
{
return byteorder_ntohl(hdr->v_tc_fl) & 0x000fffff;
}
/**
* @brief Calculates the Internet Checksum for the IPv6 Pseudo Header.
*
* @see <a href="https://tools.ietf.org/html/rfc2460#section-8.1">
* RFC 2460, section 8.1
* </a>
*
* @param[in] sum Preinialized value of the sum.
* @param[in] prot_num The @ref net_protnum you want to calculate the
* checksum for. Can not be inferred from
* ipv6_hdr_t::nh, since it can be an IPv6 exentension
* header.
* @param[in] hdr An IPv6 header to derive the Pseudo Header from.
* @param[in] len The upper-layer packet length for the pseudo header.
* Can not be inferred from ipv6_hdr_t::len, since
* there can be extension headers between the IPv6 header
* and the payload.
*
* @return The non-normalized Internet Checksum of the given IPv6 pseudo header.
*/
static inline uint16_t ipv6_hdr_inet_csum(uint16_t sum, ipv6_hdr_t *hdr,
uint8_t prot_num, uint16_t len)
{
if ((sum + len + prot_num) > 0xffff) {
/* increment by one for overflow to keep it as 1's complement sum */
sum++;
}
return inet_csum(sum + len + prot_num, hdr->src.u8,
(2 * sizeof(ipv6_addr_t)));
}
/**
* @brief Outputs an IPv6 header to stdout.
*
* @param[in] hdr An IPv6 header.
*/
void ipv6_hdr_print(ipv6_hdr_t *hdr);
#ifdef __cplusplus
}
#endif
#endif /* IPV6_HDR_H_ */
/** @} */

2
sys/include/net/ng_icmpv6.h

@ -31,8 +31,6 @@
#include "byteorder.h"
#include "kernel_types.h"
#include "net/ng_ipv6/hdr.h"
#include "net/ng_nettype.h"
#include "net/ng_nettype.h"
#include "net/ng_pkt.h"

6
sys/include/net/ng_icmpv6/echo.h

@ -24,8 +24,8 @@
#include "byteorder.h"
#include "kernel_types.h"
#include "net/ipv6/hdr.h"
#include "net/ng_icmpv6/types.h"
#include "net/ng_ipv6/hdr.h"
#ifdef __cplusplus
extern "C" {
@ -115,10 +115,10 @@ static inline ng_pktsnip_t *ng_icmpv6_echo_rep_build(uint16_t id, uint16_t seq,
* @param[in] iface The interface the echo requuest was received on.
* @param[in] ipv6_hdr The IPv6 header of the echo request.
* @param[in] echo The Echo Request message.
* @param[in] len Length of the echo request message (ng_ipv6_hdr_t::len
* @param[in] len Length of the echo request message (ipv6_hdr_t::len
* of @p ipv6_hdr minus length of extension headers).
*/
void ng_icmpv6_echo_req_handle(kernel_pid_t iface, ng_ipv6_hdr_t *ipv6_hdr,
void ng_icmpv6_echo_req_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6_hdr,
ng_icmpv6_echo_t *echo, uint16_t len);
#ifdef __cplusplus

1
sys/include/net/ng_icmpv6/error.h

@ -27,7 +27,6 @@
#include "byteorder.h"
#include "kernel_types.h"
#include "net/ng_icmpv6/types.h"
#include "net/ng_ipv6/hdr.h"
#ifdef __cplusplus
extern "C" {

36
sys/include/net/ng_ipv6/ext.h

@ -25,34 +25,18 @@
#ifndef NG_IPV6_EXT_H_
#define NG_IPV6_EXT_H_
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "byteorder.h"
#include "kernel_types.h"
#include "net/ng_pkt.h"
#include "net/ng_ipv6/ext/rh.h"
#include "net/ipv6/ext.h"
#ifdef __cplusplus
extern "C" {
#endif
#define NG_IPV6_EXT_LEN_UNIT (8U) /**< Unit in byte for the extension header's
* length field */
/**
* @brief IPv6 extension headers.
*
* @see <a href="https://tools.ietf.org/html/rfc2460#section-4">
* RFC 2460, section 4.1
* </a>
*/
typedef struct __attribute__((packed)) {
uint8_t nh; /**< next header */
uint8_t len; /**< length in 8 octets without first octet */
} ng_ipv6_ext_t;
/**
* @brief Demultiplex extension headers according to @p nh.
*
@ -68,20 +52,6 @@ typedef struct __attribute__((packed)) {
bool ng_ipv6_ext_demux(kernel_pid_t iface, ng_pktsnip_t *pkt,
uint8_t nh);
/**
* @brief Gets the next extension header in a packet.
*
* @param[in] ext The current extension header.
*
* @return The next extension header.
*/
static inline ng_ipv6_ext_t *ng_ipv6_ext_get_next(ng_ipv6_ext_t *ext)
{
return (ng_ipv6_ext_t *)((uint8_t *)(ext) +
(ext->len * NG_IPV6_EXT_LEN_UNIT) +
NG_IPV6_EXT_LEN_UNIT);
}
/**
* @brief Builds an extension header for sending.
*

280
sys/include/net/ng_ipv6/hdr.h

@ -19,285 +19,14 @@
#ifndef NG_IPV6_HDR_H_
#define NG_IPV6_HDR_H_
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include "byteorder.h"
#include "net/ipv6/addr.h"
#include "net/inet_csum.h"
#include "net/ng_pkt.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Data type to represent an IPv6 packet header
*
* @details The structure of the header is as follows:
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.unparsed}
* 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |Version| Traffic Class | Flow Label |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Payload Length | Next Header | Hop Limit |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* + +
* | |
* + Source Address +
* | |
* + +
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* + +
* | |
* + Destination Address +
* | |
* + +
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* @see <a href="http://tools.ietf.org/html/rfc2460#section-3">
* RFC 2460, section 3
* </a>
*/
typedef struct __attribute__((packed)) {
/**
* @brief Version, traffic class, and flow label
*
* @details The version are the 4 most significant bits, the traffic class
* the 8 next bit, and the remainding 20 bits are the flow label (see
* above).
*
* This module provides helper functions to set, get, and check these
* fields accordingly:
* * ng_ipv6_hdr_set_version()
* * ng_ipv6_hdr_get_version()
* * ng_ipv6_hdr_is()
* * ng_ipv6_hdr_set_tc()
* * ng_ipv6_hdr_set_tc_ecn()
* * ng_ipv6_hdr_set_tc_dscp()
* * ng_ipv6_hdr_get_tc()
* * ng_ipv6_hdr_get_tc_ecn()
* * ng_ipv6_hdr_get_tc_dscp()
* * ng_ipv6_hdr_set_fl()
* * ng_ipv6_hdr_get_fl()
*/
network_uint32_t v_tc_fl;
network_uint16_t len; /**< payload length of this packet. */
uint8_t nh; /**< type of next header in this packet. */
uint8_t hl; /**< hop limit for this packet. */
ipv6_addr_t src; /**< source address of this packet. */
ipv6_addr_t dst; /**< destination address of this packet. */
} ng_ipv6_hdr_t;
/**
* @brief Sets the version field of @p hdr to 6
*
* @param[out] hdr Pointer to an IPv6 header.
*/
static inline void ng_ipv6_hdr_set_version(ng_ipv6_hdr_t *hdr)
{
hdr->v_tc_fl.u8[0] &= 0x0f;
hdr->v_tc_fl.u8[0] |= 0x60;
}
/**
* @brief Gets the value of the version field of @p hdr
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the version field of @p hdr.
*/
static inline uint8_t ng_ipv6_hdr_get_version(const ng_ipv6_hdr_t *hdr)
{
return ((hdr->v_tc_fl.u8[0]) >> 4);
}
/**
* @brief Checks if the version field is set to 6
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return true, if version field is 6
* @return false, otherwise
*/
static inline bool ng_ipv6_hdr_is(const ng_ipv6_hdr_t *hdr)
{
return (((hdr->v_tc_fl.u8[0]) & 0xf0) == 0x60);
}
/**
* @brief Sets the traffic class field of @p hdr
*
* @param[out] hdr Pointer to an IPv6 header.
* @param[in] tc The new value for the traffic class field.
*/
static inline void ng_ipv6_hdr_set_tc(ng_ipv6_hdr_t *hdr, uint8_t tc)
{
hdr->v_tc_fl.u8[0] &= 0xf0;
hdr->v_tc_fl.u8[0] |= (0x0f & (tc >> 4));
hdr->v_tc_fl.u8[1] &= 0x0f;
hdr->v_tc_fl.u8[1] |= (0xf0 & (tc << 4));
}
/**
* @brief Sets the value of the Explicit Congestion Notification (ECN) part
* of the traffic class field of @p hdr
*
* @details The field is needed e.g. in context of 6LoWPAN header compression
*
* @see <a href="https://tools.ietf.org/html/rfc3168#section-5">
* RFC 3168, section 5
* </a>
*
* @param[out] hdr Pointer to an IPv6 header.
* @param[in] ecn The new value for the 2-bit ECN part of the traffic class
* field.
*/
static inline void ng_ipv6_hdr_set_tc_ecn(ng_ipv6_hdr_t *hdr, uint8_t ecn)
{
hdr->v_tc_fl.u8[0] &= 0xf3;
hdr->v_tc_fl.u8[0] |= (0x0c & (ecn << 2));
}
/**
* @brief Sets the value of the Differentiated Service Codepoint (DSCP) part
* of the traffic class field of @p hdr
*
* @details The field is needed e.g. in context of 6LoWPAN header compression
*
* @see <a href="https://tools.ietf.org/html/rfc2474#section-3">
* RFC 2474, section 3
* </a>
*
* @param[out] hdr Pointer to an IPv6 header.
* @param[in] dscp The new value for the 6-bit DSCP ng_part of the traffic class
* field.
*/
static inline void ng_ipv6_hdr_set_tc_dscp(ng_ipv6_hdr_t *hdr, uint8_t dscp)
{
hdr->v_tc_fl.u8[0] &= 0xfc;
hdr->v_tc_fl.u8[0] |= (0x03 & (dscp >> 4));
hdr->v_tc_fl.u8[1] &= 0x0f;
hdr->v_tc_fl.u8[1] |= (0xf0 & (dscp << 4));
}
/**
* @brief Gets the value of the traffic class field of @p hdr
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the traffic class field of @p hdr.
*/
static inline uint8_t ng_ipv6_hdr_get_tc(const ng_ipv6_hdr_t *hdr)
{
return ((((hdr->v_tc_fl.u8[0]) & 0x0f) << 4) |
((hdr->v_tc_fl.u8[1] & 0xf0) >> 4));
}
/**
* @brief Gets the value of the Explicit Congestion Notification (ECN) part
* of the traffic class field of @p hdr
*
* @details The field is needed e.g. in context of 6LoWPAN header compression
*
* @see <a href="https://tools.ietf.org/html/rfc3168#section-5">
* RFC 3168, section 5
* </a>
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the ECN part of the traffic class field of @p hdr.
*/
static inline uint8_t ng_ipv6_hdr_get_tc_ecn(const ng_ipv6_hdr_t *hdr)
{
return (((hdr->v_tc_fl.u8[0]) & 0x0c) >> 2);
}
/**
* @brief Gets the value of the Differentiated Service Codepoint (DSCP) part
* of the traffic class field of @p hdr
*
* @details The field is needed e.g. in context of 6LoWPAN header compression
*
* @see <a href="https://tools.ietf.org/html/rfc2474#section-3">
* RFC 2474, section 3
* </a>
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the DSCP part of the traffic class field of @p hdr.
*/
static inline uint8_t ng_ipv6_hdr_get_tc_dscp(const ng_ipv6_hdr_t *hdr)
{
return ((((hdr->v_tc_fl.u8[0]) & 0x03) << 4) |
((hdr->v_tc_fl.u8[1] & 0xf0) >> 4));
}
/**
* @brief Sets the flow label field of @p hdr
*
* @param[out] hdr Pointer to an IPv6 header.
* @param[in] fl The new value for the flow label field in host byte order.
*/
static inline void ng_ipv6_hdr_set_fl(ng_ipv6_hdr_t *hdr, uint32_t fl)
{
hdr->v_tc_fl.u8[1] &= 0xf0;
hdr->v_tc_fl.u8[1] |= (0x0f & (byteorder_htonl(fl).u8[1]));
hdr->v_tc_fl.u16[1] = byteorder_htonl(fl).u16[1];
}
/**
* @brief Gets the value of the flow label field of @p hdr
*
* @param[in] hdr Pointer to an IPv6 header.
*
* @return Value of the flow label field of @p hdr.
*/
static inline uint32_t ng_ipv6_hdr_get_fl(const ng_ipv6_hdr_t *hdr)
{
return byteorder_ntohl(hdr->v_tc_fl) & 0x000fffff;
}
/**
* @brief Calculates the Internet Checksum for the IPv6 Pseudo Header.
*
* @see <a href="https://tools.ietf.org/html/rfc2460#section-8.1">
* RFC 2460, section 8.1
* </a>
*
* @param[in] sum Preinialized value of the sum.
* @param[in] prot_num The @ref net_protnum you want to calculate the
* checksum for. Can not be inferred from
* ng_ipv6_hdr_t::nh, since it can be an IPv6 exentension
* header.
* @param[in] hdr An IPv6 header to derive the Pseudo Header from.
* @param[in] len The upper-layer packet length for the pseudo header.
* Can not be inferred from ng_ipv6_hdr_t::len, since
* there can be extension headers between the IPv6 header
* and the payload.
*
* @return The non-normalized Internet Checksum of the given IPv6 pseudo header.
*/
static inline uint16_t ng_ipv6_hdr_inet_csum(uint16_t sum, ng_ipv6_hdr_t *hdr,
uint8_t prot_num, uint16_t len)
{
if ((sum + len + prot_num) > 0xffff) {
/* increment by one for overflow to keep it as 1's complement sum */
sum++;
}
return inet_csum(sum + len + prot_num, hdr->src.u8,
(2 * sizeof(ipv6_addr_t)));
}
/**
* @brief Builds an IPv6 header for sending and adds it to the packet buffer.
*
@ -321,13 +50,6 @@ ng_pktsnip_t *ng_ipv6_hdr_build(ng_pktsnip_t *payload,
uint8_t *src, uint8_t src_len,
uint8_t *dst, uint8_t dst_len);
/**
* @brief Outputs an IPv6 header to stdout.
*
* @param[in] hdr An IPv6 header.
*/
void ng_ipv6_hdr_print(ng_ipv6_hdr_t *hdr);
#ifdef __cplusplus
}
#endif

4
sys/include/net/ng_ndp.h

@ -116,7 +116,7 @@ extern "C" {
* @param[in] icmpv6_size The overall size of the neighbor solicitation.
*/
void ng_ndp_nbr_sol_handle(kernel_pid_t iface, ng_pktsnip_t *pkt,
ng_ipv6_hdr_t *ipv6, ng_ndp_nbr_sol_t *nbr_sol,
ipv6_hdr_t *ipv6, ng_ndp_nbr_sol_t *nbr_sol,
size_t icmpv6_size);
/**
@ -129,7 +129,7 @@ void ng_ndp_nbr_sol_handle(kernel_pid_t iface, ng_pktsnip_t *pkt,
* @param[in] icmpv6_size The overall size of the neighbor advertisement.
*/
void ng_ndp_nbr_adv_handle(kernel_pid_t iface, ng_pktsnip_t *pkt,
ng_ipv6_hdr_t *ipv6, ng_ndp_nbr_adv_t *nbr_adv,
ipv6_hdr_t *ipv6, ng_ndp_nbr_adv_t *nbr_adv,
size_t icmpv6_size);
/**

5
sys/include/net/ng_ndp/internal.h

@ -23,6 +23,7 @@
#define INTERNAL_H_
#include "net/ipv6/addr.h"
#include "net/ipv6/hdr.h"
#include "net/ng_ndp/types.h"
#ifdef __cplusplus
@ -96,7 +97,7 @@ void ng_ndp_internal_send_nbr_adv(kernel_pid_t iface, ipv6_addr_t *tgt,
* @return false, if SL2A was not valid.
*/
bool ng_ndp_internal_sl2a_opt_handle(kernel_pid_t iface, ng_pktsnip_t *pkt,
ng_ipv6_hdr_t *ipv6, uint8_t icmpv6_type,
ipv6_hdr_t *ipv6, uint8_t icmpv6_type,
ng_ndp_opt_t *sl2a_opt);
/**
@ -112,7 +113,7 @@ bool ng_ndp_internal_sl2a_opt_handle(kernel_pid_t iface, ng_pktsnip_t *pkt,
* @return length of the L2 address, on success.
* @return -EINVAL, if TL2A was not valid.
*/
int ng_ndp_internal_tl2a_opt_handle(ng_pktsnip_t *pkt, ng_ipv6_hdr_t *ipv6,
int ng_ndp_internal_tl2a_opt_handle(ng_pktsnip_t *pkt, ipv6_hdr_t *ipv6,
uint8_t icmpv6_type, ng_ndp_opt_t *tl2a_opt,
uint8_t *l2addr);

3
sys/include/net/ng_rpl/srh.h

@ -24,7 +24,6 @@
#define NG_RPL_SRH_H_
#include "net/ipv6/addr.h"
#include "net/ng_ipv6/ext.h"
#ifdef __cplusplus
extern "C" {
@ -42,7 +41,7 @@ extern "C" {
* RFC 6554
* </a>
*
* @extends ng_ipv6_ext_rh_t
* @extends ipv6_ext_rh_t
*/
typedef struct __attribute__((packed)) {
uint8_t nh; /**< next header */

2
sys/include/net/protnum.h

@ -11,7 +11,7 @@
* @ingroup net
* @brief Defines for the Protocol Numbers as they are used in the
* IPv4 protocol field and the IPv6 next header field
* (ng_ipv6_hdr_t::nh).
* (ipv6_hdr_t::nh).
* @see <a href="http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml">
* IANA, Assigned Internet Protocol Numbers
* </a>

4
sys/net/crosslayer/ng_pktdump/ng_pktdump.c

@ -29,7 +29,7 @@
#include "net/ng_pktdump.h"
#include "net/ng_netbase.h"
#include "net/ipv6/addr.h"
#include "net/ng_ipv6/hdr.h"
#include "net/ipv6/hdr.h"
#include "net/ng_sixlowpan.h"
#include "net/ng_udp.h"
#include "od.h"
@ -66,7 +66,7 @@ static void _dump_snip(ng_pktsnip_t *pkt)
#ifdef MODULE_NG_IPV6
case NG_NETTYPE_IPV6:
printf("NETTYPE_IPV6 (%i)\n", pkt->type);
ng_ipv6_hdr_print(pkt->data);
ipv6_hdr_print(pkt->data);
break;
#endif
#ifdef MODULE_NG_ICMPV6

9
sys/net/link_layer/ng_netdev_eth/ng_netdev_eth.c

@ -32,6 +32,7 @@
#include "net/eui64.h"
#include "net/ethernet.h"
#include "net/ethertype.h"
#include "net/ipv6/hdr.h"
#include "net/ng_netdev.h"
#include "net/ng_netif/hdr.h"
#include "net/ng_pkt.h"
@ -354,8 +355,6 @@ static inline void _addr_set_broadcast(uint8_t *dst)
memset(dst, 0xff, ETHERNET_ADDR_LEN);
}
#define _IPV6_DST_OFFSET (36) /* sizeof(ipv6_hdr_t) - 4 */
static inline void _addr_set_multicast(uint8_t *dst, ng_pktsnip_t *payload)
{
switch (payload->type) {
@ -364,9 +363,11 @@ static inline void _addr_set_multicast(uint8_t *dst, ng_pktsnip_t *payload)
dst[0] = 0x33;
dst[1] = 0x33;
if ((payload != NULL) && (payload->data != NULL)) {
memcpy(dst + 2, ((uint8_t *)payload->data) + _IPV6_DST_OFFSET, 4);
ipv6_hdr_t *hdr = payload->data;
uint16_t *prefix = (uint16_t *)(&dst[2]);
prefix[0] = hdr->dst.u16[6];
prefix[1] = hdr->dst.u16[7];
}
/* TODO change to proper types when ng_ipv6_hdr_t got merged */
break;
#endif
default:

4
sys/net/link_layer/ng_slip/ng_slip.c

@ -31,7 +31,7 @@
#include "periph/uart.h"
#include "ringbuffer.h"
#include "thread.h"
#include "net/ng_ipv6/hdr.h"
#include "net/ipv6/hdr.h"
#include "net/ng_slip.h"
@ -140,7 +140,7 @@ static void _slip_receive(ng_slip_dev_t *dev, size_t bytes)
}
#ifdef MODULE_NG_IPV6
if ((pkt->size >= sizeof(ng_ipv6_hdr_t)) && ng_ipv6_hdr_is_ipv6_hdr(pkt->data)) {
if ((pkt->size >= sizeof(ipv6_hdr_t)) && ipv6_hdr_is(pkt->data)) {
pkt->type = NG_NETTYPE_IPV6;
}
#endif

2
sys/net/network_layer/ng_ipv6/ext/rh/Makefile → sys/net/network_layer/ipv6/ext/rh/Makefile

@ -1,3 +1,3 @@
MODULE = ng_ipv6_ext_rh
MODULE = ipv6_ext_rh
include $(RIOTBASE)/Makefile.base

8
sys/net/network_layer/ng_ipv6/ext/rh/ng_ipv6_ext_rh.c → sys/net/network_layer/ipv6/ext/rh/ipv6_ext_rh.c

@ -15,12 +15,12 @@
#include <stdbool.h>
#include "net/protnum.h"
#include "net/ipv6/ext/rh.h"
#include "net/ng_rpl/srh.h"
#include "net/ng_ipv6/ext/rh.h"
ipv6_addr_t *ng_ipv6_ext_rh_next_hop(ng_ipv6_hdr_t *ipv6)
ipv6_addr_t *ipv6_ext_rh_next_hop(ipv6_hdr_t *ipv6)
{
ng_ipv6_ext_rh_t *ext = (ng_ipv6_ext_rh_t *)(ipv6 + 1);
ipv6_ext_rh_t *ext = (ipv6_ext_rh_t *)(ipv6 + 1);
bool c = true;
while (c) {
@ -31,7 +31,7 @@ ipv6_addr_t *ng_ipv6_ext_rh_next_hop(ng_ipv6_hdr_t *ipv6)
case PROTNUM_IPV6_EXT_AH:
case PROTNUM_IPV6_EXT_ESP:
case PROTNUM_IPV6_EXT_MOB:
ext = (ng_ipv6_ext_rh_t *)ng_ipv6_ext_get_next((ng_ipv6_ext_t *)ext);
ext = (ipv6_ext_rh_t *)ipv6_ext_get_next((ipv6_ext_t *)ext);
break;
case PROTNUM_IPV6_EXT_RH:

3
sys/net/network_layer/ipv6/hdr/Makefile

@ -0,0 +1,3 @@
MODULE = ipv6_hdr
include $(RIOTBASE)/Makefile.base

13
sys/net/network_layer/ng_ipv6/hdr/ng_ipv6_hdr_print.c → sys/net/network_layer/ipv6/hdr/ipv6_hdr_print.c

@ -15,20 +15,19 @@
#include <stdio.h>
#include <inttypes.h>
#include "net/ng_ipv6/hdr.h"
#include "net/ipv6/hdr.h"
void ng_ipv6_hdr_print(ng_ipv6_hdr_t *hdr)
void ipv6_hdr_print(ipv6_hdr_t *hdr)
{
char addr_str[IPV6_ADDR_MAX_STR_LEN];
if (!ng_ipv6_hdr_is(hdr)) {
printf("illegal version field: %" PRIu8 "\n", ng_ipv6_hdr_get_version(hdr));
if (!ipv6_hdr_is(hdr)) {
printf("illegal version field: %" PRIu8 "\n", ipv6_hdr_get_version(hdr));
}
printf("traffic class: 0x%02" PRIx8 " (ECN: 0x%" PRIx8 ", DSCP: 0x%02" PRIx8 ")\n",
ng_ipv6_hdr_get_tc(hdr), ng_ipv6_hdr_get_tc_ecn(hdr),
ng_ipv6_hdr_get_tc_dscp(hdr));
printf("flow label: 0x%05" PRIx32 "\n", ng_ipv6_hdr_get_fl(hdr));
ipv6_hdr_get_tc(hdr), ipv6_hdr_get_tc_ecn(hdr), ipv6_hdr_get_tc_dscp(hdr));
printf("flow label: 0x%05" PRIx32 "\n", ipv6_hdr_get_fl(hdr));
printf("length: %" PRIu16 " next header: %" PRIu8 " hop limit: %" PRIu8 "\n",
byteorder_ntohs(hdr->len), hdr->nh, hdr->hl);
printf("source address: %s\n", ipv6_addr_to_str(addr_str, &hdr->src,

2
sys/net/network_layer/ng_icmpv6/echo/ng_icmpv6_echo.c

@ -60,7 +60,7 @@ ng_pktsnip_t *ng_icmpv6_echo_build(uint8_t type, uint16_t id, uint16_t seq,
return pkt;
}
void ng_icmpv6_echo_req_handle(kernel_pid_t iface, ng_ipv6_hdr_t *ipv6_hdr,
void ng_icmpv6_echo_req_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6_hdr,
ng_icmpv6_echo_t *echo, uint16_t len)
{
uint8_t *payload = ((uint8_t *)echo) + sizeof(ng_icmpv6_echo_t);

9
sys/net/network_layer/ng_icmpv6/ng_icmpv6.c

@ -21,10 +21,10 @@
#include "byteorder.h"
#include "kernel_types.h"
#include "net/ipv6/hdr.h"
#include "net/ng_netbase.h"
#include "net/protnum.h"
#include "net/ng_ipv6/hdr.h"
#include "net/ng_ndp.h"
#include "net/protnum.h"
#include "od.h"
#include "utlist.h"
@ -48,8 +48,7 @@ static inline uint16_t _calc_csum(ng_pktsnip_t *hdr,
}
csum = inet_csum(csum, hdr->data, hdr->size);
csum = ng_ipv6_hdr_inet_csum(csum, pseudo_hdr->data, PROTNUM_ICMPV6,
len);
csum = ipv6_hdr_inet_csum(csum, pseudo_hdr->data, PROTNUM_ICMPV6, len);
return ~csum;
}
@ -83,7 +82,7 @@ void ng_icmpv6_demux(kernel_pid_t iface, ng_pktsnip_t *pkt)
#ifdef MODULE_NG_ICMPV6_ECHO
case NG_ICMPV6_ECHO_REQ:
DEBUG("icmpv6: handle echo request.\n");
ng_icmpv6_echo_req_handle(iface, (ng_ipv6_hdr_t *)ipv6->data,
ng_icmpv6_echo_req_handle(iface, (ipv6_hdr_t *)ipv6->data,
(ng_icmpv6_echo_t *)hdr, icmpv6->size);
break;
#endif

20
sys/net/network_layer/ng_ipv6/ext/ng_ipv6_ext.c

@ -24,10 +24,10 @@ bool ng_ipv6_ext_demux(kernel_pid_t iface, ng_pktsnip_t *pkt,
uint8_t nh)
{
ng_pktsnip_t *ext_snip;
ng_ipv6_ext_t *ext;
ipv6_ext_t *ext;
unsigned int offset = 0;
ext = ((ng_ipv6_ext_t *)(((uint8_t *)pkt->data) + sizeof(ng_ipv6_hdr_t)));
ext = ((ipv6_ext_t *)(((uint8_t *)pkt->data) + sizeof(ipv6_hdr_t)));
bool c = true;
@ -42,14 +42,14 @@ bool ng_ipv6_ext_demux(kernel_pid_t iface, ng_pktsnip_t *pkt,
case PROTNUM_IPV6_EXT_MOB:
/* TODO: add handling of types */
nh = ext->nh;
offset += ((ext->len * NG_IPV6_EXT_LEN_UNIT) + NG_IPV6_EXT_LEN_UNIT);
ext = ng_ipv6_ext_get_next((ng_ipv6_ext_t *)ext);
offset += ((ext->len * IPV6_EXT_LEN_UNIT) + IPV6_EXT_LEN_UNIT);
ext = ipv6_ext_get_next((ipv6_ext_t *)ext);
break;
default:
c = false;
offset += ((ext->len * NG_IPV6_EXT_LEN_UNIT) + NG_IPV6_EXT_LEN_UNIT);
ext = ng_ipv6_ext_get_next((ng_ipv6_ext_t *)ext);
offset += ((ext->len * IPV6_EXT_LEN_UNIT) + IPV6_EXT_LEN_UNIT);
ext = ipv6_ext_get_next((ipv6_ext_t *)ext);
break;
}
}
@ -69,9 +69,9 @@ ng_pktsnip_t *ng_ipv6_ext_build(ng_pktsnip_t *ipv6, ng_pktsnip_t *next,
uint8_t nh, size_t size)
{
ng_pktsnip_t *prev = NULL, *snip;