1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_ndp2: rename to gnrc_ndp

This commit is contained in:
Martine Lenders 2017-11-17 10:25:17 +01:00
parent 31b1ceb440
commit f90a9a875f
No known key found for this signature in database
GPG Key ID: 8E97A9FE55F25D62
21 changed files with 215 additions and 214 deletions

View File

@ -193,7 +193,7 @@ ifneq (,$(filter gnrc_ipv6_router_default,$(USEMODULE)))
USEMODULE += gnrc_icmpv6
endif
ifneq (,$(filter gnrc_ndp2,$(USEMODULE)))
ifneq (,$(filter gnrc_ndp,$(USEMODULE)))
USEMODULE += gnrc_icmpv6
USEMODULE += gnrc_netif
endif
@ -279,7 +279,7 @@ endif
ifneq (,$(filter gnrc_ipv6_nib,$(USEMODULE)))
USEMODULE += evtimer
USEMODULE += gnrc_ndp2
USEMODULE += gnrc_ndp
USEMODULE += ipv6_addr
USEMODULE += random
endif

View File

@ -7,7 +7,7 @@
*/
/**
* @defgroup net_gnrc_ndp2 IPv6 neighbor discovery (v2)
* @defgroup net_gnrc_ndp IPv6 neighbor discovery (v2)
* @ingroup net_gnrc_ipv6
* @brief Provides build and send functions for neighbor discovery packets
* @{
@ -17,8 +17,8 @@
*
* @author Martine Lenders <m.lenders@fu-berlin.de>
*/
#ifndef NET_GNRC_NDP2_H
#define NET_GNRC_NDP2_H
#ifndef NET_GNRC_NDP_H
#define NET_GNRC_NDP_H
#include <stdint.h>
@ -35,13 +35,13 @@ extern "C" {
/**
* @brief @ref net_gnrc_nettype to send NDP packets to
*/
#ifndef GNRC_NETTYPE_NDP2
#ifndef GNRC_NETTYPE_NDP
# if defined(MODULE_GNRC_IPV6) || DOXYGEN
# define GNRC_NETTYPE_NDP2 (GNRC_NETTYPE_IPV6) /* usual configuration */
# define GNRC_NETTYPE_NDP (GNRC_NETTYPE_IPV6) /* usual configuration */
# else
# define GNRC_NETTYPE_NDP2 (GNRC_NETTYPE_UNDEF) /* for testing */
# define GNRC_NETTYPE_NDP (GNRC_NETTYPE_UNDEF) /* for testing */
# endif
#endif /* GNRC_NETTYPE_NDP2 */
#endif /* GNRC_NETTYPE_NDP */
/**
* @brief Builds a neighbor solicitation message for sending.
@ -58,8 +58,8 @@ extern "C" {
* @return The resulting ICMPv6 packet on success.
* @return NULL, if packet buffer is full.
*/
gnrc_pktsnip_t *gnrc_ndp2_nbr_sol_build(const ipv6_addr_t *tgt,
gnrc_pktsnip_t *options);
gnrc_pktsnip_t *gnrc_ndp_nbr_sol_build(const ipv6_addr_t *tgt,
gnrc_pktsnip_t *options);
/**
* @brief Builds a neighbor advertisement message for sending.
@ -88,8 +88,8 @@ gnrc_pktsnip_t *gnrc_ndp2_nbr_sol_build(const ipv6_addr_t *tgt,
* @return The resulting ICMPv6 packet on success.
* @return NULL, if packet buffer is full.
*/
gnrc_pktsnip_t *gnrc_ndp2_nbr_adv_build(const ipv6_addr_t *tgt, uint8_t flags,
gnrc_pktsnip_t *options);
gnrc_pktsnip_t *gnrc_ndp_nbr_adv_build(const ipv6_addr_t *tgt, uint8_t flags,
gnrc_pktsnip_t *options);
/**
* @brief Builds a router solicitation message for sending.
@ -102,7 +102,7 @@ gnrc_pktsnip_t *gnrc_ndp2_nbr_adv_build(const ipv6_addr_t *tgt, uint8_t flags,
* @return The resulting ICMPv6 packet on success.
* @return NULL, if packet buffer is full.
*/
gnrc_pktsnip_t *gnrc_ndp2_rtr_sol_build(gnrc_pktsnip_t *options);
gnrc_pktsnip_t *gnrc_ndp_rtr_sol_build(gnrc_pktsnip_t *options);
/**
* @brief Builds a router advertisement message for sending.
@ -131,10 +131,10 @@ gnrc_pktsnip_t *gnrc_ndp2_rtr_sol_build(gnrc_pktsnip_t *options);
* @return The resulting ICMPv6 packet on success.
* @return NULL, if packet buffer is full.
*/
gnrc_pktsnip_t *gnrc_ndp2_rtr_adv_build(uint8_t cur_hl, uint8_t flags,
uint16_t ltime, uint32_t reach_time,
uint32_t retrans_timer,
gnrc_pktsnip_t *options);
gnrc_pktsnip_t *gnrc_ndp_rtr_adv_build(uint8_t cur_hl, uint8_t flags,
uint16_t ltime, uint32_t reach_time,
uint32_t retrans_timer,
gnrc_pktsnip_t *options);
/**
* @brief Builds a generic NDP option.
@ -147,8 +147,8 @@ gnrc_pktsnip_t *gnrc_ndp2_rtr_adv_build(uint8_t cur_hl, uint8_t flags,
* @return The packet snip list of options, on success
* @return NULL, if packet buffer is full
*/
gnrc_pktsnip_t *gnrc_ndp2_opt_build(uint8_t type, size_t size,
gnrc_pktsnip_t *next);
gnrc_pktsnip_t *gnrc_ndp_opt_build(uint8_t type, size_t size,
gnrc_pktsnip_t *next);
/**
* @brief Builds the source link-layer address option.
@ -169,9 +169,9 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_build(uint8_t type, size_t size,
* @return The packet snip list of options, on success
* @return NULL, if packet buffer is full
*/
gnrc_pktsnip_t *gnrc_ndp2_opt_sl2a_build(const uint8_t *l2addr,
uint8_t l2addr_len,
gnrc_pktsnip_t *next);
gnrc_pktsnip_t *gnrc_ndp_opt_sl2a_build(const uint8_t *l2addr,
uint8_t l2addr_len,
gnrc_pktsnip_t *next);
/**
* @brief Builds the target link-layer address option.
@ -192,9 +192,9 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_sl2a_build(const uint8_t *l2addr,
* @return The pkt snip list of options, on success
* @return NULL, if packet buffer is full
*/
gnrc_pktsnip_t *gnrc_ndp2_opt_tl2a_build(const uint8_t *l2addr,
uint8_t l2addr_len,
gnrc_pktsnip_t *next);
gnrc_pktsnip_t *gnrc_ndp_opt_tl2a_build(const uint8_t *l2addr,
uint8_t l2addr_len,
gnrc_pktsnip_t *next);
/**
* @brief Builds the prefix information option.
@ -229,10 +229,10 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_tl2a_build(const uint8_t *l2addr,
* @return The packet snip list of options, on success
* @return NULL, if packet buffer is full
*/
gnrc_pktsnip_t *gnrc_ndp2_opt_pi_build(const ipv6_addr_t *prefix,
uint8_t prefix_len,
uint32_t valid_ltime, uint32_t pref_ltime,
uint8_t flags, gnrc_pktsnip_t *next);
gnrc_pktsnip_t *gnrc_ndp_opt_pi_build(const ipv6_addr_t *prefix,
uint8_t prefix_len,
uint32_t valid_ltime, uint32_t pref_ltime,
uint8_t flags, gnrc_pktsnip_t *next);
/**
* @brief Builds the MTU option.
@ -248,7 +248,7 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_pi_build(const ipv6_addr_t *prefix,
* @return The packet snip list of options, on success
* @return NULL, if packet buffer is full
*/
gnrc_pktsnip_t *gnrc_ndp2_opt_mtu_build(uint32_t mtu, gnrc_pktsnip_t *next);
gnrc_pktsnip_t *gnrc_ndp_opt_mtu_build(uint32_t mtu, gnrc_pktsnip_t *next);
/**
* @brief Send pre-compiled neighbor solicitation depending on a given network
@ -270,9 +270,9 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_mtu_build(uint32_t mtu, gnrc_pktsnip_t *next);
* for a neighbor solicitation so be sure to check that.
* **Will be released** in an error case.
*/
void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
const ipv6_addr_t *src, const ipv6_addr_t *dst,
gnrc_pktsnip_t *ext_opts);
void gnrc_ndp_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
const ipv6_addr_t *src, const ipv6_addr_t *dst,
gnrc_pktsnip_t *ext_opts);
/**
* @brief Send pre-compiled neighbor advertisement depending on a given
@ -316,9 +316,9 @@ void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
* check that.
* **Will be released** in an error case.
*/
void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
const ipv6_addr_t *dst, bool supply_tl2a,
gnrc_pktsnip_t *ext_opts);
void gnrc_ndp_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
const ipv6_addr_t *dst, bool supply_tl2a,
gnrc_pktsnip_t *ext_opts);
/**
* @brief Send pre-compiled router solicitation depending on a given
@ -329,7 +329,7 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
* @param[in] netif Interface to send over. May not be NULL.
* @param[in] dst Destination for the router solicitation. ff02::2 if NULL.
*/
void gnrc_ndp2_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst);
void gnrc_ndp_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst);
/**
* @brief Send pre-compiled router advertisement depending on a given network
@ -356,13 +356,13 @@ void gnrc_ndp2_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst);
* for a neighbor advertisement so be sure to check that.
* **Will be released** in an error case.
*/
void gnrc_ndp2_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
const ipv6_addr_t *dst, bool fin,
gnrc_pktsnip_t *ext_opts);
void gnrc_ndp_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
const ipv6_addr_t *dst, bool fin,
gnrc_pktsnip_t *ext_opts);
#ifdef __cplusplus
}
#endif
#endif /* NET_GNRC_NDP2_H */
#endif /* NET_GNRC_NDP_H */
/** @} */

View File

@ -7,7 +7,7 @@
*/
/**
* @defgroup net_gnrc_netif Network interface API
* @defgroup net_gnrc_netif New network interface API
* @ingroup net_gnrc
* @brief Abstraction layer for GNRC's network interfaces
*
@ -66,7 +66,7 @@ typedef struct {
gnrc_netif_ipv6_t ipv6; /**< IPv6 component */
#endif
#if defined(MODULE_GNRC_MAC) || DOXYGEN
gnrc_netif_mac_t mac; /**< @ref net_gnrc_mac component */
gnrc_netif_mac_t mac; /**< @ref net_gnrc_mac component */
#endif /* MODULE_GNRC_MAC */
/**
* @brief Flags for the interface

View File

@ -25,8 +25,8 @@ endif
ifneq (,$(filter gnrc_ipv6_blacklist,$(USEMODULE)))
DIRS += network_layer/ipv6/blacklist
endif
ifneq (,$(filter gnrc_ndp2,$(USEMODULE)))
DIRS += network_layer/ndp2
ifneq (,$(filter gnrc_ndp,$(USEMODULE)))
DIRS += network_layer/ndp
endif
ifneq (,$(filter gnrc_netapi,$(USEMODULE)))
DIRS += netapi

View File

@ -214,8 +214,8 @@ static int _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
vector[0].iov_base = mhr;
vector[0].iov_len = (size_t)res;
#ifdef MODULE_NETSTATS_L2
if (netif_hdr->flags &
(GNRC_NETIF_HDR_FLAGS_BROADCAST | GNRC_NETIF_HDR_FLAGS_MULTICAST)) {
if (netif_hdr->flags &
(GNRC_NETIF_HDR_FLAGS_BROADCAST | GNRC_NETIF_HDR_FLAGS_MULTICAST)) {
netif->dev->stats.tx_mcast_count++;
}
else {

View File

@ -15,7 +15,7 @@
#include "net/gnrc/netif/internal.h"
#include "net/gnrc/ipv6/nib.h"
#include "net/gnrc/ndp2.h"
#include "net/gnrc/ndp.h"
#include "_nib-6ln.h"
#include "_nib-6lr.h"

View File

@ -14,7 +14,7 @@
*/
#include "xtimer.h"
#include "net/gnrc/ndp2.h"
#include "net/gnrc/ndp.h"
#include "net/gnrc/ipv6/nib.h"
#include "net/gnrc/netif/internal.h"
#ifdef MODULE_GNRC_SIXLOWPAN_ND
@ -73,7 +73,7 @@ void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
}
}
#endif /* MODULE_GNRC_SIXLOWPAN_ND */
gnrc_ndp2_nbr_sol_send(tgt, netif, src, dst, ext_opt);
gnrc_ndp_nbr_sol_send(tgt, netif, src, dst, ext_opt);
}
void _snd_uc_ns(_nib_onl_entry_t *nbr, bool reset)

View File

@ -14,7 +14,7 @@
*/
#include "net/gnrc/ipv6/nib.h"
#include "net/gnrc/ndp2.h"
#include "net/gnrc/ndp.h"
#include "net/gnrc/netif/internal.h"
#include "net/gnrc/sixlowpan/nd.h"
@ -113,8 +113,8 @@ static gnrc_pktsnip_t *_offl_to_pio(_nib_offl_entry_t *offl,
if (offl->flags & _PFX_SLAAC) {
flags |= NDP_OPT_PI_FLAGS_A;
}
pio = gnrc_ndp2_opt_pi_build(&offl->pfx, offl->pfx_len, valid_ltime,
pref_ltime, flags, ext_opts);
pio = gnrc_ndp_opt_pi_build(&offl->pfx, offl->pfx_len, valid_ltime,
pref_ltime, flags, ext_opts);
if ((pio == NULL) && (ext_opts != NULL)) {
DEBUG("nib: No space left in packet buffer. Not adding PIO\n");
@ -194,7 +194,7 @@ static void _snd_ra(gnrc_netif_t *netif, const ipv6_addr_t *dst,
{
gnrc_pktsnip_t *ext_opts = _build_ext_opts(netif, abr);
gnrc_ndp2_rtr_adv_send(netif, NULL, dst, final, ext_opts);
gnrc_ndp_rtr_adv_send(netif, NULL, dst, final, ext_opts);
}
#else /* GNRC_IPV6_NIB_CONF_ROUTER */
typedef int dont_be_pedantic;

View File

@ -21,7 +21,7 @@
#include "net/gnrc/nettype.h"
#include "net/gnrc/netif/internal.h"
#include "net/gnrc/ipv6/nib.h"
#include "net/gnrc/ndp2.h"
#include "net/gnrc/ndp.h"
#include "net/gnrc/pktqueue.h"
#include "net/gnrc/sixlowpan/nd.h"
#include "net/ndp.h"
@ -735,8 +735,8 @@ static void _send_delayed_nbr_adv(const gnrc_netif_t *netif,
size_t l2addr_len = _get_l2src(netif, l2addr);
if (l2addr_len > 0) {
extra_opts = gnrc_ndp2_opt_tl2a_build(l2addr, l2addr_len,
extra_opts);
extra_opts = gnrc_ndp_opt_tl2a_build(l2addr, l2addr_len,
extra_opts);
if (extra_opts == NULL) {
DEBUG("nib: No space left in packet buffer. Not replying NS");
gnrc_pktbuf_release(reply_aro);
@ -754,7 +754,7 @@ static void _send_delayed_nbr_adv(const gnrc_netif_t *netif,
reply_flags |= NDP_NBR_ADV_FLAGS_O;
#endif /* GNRC_NETIF_L2ADDR_MAXLEN > 0 */
/* discard const qualifier */
nbr_adv = gnrc_ndp2_nbr_adv_build(tgt, reply_flags, extra_opts);
nbr_adv = gnrc_ndp_nbr_adv_build(tgt, reply_flags, extra_opts);
if (nbr_adv == NULL) {
DEBUG("nib: No space left in packet buffer. Not replying NS");
gnrc_pktbuf_release(extra_opts);
@ -875,9 +875,9 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
_send_delayed_nbr_adv(netif, &nbr_sol->tgt, &ipv6->dst, reply_aro);
}
else {
gnrc_ndp2_nbr_adv_send(&nbr_sol->tgt, netif, &ipv6->src,
ipv6_addr_is_multicast(&ipv6->dst),
reply_aro);
gnrc_ndp_nbr_adv_send(&nbr_sol->tgt, netif, &ipv6->src,
ipv6_addr_is_multicast(&ipv6->dst),
reply_aro);
}
}
}
@ -1168,7 +1168,7 @@ void _handle_search_rtr(gnrc_netif_t *netif)
uint32_t interval = _get_next_rs_interval(netif);
if (next_rs > interval) {
gnrc_ndp2_rtr_sol_send(netif, &ipv6_addr_all_routers_link_local);
gnrc_ndp_rtr_sol_send(netif, &ipv6_addr_all_routers_link_local);
if (netif->ipv6.rs_sent < 10U) {
/* with more the backoff (required in RFC 6775) is truncated
* anyway and this way we prevent overflows. 10 is arbitrary, so

View File

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

View File

@ -21,7 +21,7 @@
#endif
#include "net/ndp.h"
#include "net/gnrc/ndp2.h"
#include "net/gnrc/ndp.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
@ -30,13 +30,13 @@
static char addr_str[IPV6_ADDR_MAX_STR_LEN];
#endif
gnrc_pktsnip_t *gnrc_ndp2_nbr_sol_build(const ipv6_addr_t *tgt,
gnrc_pktsnip_t *options)
gnrc_pktsnip_t *gnrc_ndp_nbr_sol_build(const ipv6_addr_t *tgt,
gnrc_pktsnip_t *options)
{
gnrc_pktsnip_t *pkt;
assert((tgt != NULL) && !ipv6_addr_is_multicast(tgt));
DEBUG("ndp2: building neighbor solicitation message\n");
DEBUG("ndp: building neighbor solicitation message\n");
pkt = gnrc_icmpv6_build(options, ICMPV6_NBR_SOL, 0, sizeof(ndp_nbr_sol_t));
if (pkt != NULL) {
ndp_nbr_sol_t *nbr_sol = pkt->data;
@ -46,19 +46,19 @@ gnrc_pktsnip_t *gnrc_ndp2_nbr_sol_build(const ipv6_addr_t *tgt,
}
#if ENABLE_DEBUG
else {
DEBUG("ndp2: NS not created due to no space in packet buffer\n");
DEBUG("ndp: NS not created due to no space in packet buffer\n");
}
#endif
return pkt;
}
gnrc_pktsnip_t *gnrc_ndp2_nbr_adv_build(const ipv6_addr_t *tgt, uint8_t flags,
gnrc_pktsnip_t *options)
gnrc_pktsnip_t *gnrc_ndp_nbr_adv_build(const ipv6_addr_t *tgt, uint8_t flags,
gnrc_pktsnip_t *options)
{
gnrc_pktsnip_t *pkt;
assert((tgt != NULL) && !ipv6_addr_is_multicast(tgt));
DEBUG("ndp2: building neighbor advertisement message\n");
DEBUG("ndp: building neighbor advertisement message\n");
pkt = gnrc_icmpv6_build(options, ICMPV6_NBR_ADV, 0, sizeof(ndp_nbr_adv_t));
if (pkt != NULL) {
ndp_nbr_adv_t *nbr_adv = pkt->data;
@ -69,17 +69,17 @@ gnrc_pktsnip_t *gnrc_ndp2_nbr_adv_build(const ipv6_addr_t *tgt, uint8_t flags,
}
#if ENABLE_DEBUG
else {
DEBUG("ndp2: NA not created due to no space in packet buffer\n");
DEBUG("ndp: NA not created due to no space in packet buffer\n");
}
#endif
return pkt;
}
gnrc_pktsnip_t *gnrc_ndp2_rtr_sol_build(gnrc_pktsnip_t *options)
gnrc_pktsnip_t *gnrc_ndp_rtr_sol_build(gnrc_pktsnip_t *options)
{
gnrc_pktsnip_t *pkt;
DEBUG("ndp2: building router solicitation message\n");
DEBUG("ndp: building router solicitation message\n");
pkt = gnrc_icmpv6_build(options, ICMPV6_RTR_SOL, 0, sizeof(ndp_rtr_sol_t));
if (pkt != NULL) {
ndp_rtr_sol_t *rtr_sol = pkt->data;
@ -87,20 +87,20 @@ gnrc_pktsnip_t *gnrc_ndp2_rtr_sol_build(gnrc_pktsnip_t *options)
}
#if ENABLE_DEBUG
else {
DEBUG("ndp2: RS not created due to no space in packet buffer\n");
DEBUG("ndp: RS not created due to no space in packet buffer\n");
}
#endif
return pkt;
}
gnrc_pktsnip_t *gnrc_ndp2_rtr_adv_build(uint8_t cur_hl, uint8_t flags,
uint16_t ltime, uint32_t reach_time,
uint32_t retrans_timer,
gnrc_pktsnip_t *options)
gnrc_pktsnip_t *gnrc_ndp_rtr_adv_build(uint8_t cur_hl, uint8_t flags,
uint16_t ltime, uint32_t reach_time,
uint32_t retrans_timer,
gnrc_pktsnip_t *options)
{
gnrc_pktsnip_t *pkt;
DEBUG("ndp2: building router advertisement message\n");
DEBUG("ndp: building router advertisement message\n");
pkt = gnrc_icmpv6_build(options, ICMPV6_RTR_ADV, 0, sizeof(ndp_rtr_adv_t));
if (pkt != NULL) {
ndp_rtr_adv_t *rtr_adv = pkt->data;
@ -112,7 +112,7 @@ gnrc_pktsnip_t *gnrc_ndp2_rtr_adv_build(uint8_t cur_hl, uint8_t flags,
}
#if ENABLE_DEBUG
else {
DEBUG("ndp2: RA not created due to no space in packet buffer\n");
DEBUG("ndp: RA not created due to no space in packet buffer\n");
}
#endif
return pkt;
@ -124,8 +124,8 @@ static inline size_t _ceil8(uint8_t length)
return (length + 7U) & 0xf8U;
}
gnrc_pktsnip_t *gnrc_ndp2_opt_build(uint8_t type, size_t size,
gnrc_pktsnip_t *next)
gnrc_pktsnip_t *gnrc_ndp_opt_build(uint8_t type, size_t size,
gnrc_pktsnip_t *next)
{
gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(next, NULL, _ceil8(size),
GNRC_NETTYPE_UNDEF);
@ -137,7 +137,7 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_build(uint8_t type, size_t size,
}
#if ENABLE_DEBUG
else {
DEBUG("ndp2: option not created due to no space in packet buffer\n");
DEBUG("ndp: option not created due to no space in packet buffer\n");
}
#endif
return pkt;
@ -148,9 +148,9 @@ static inline gnrc_pktsnip_t *_opt_l2a_build(const uint8_t *l2addr,
gnrc_pktsnip_t *next,
uint8_t type)
{
gnrc_pktsnip_t *pkt = gnrc_ndp2_opt_build(type,
sizeof(ndp_opt_t) + l2addr_len,
next);
gnrc_pktsnip_t *pkt = gnrc_ndp_opt_build(type,
sizeof(ndp_opt_t) + l2addr_len,
next);
if (pkt != NULL) {
ndp_opt_t *l2a_opt = pkt->data;
@ -161,36 +161,36 @@ static inline gnrc_pktsnip_t *_opt_l2a_build(const uint8_t *l2addr,
return pkt;
}
gnrc_pktsnip_t *gnrc_ndp2_opt_sl2a_build(const uint8_t *l2addr,
uint8_t l2addr_len,
gnrc_pktsnip_t *next)
gnrc_pktsnip_t *gnrc_ndp_opt_sl2a_build(const uint8_t *l2addr,
uint8_t l2addr_len,
gnrc_pktsnip_t *next)
{
assert((l2addr != NULL) && (l2addr_len != 0));
DEBUG("ndp2: building source link-layer address option (l2addr: %s)\n",
DEBUG("ndp: building source link-layer address option (l2addr: %s)\n",
gnrc_netif_addr_to_str(l2addr, l2addr_len, addr_str));
return _opt_l2a_build(l2addr, l2addr_len, next, NDP_OPT_SL2A);
}
gnrc_pktsnip_t *gnrc_ndp2_opt_tl2a_build(const uint8_t *l2addr,
uint8_t l2addr_len,
gnrc_pktsnip_t *next)
gnrc_pktsnip_t *gnrc_ndp_opt_tl2a_build(const uint8_t *l2addr,
uint8_t l2addr_len,
gnrc_pktsnip_t *next)
{
assert((l2addr != NULL) && (l2addr_len != 0));
DEBUG("ndp2: building target link-layer address option (l2addr: %s)\n",
DEBUG("ndp: building target link-layer address option (l2addr: %s)\n",
gnrc_netif_addr_to_str(l2addr, l2addr_len, addr_str));
return _opt_l2a_build(l2addr, l2addr_len, next, NDP_OPT_TL2A);
}
gnrc_pktsnip_t *gnrc_ndp2_opt_pi_build(const ipv6_addr_t *prefix,
uint8_t prefix_len,
uint32_t valid_ltime, uint32_t pref_ltime,
uint8_t flags, gnrc_pktsnip_t *next)
gnrc_pktsnip_t *gnrc_ndp_opt_pi_build(const ipv6_addr_t *prefix,
uint8_t prefix_len,
uint32_t valid_ltime, uint32_t pref_ltime,
uint8_t flags, gnrc_pktsnip_t *next)
{
assert(prefix != NULL);
assert(!ipv6_addr_is_link_local(prefix) && !ipv6_addr_is_multicast(prefix));
assert(prefix_len <= 128);
gnrc_pktsnip_t *pkt = gnrc_ndp2_opt_build(NDP_OPT_PI, sizeof(ndp_opt_pi_t),
next);
gnrc_pktsnip_t *pkt = gnrc_ndp_opt_build(NDP_OPT_PI, sizeof(ndp_opt_pi_t),
next);
if (pkt != NULL) {
ndp_opt_pi_t *pi_opt = pkt->data;
@ -207,10 +207,10 @@ gnrc_pktsnip_t *gnrc_ndp2_opt_pi_build(const ipv6_addr_t *prefix,
return pkt;
}
gnrc_pktsnip_t *gnrc_ndp2_opt_mtu_build(uint32_t mtu, gnrc_pktsnip_t *next)
gnrc_pktsnip_t *gnrc_ndp_opt_mtu_build(uint32_t mtu, gnrc_pktsnip_t *next)
{
gnrc_pktsnip_t *pkt = gnrc_ndp2_opt_build(NDP_OPT_MTU,
sizeof(ndp_opt_mtu_t), next);
gnrc_pktsnip_t *pkt = gnrc_ndp_opt_build(NDP_OPT_MTU,
sizeof(ndp_opt_mtu_t), next);
if (pkt != NULL) {
ndp_opt_mtu_t *mtu_opt = pkt->data;
@ -227,9 +227,9 @@ static gnrc_pktsnip_t *_build_headers(gnrc_netif_t *netif,
gnrc_pktsnip_t *payload);
static inline size_t _get_l2src(const gnrc_netif_t *netif, uint8_t *l2src);
void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
const ipv6_addr_t *src, const ipv6_addr_t *dst,
gnrc_pktsnip_t *ext_opts)
void gnrc_ndp_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
const ipv6_addr_t *src, const ipv6_addr_t *dst,
gnrc_pktsnip_t *ext_opts)
{
assert((tgt != NULL) && !ipv6_addr_is_multicast(tgt));
assert((netif != NULL) && (dst != NULL));
@ -241,7 +241,7 @@ void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
* (reason: also used in MODULE_GNRC_SIXLOWPAN_ND compile path) */
size_t l2src_len = 0;
DEBUG("ndp2: send neighbor solicitation (iface: %" PRIkernel_pid ", "
DEBUG("ndp: send neighbor solicitation (iface: %" PRIkernel_pid ", "
"src: %s, ", netif->pid,
ipv6_addr_to_str(addr_str, (src != NULL) ? src : &ipv6_addr_unspecified,
sizeof(addr_str)));
@ -260,34 +260,34 @@ void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
if (l2src_len > 0) {
/* add source address link-layer address option */
hdr = gnrc_ndp2_opt_sl2a_build(l2src, l2src_len, pkt);
hdr = gnrc_ndp_opt_sl2a_build(l2src, l2src_len, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error allocating SL2AO.\n");
DEBUG("ndp: error allocating SL2AO.\n");
break;
}
pkt = hdr;
}
}
/* add neighbor solicitation header */
hdr = gnrc_ndp2_nbr_sol_build(tgt, pkt);
hdr = gnrc_ndp_nbr_sol_build(tgt, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error allocating neighbor solicitation.\n");
DEBUG("ndp: error allocating neighbor solicitation.\n");
break;
}
pkt = hdr;
/* add remaining headers */
hdr = _build_headers(netif, src, dst, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error adding lower-layer headers.\n");
DEBUG("ndp: error adding lower-layer headers.\n");
break;
}
else {
pkt = hdr;
if (gnrc_netapi_dispatch_send(GNRC_NETTYPE_NDP2,
if (gnrc_netapi_dispatch_send(GNRC_NETTYPE_NDP,
GNRC_NETREG_DEMUX_CTX_ALL,
pkt) == 0) {
DEBUG("ndp2: unable to send neighbor solicitation\n");
DEBUG("ndp: unable to send neighbor solicitation\n");
break;
}
}
@ -298,9 +298,9 @@ void gnrc_ndp2_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
gnrc_netif_release(netif);
}
void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
const ipv6_addr_t *dst, bool supply_tl2a,
gnrc_pktsnip_t *ext_opts)
void gnrc_ndp_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
const ipv6_addr_t *dst, bool supply_tl2a,
gnrc_pktsnip_t *ext_opts)
{
ipv6_addr_t real_dst;
gnrc_pktsnip_t *hdr, *pkt = ext_opts;
@ -308,7 +308,7 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
assert((tgt != NULL) && !ipv6_addr_is_multicast(tgt));
assert((netif != NULL) && (dst != NULL));
DEBUG("ndp2: send neighbor advertisement (iface: %" PRIkernel_pid
DEBUG("ndp: send neighbor advertisement (iface: %" PRIkernel_pid
", tgt: %s, ", netif->pid,
ipv6_addr_to_str(addr_str, tgt, sizeof(addr_str)));
DEBUG("dst: %s, supply_tl2a: %d)\n",
@ -318,7 +318,7 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
int tgt_idx;
if ((tgt_idx = gnrc_netif_ipv6_addr_idx(netif, tgt)) < 0) {
DEBUG("ndp2: tgt not assigned to interface. Abort sending\n");
DEBUG("ndp: tgt not assigned to interface. Abort sending\n");
break;
}
if (gnrc_netif_is_rtr(netif) && gnrc_netif_is_rtr_adv(netif)) {
@ -342,10 +342,10 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
if (l2tgt_len > 0) {
/* add target address link-layer address option */
hdr = gnrc_ndp2_opt_tl2a_build(l2tgt, l2tgt_len, pkt);
hdr = gnrc_ndp_opt_tl2a_build(l2tgt, l2tgt_len, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error allocating TL2AO.\n");
DEBUG("ndp: error allocating TL2AO.\n");
break;
}
pkt = hdr;
@ -359,24 +359,24 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
adv_flags |= NDP_NBR_ADV_FLAGS_O;
}
/* add neighbor advertisement header */
hdr = gnrc_ndp2_nbr_adv_build(tgt, adv_flags, pkt);
hdr = gnrc_ndp_nbr_adv_build(tgt, adv_flags, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error allocating neighbor advertisement.\n");
DEBUG("ndp: error allocating neighbor advertisement.\n");
break;
}
pkt = hdr;
/* add remaining headers */
hdr = _build_headers(netif, NULL, &real_dst, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error adding lower-layer headers.\n");
DEBUG("ndp: error adding lower-layer headers.\n");
break;
}
else {
pkt = hdr;
if (gnrc_netapi_dispatch_send(GNRC_NETTYPE_NDP2,
if (gnrc_netapi_dispatch_send(GNRC_NETTYPE_NDP,
GNRC_NETREG_DEMUX_CTX_ALL,
pkt) == 0) {
DEBUG("ndp2: unable to send neighbor advertisement\n");
DEBUG("ndp: unable to send neighbor advertisement\n");
break;
}
}
@ -387,7 +387,7 @@ void gnrc_ndp2_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
gnrc_netif_release(netif);
}
void gnrc_ndp2_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst)
void gnrc_ndp_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst)
{
gnrc_pktsnip_t *hdr, *pkt = NULL;
@ -395,7 +395,7 @@ void gnrc_ndp2_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst)
if (dst == NULL) {
dst = &ipv6_addr_all_routers_link_local;
}
DEBUG("ndp2: send router solicitation (iface: %" PRIkernel_pid
DEBUG("ndp: send router solicitation (iface: %" PRIkernel_pid
", dst: %s)\n", netif->pid,
ipv6_addr_to_str(addr_str, dst, sizeof(addr_str)));
gnrc_netif_acquire(netif);
@ -408,32 +408,32 @@ void gnrc_ndp2_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst)
size_t l2src_len = _get_l2src(netif, l2src);
if (l2src_len > 0) {
/* add source address link-layer address option */
pkt = gnrc_ndp2_opt_sl2a_build(l2src, l2src_len, NULL);
pkt = gnrc_ndp_opt_sl2a_build(l2src, l2src_len, NULL);
if (pkt == NULL) {
DEBUG("ndp2: error allocating SL2AO.\n");
DEBUG("ndp: error allocating SL2AO.\n");
break;
}
}
}
/* add router solicitation header */
hdr = gnrc_ndp2_rtr_sol_build(pkt);
hdr = gnrc_ndp_rtr_sol_build(pkt);
if (hdr == NULL) {
DEBUG("ndp2: error allocating router solicitation.\n");
DEBUG("ndp: error allocating router solicitation.\n");
break;
}
pkt = hdr;
/* add remaining headers */
hdr = _build_headers(netif, src, dst, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error adding lower-layer headers.\n");
DEBUG("ndp: error adding lower-layer headers.\n");
break;
}
else {
pkt = hdr;
if (gnrc_netapi_dispatch_send(GNRC_NETTYPE_NDP2,
if (gnrc_netapi_dispatch_send(GNRC_NETTYPE_NDP,
GNRC_NETREG_DEMUX_CTX_ALL,
pkt) == 0) {
DEBUG("ndp2: unable to send router advertisement\n");
DEBUG("ndp: unable to send router advertisement\n");
break;
}
}
@ -444,9 +444,9 @@ void gnrc_ndp2_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst)
gnrc_netif_release(netif);
}
void gnrc_ndp2_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
const ipv6_addr_t *dst, bool fin,
gnrc_pktsnip_t *ext_opts)
void gnrc_ndp_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
const ipv6_addr_t *dst, bool fin,
gnrc_pktsnip_t *ext_opts)
{
#if GNRC_IPV6_NIB_CONF_ROUTER
gnrc_pktsnip_t *hdr = NULL, *pkt = ext_opts;
@ -458,13 +458,13 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
if (dst == NULL) {
dst = &ipv6_addr_all_nodes_link_local;
}
DEBUG("ndp2: send router advertisement (iface: %" PRIkernel_pid ", dst: %s%s\n",
DEBUG("ndp: send router advertisement (iface: %" PRIkernel_pid ", dst: %s%s\n",
netif->pid, ipv6_addr_to_str(addr_str, dst, sizeof(addr_str)),
fin ? ", final" : "");
gnrc_netif_acquire(netif);
do { /* XXX: hidden goto */
if (netif->flags & GNRC_NETIF_FLAGS_IPV6_ADV_MTU) {
if ((hdr = gnrc_ndp2_opt_mtu_build(netif->ipv6.mtu, pkt)) == NULL) {
if ((hdr = gnrc_ndp_opt_mtu_build(netif->ipv6.mtu, pkt)) == NULL) {
DEBUG("ndp rtr: no space left in packet buffer\n");
break;
}
@ -486,10 +486,10 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
l2src_len = _get_l2src(netif, l2src);
if (l2src_len > 0) {
/* add source address link-layer address option */
hdr = gnrc_ndp2_opt_sl2a_build(l2src, l2src_len, pkt);
hdr = gnrc_ndp_opt_sl2a_build(l2src, l2src_len, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error allocating Source Link-layer address "
DEBUG("ndp: error allocating Source Link-layer address "
"option.\n");
break;
}
@ -520,24 +520,24 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
flags |= NDP_RTR_ADV_FLAGS_O;
}
}
hdr = gnrc_ndp2_rtr_adv_build(cur_hl, flags, adv_ltime, reach_time,
retrans_timer, pkt);
hdr = gnrc_ndp_rtr_adv_build(cur_hl, flags, adv_ltime, reach_time,
retrans_timer, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error allocating router advertisement.\n");
DEBUG("ndp: error allocating router advertisement.\n");
break;
}
pkt = hdr;
hdr = _build_headers(netif, src, dst, pkt);
if (hdr == NULL) {
DEBUG("ndp2: error adding lower-layer headers.\n");
DEBUG("ndp: error adding lower-layer headers.\n");
break;
}
else {
pkt = hdr;
if (gnrc_netapi_dispatch_send(GNRC_NETTYPE_NDP2,
if (gnrc_netapi_dispatch_send(GNRC_NETTYPE_NDP,
GNRC_NETREG_DEMUX_CTX_ALL,
pkt) == 0) {
DEBUG("ndp2: unable to send router solicitation\n");
DEBUG("ndp: unable to send router solicitation\n");
break;
}
}
@ -551,7 +551,7 @@ void gnrc_ndp2_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
(void)src;
(void)dst;
(void)fin;
DEBUG("ndp2: not a router, dropping ext_opts\n");
DEBUG("ndp: not a router, dropping ext_opts\n");
gnrc_pktbuf_release(ext_opts);
#endif /* GNRC_IPV6_NIB_CONF_ROUTER */
}
@ -565,14 +565,14 @@ static gnrc_pktsnip_t *_build_headers(gnrc_netif_t *netif,
gnrc_pktsnip_t *iphdr = gnrc_ipv6_hdr_build(payload, src, dst);
if (iphdr == NULL) {
DEBUG("ndp2: error allocating IPv6 header.\n");
DEBUG("ndp: error allocating IPv6 header.\n");
return NULL;
}
((ipv6_hdr_t *)iphdr->data)->hl = 255;
/* add netif header for send interface specification */
l2hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
if (l2hdr == NULL) {
DEBUG("ndp2: error allocating netif header.\n");
DEBUG("ndp: error allocating netif header.\n");
gnrc_pktbuf_remove_snip(iphdr, iphdr);
return NULL;
}

View File

@ -15,7 +15,7 @@
#include "net/eui64.h"
#include "net/icmpv6.h"
#include "net/gnrc/ipv6.h"
#include "net/gnrc/ndp2.h"
#include "net/gnrc/ndp.h"
#include "net/gnrc/sixlowpan.h"
#include "net/gnrc/sixlowpan/ctx.h"
#include "random.h"
@ -28,7 +28,7 @@
gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_ar_build(uint8_t status, uint16_t ltime, eui64_t *eui64,
gnrc_pktsnip_t *next)
{
gnrc_pktsnip_t *pkt = gnrc_ndp2_opt_build(NDP_OPT_AR, sizeof(sixlowpan_nd_opt_ar_t), next);
gnrc_pktsnip_t *pkt = gnrc_ndp_opt_build(NDP_OPT_AR, sizeof(sixlowpan_nd_opt_ar_t), next);
if (pkt != NULL) {
sixlowpan_nd_opt_ar_t *ar_opt = pkt->data;
@ -44,7 +44,7 @@ gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_ar_build(uint8_t status, uint16_t ltime, e
gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_6ctx_build(uint8_t prefix_len, uint8_t flags, uint16_t ltime,
ipv6_addr_t *prefix, gnrc_pktsnip_t *next)
{
gnrc_pktsnip_t *pkt = gnrc_ndp2_opt_build(NDP_OPT_6CTX,
gnrc_pktsnip_t *pkt = gnrc_ndp_opt_build(NDP_OPT_6CTX,
sizeof(sixlowpan_nd_opt_6ctx_t) + (prefix_len / 8),
next);
@ -65,7 +65,7 @@ gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_6ctx_build(uint8_t prefix_len, uint8_t fla
gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_abr_build(uint32_t version, uint16_t ltime,
ipv6_addr_t *braddr, gnrc_pktsnip_t *next)
{
gnrc_pktsnip_t *pkt = gnrc_ndp2_opt_build(NDP_OPT_ABR, sizeof(sixlowpan_nd_opt_abr_t), next);
gnrc_pktsnip_t *pkt = gnrc_ndp_opt_build(NDP_OPT_ABR, sizeof(sixlowpan_nd_opt_abr_t), next);
if (pkt != NULL) {
sixlowpan_nd_opt_abr_t *abr_opt = pkt->data;

View File

@ -13,7 +13,7 @@
*/
#include "net/gnrc/ipv6.h"
#include "net/gnrc/ndp2.h"
#include "net/gnrc/ndp.h"
#include "net/gnrc/sixlowpan/ctx.h"
#include "net/gnrc/sixlowpan/nd.h"
#include "net/icmpv6.h"

View File

@ -13,7 +13,7 @@ USEMODULE += netdev_eth
USEMODULE += netdev_test
CFLAGS += -DDEVELHELP
CFLAGS += -DGNRC_NETTYPE_NDP2=GNRC_NETTYPE_TEST
CFLAGS += -DGNRC_NETTYPE_NDP=GNRC_NETTYPE_TEST
CFLAGS += -DGNRC_PKTBUF_SIZE=512
CFLAGS += -DTEST_SUITES

View File

@ -90,7 +90,7 @@ void _tests_init(void)
_mock_netif->ipv6.addrs_flags[0] |= GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID;
gnrc_netreg_entry_init_pid(&dumper, GNRC_NETREG_DEMUX_CTX_ALL,
sched_active_pid);
gnrc_netreg_register(GNRC_NETTYPE_NDP2, &dumper);
gnrc_netreg_register(GNRC_NETTYPE_NDP, &dumper);
}
/** @} */

View File

@ -16,7 +16,7 @@ USEMODULE += netdev_ieee802154
USEMODULE += netdev_test
CFLAGS += -DDEVELHELP
CFLAGS += -DGNRC_NETTYPE_NDP2=GNRC_NETTYPE_TEST
CFLAGS += -DGNRC_NETTYPE_NDP=GNRC_NETTYPE_TEST
CFLAGS += -DGNRC_PKTBUF_SIZE=512
CFLAGS += -DTEST_SUITES

View File

@ -96,7 +96,7 @@ void _tests_init(void)
assert(_mock_netif != NULL);
gnrc_netreg_entry_init_pid(&dumper, GNRC_NETREG_DEMUX_CTX_ALL,
sched_active_pid);
gnrc_netreg_register(GNRC_NETTYPE_NDP2, &dumper);
gnrc_netreg_register(GNRC_NETTYPE_NDP, &dumper);
}
/** @} */

View File

@ -1,17 +1,17 @@
# name of your application
APPLICATION = gnrc_ndp2
APPLICATION = gnrc_ndp
include ../Makefile.tests_common
BOARD_INSUFFICIENT_MEMORY := chronos nucleo32-f031 nucleo32-f042 nucleo32-l031 \
telosb wsn430-v1_3b wsn430-v1_4
USEMODULE += gnrc_ipv6_nib_router
USEMODULE += gnrc_ndp2
USEMODULE += gnrc_ndp
USEMODULE += gnrc_netif
USEMODULE += embunit
USEMODULE += netdev_test
CFLAGS += -DGNRC_NETTYPE_NDP2=GNRC_NETTYPE_TEST
CFLAGS += -DGNRC_NETTYPE_NDP=GNRC_NETTYPE_TEST
CFLAGS += -DGNRC_PKTBUF_SIZE=512
CFLAGS += -DTEST_SUITES

View File

@ -37,7 +37,7 @@
#include "net/netopt.h"
#include "sched.h"
#include "net/gnrc/ndp2.h"
#include "net/gnrc/ndp.h"
#define TEST_CUR_HL (194U)
#define TEST_LTIME (894U)
@ -88,7 +88,7 @@ static void fill_pktbuf(void)
static void test_nbr_sol_build__pktbuf_full(void)
{
fill_pktbuf();
TEST_ASSERT_NULL(gnrc_ndp2_nbr_sol_build(&test_tgt, NULL));
TEST_ASSERT_NULL(gnrc_ndp_nbr_sol_build(&test_tgt, NULL));
}
static void test_nbr_sol_build__success(void)
@ -97,7 +97,7 @@ static void test_nbr_sol_build__success(void)
ndp_nbr_sol_t *nbr_sol;
TEST_ASSERT(gnrc_pktbuf_is_empty());
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp2_nbr_sol_build(&test_tgt, NULL)));
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp_nbr_sol_build(&test_tgt, NULL)));
TEST_ASSERT(gnrc_pktbuf_is_sane());
/* check packet meta-data */
TEST_ASSERT_ALLOCATION(pkt, sizeof(ndp_nbr_sol_t), GNRC_NETTYPE_ICMPV6);
@ -115,7 +115,7 @@ static void test_nbr_sol_build__success(void)
static void test_nbr_adv_build__pktbuf_full(void)
{
fill_pktbuf();
TEST_ASSERT_NULL(gnrc_ndp2_nbr_adv_build(&test_tgt, 0, NULL));
TEST_ASSERT_NULL(gnrc_ndp_nbr_adv_build(&test_tgt, 0, NULL));
}
static void test_nbr_adv_build__success(uint8_t flags)
@ -124,8 +124,8 @@ static void test_nbr_adv_build__success(uint8_t flags)
ndp_nbr_adv_t *nbr_adv;
TEST_ASSERT(gnrc_pktbuf_is_empty());
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp2_nbr_adv_build(&test_tgt, flags,
NULL)));
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp_nbr_adv_build(&test_tgt, flags,
NULL)));
TEST_ASSERT(gnrc_pktbuf_is_sane());
/* check packet meta-data */
TEST_ASSERT_ALLOCATION(pkt, sizeof(ndp_nbr_adv_t), GNRC_NETTYPE_ICMPV6);
@ -156,7 +156,7 @@ static void test_nbr_adv_build__success_with_flags(void)
static void test_rtr_sol_build__pktbuf_full(void)
{
fill_pktbuf();
TEST_ASSERT_NULL(gnrc_ndp2_rtr_sol_build(NULL));
TEST_ASSERT_NULL(gnrc_ndp_rtr_sol_build(NULL));
}
static void test_rtr_sol_build__success(void)
@ -165,7 +165,7 @@ static void test_rtr_sol_build__success(void)
ndp_rtr_sol_t *rtr_sol;
TEST_ASSERT(gnrc_pktbuf_is_empty());
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp2_rtr_sol_build(NULL)));
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp_rtr_sol_build(NULL)));
TEST_ASSERT(gnrc_pktbuf_is_sane());
/* check packet meta-data */
TEST_ASSERT_ALLOCATION(pkt, sizeof(ndp_rtr_sol_t), GNRC_NETTYPE_ICMPV6);
@ -181,9 +181,9 @@ static void test_rtr_sol_build__success(void)
static void test_rtr_adv_build__pktbuf_full(void)
{
fill_pktbuf();
TEST_ASSERT_NULL(gnrc_ndp2_rtr_adv_build(TEST_CUR_HL, 0, TEST_LTIME,
TEST_REACH_TIME,
TEST_RETRANS_TIMER, NULL));
TEST_ASSERT_NULL(gnrc_ndp_rtr_adv_build(TEST_CUR_HL, 0, TEST_LTIME,
TEST_REACH_TIME,
TEST_RETRANS_TIMER, NULL));
}
static void test_rtr_adv_build__success(uint8_t flags)
@ -192,11 +192,11 @@ static void test_rtr_adv_build__success(uint8_t flags)
ndp_rtr_adv_t *rtr_adv;
TEST_ASSERT(gnrc_pktbuf_is_empty());
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp2_rtr_adv_build(TEST_CUR_HL, flags,
TEST_LTIME,
TEST_REACH_TIME,
TEST_RETRANS_TIMER,
NULL)));
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp_rtr_adv_build(TEST_CUR_HL, flags,
TEST_LTIME,
TEST_REACH_TIME,
TEST_RETRANS_TIMER,
NULL)));
TEST_ASSERT(gnrc_pktbuf_is_sane());
/* check packet meta-data */
TEST_ASSERT_ALLOCATION(pkt, sizeof(ndp_rtr_adv_t), GNRC_NETTYPE_ICMPV6);
@ -228,8 +228,8 @@ static void test_rtr_adv_build__success_with_flags(void)
static void test_opt_build__pktbuf_full(void)
{
fill_pktbuf();
TEST_ASSERT_NULL(gnrc_ndp2_opt_build(TEST_NDP_OPT_TYPE, TEST_NDP_OPT_SIZE,
NULL));
TEST_ASSERT_NULL(gnrc_ndp_opt_build(TEST_NDP_OPT_TYPE, TEST_NDP_OPT_SIZE,
NULL));
}
static void test_opt_build__success(void)
@ -238,9 +238,9 @@ static void test_opt_build__success(void)
ndp_opt_t *opt;
TEST_ASSERT(gnrc_pktbuf_is_empty());
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp2_opt_build(TEST_NDP_OPT_TYPE,
TEST_NDP_OPT_SIZE,
NULL)));
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp_opt_build(TEST_NDP_OPT_TYPE,
TEST_NDP_OPT_SIZE,
NULL)));
TEST_ASSERT(gnrc_pktbuf_is_sane());
/* check packet meta-data */
TEST_ASSERT_ALLOCATION(pkt, ceil8(TEST_NDP_OPT_SIZE), GNRC_NETTYPE_UNDEF);
@ -255,8 +255,8 @@ static void test_opt_build__success(void)
static void test_opt_sl2a_build__pktbuf_full(void)
{
fill_pktbuf();
TEST_ASSERT_NULL(gnrc_ndp2_opt_sl2a_build(test_src_l2, sizeof(test_src_l2),
NULL));
TEST_ASSERT_NULL(gnrc_ndp_opt_sl2a_build(test_src_l2, sizeof(test_src_l2),
NULL));
}
static void test_opt_sl2a_build__success(void)
@ -265,9 +265,9 @@ static void test_opt_sl2a_build__success(void)
ndp_opt_t *opt;
TEST_ASSERT(gnrc_pktbuf_is_empty());
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp2_opt_sl2a_build(test_src_l2,
sizeof(test_src_l2),
NULL)));
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp_opt_sl2a_build(test_src_l2,
sizeof(test_src_l2),
NULL)));
TEST_ASSERT(gnrc_pktbuf_is_sane());
/* check packet meta-data */
TEST_ASSERT_ALLOCATION(pkt, ceil8(sizeof(ndp_opt_t) + sizeof(test_src_l2)),
@ -286,8 +286,8 @@ static void test_opt_sl2a_build__success(void)
static void test_opt_tl2a_build__pktbuf_full(void)
{
fill_pktbuf();
TEST_ASSERT_NULL(gnrc_ndp2_opt_tl2a_build(test_src_l2, sizeof(test_src_l2),
NULL));
TEST_ASSERT_NULL(gnrc_ndp_opt_tl2a_build(test_src_l2, sizeof(test_src_l2),
NULL));
}
static void test_opt_tl2a_build__success(void)
@ -296,9 +296,9 @@ static void test_opt_tl2a_build__success(void)
ndp_opt_t *opt;
TEST_ASSERT(gnrc_pktbuf_is_empty());
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp2_opt_tl2a_build(test_src_l2,
sizeof(test_src_l2),
NULL)));
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp_opt_tl2a_build(test_src_l2,
sizeof(test_src_l2),
NULL)));
TEST_ASSERT(gnrc_pktbuf_is_sane());
/* check packet meta-data */
TEST_ASSERT_ALLOCATION(pkt, ceil8(sizeof(ndp_opt_t) + sizeof(test_src_l2)),
@ -317,9 +317,9 @@ static void test_opt_tl2a_build__success(void)
static void test_opt_pi_build__pktbuf_full(void)
{
fill_pktbuf();
TEST_ASSERT_NULL(gnrc_ndp2_opt_pi_build(&test_pfx, TEST_PFX_LEN,
TEST_VALID_LTIME, TEST_PREF_LTIME,
0, NULL));
TEST_ASSERT_NULL(gnrc_ndp_opt_pi_build(&test_pfx, TEST_PFX_LEN,
TEST_VALID_LTIME, TEST_PREF_LTIME,
0, NULL));
}
static void test_opt_pi_build__success(uint8_t flags)
@ -329,10 +329,10 @@ static void test_opt_pi_build__success(uint8_t flags)
ipv6_addr_t exp_pfx = IPV6_ADDR_UNSPECIFIED;
TEST_ASSERT(gnrc_pktbuf_is_empty());
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp2_opt_pi_build(&test_pfx, TEST_PFX_LEN,
TEST_VALID_LTIME,
TEST_PREF_LTIME, flags,
NULL)));
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp_opt_pi_build(&test_pfx, TEST_PFX_LEN,
TEST_VALID_LTIME,
TEST_PREF_LTIME, flags,
NULL)));
TEST_ASSERT(gnrc_pktbuf_is_sane());
/* check packet meta-data */
TEST_ASSERT_ALLOCATION(pkt, ceil8(sizeof(ndp_opt_pi_t)),
@ -370,7 +370,7 @@ static void test_opt_pi_build__success_with_flags(void)
static void test_opt_mtu_build__pktbuf_full(void)
{
fill_pktbuf();
TEST_ASSERT_NULL(gnrc_ndp2_opt_mtu_build(TEST_MTU, NULL));
TEST_ASSERT_NULL(gnrc_ndp_opt_mtu_build(TEST_MTU, NULL));
}
static void test_opt_mtu_build__success(void)
@ -379,7 +379,7 @@ static void test_opt_mtu_build__success(void)
ndp_opt_mtu_t *opt;
TEST_ASSERT(gnrc_pktbuf_is_empty());
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp2_opt_mtu_build(TEST_MTU, NULL)));
TEST_ASSERT_NOT_NULL((pkt = gnrc_ndp_opt_mtu_build(TEST_MTU, NULL)));
TEST_ASSERT(gnrc_pktbuf_is_sane());
/* check packet meta-data */
TEST_ASSERT_ALLOCATION(pkt, ceil8(sizeof(ndp_opt_mtu_t)), GNRC_NETTYPE_UNDEF);
@ -435,7 +435,7 @@ static void test_nbr_sol_send(const ipv6_addr_t *src)
ndp_nbr_sol_t *nbr_sol;
TEST_ASSERT_NOT_NULL(test_netif);
gnrc_ndp2_nbr_sol_send(&test_tgt, test_netif, src, &test_dst, NULL);
gnrc_ndp_nbr_sol_send(&test_tgt, test_netif, src, &test_dst, NULL);
msg_receive(&msg);
TEST_ASSERT_EQUAL_INT(GNRC_NETAPI_MSG_TYPE_SND, msg.type);
pkt = msg.content.ptr;
@ -494,7 +494,7 @@ static void test_nbr_adv_send(const ipv6_addr_t *tgt, const ipv6_addr_t *dst,
ndp_nbr_adv_t *nbr_adv;
TEST_ASSERT_NOT_NULL(test_netif);
gnrc_ndp2_nbr_adv_send(tgt, test_netif, dst, supply_tl2a, exp_ext_opts);
gnrc_ndp_nbr_adv_send(tgt, test_netif, dst, supply_tl2a, exp_ext_opts);
msg_receive(&msg);
TEST_ASSERT_EQUAL_INT(GNRC_NETAPI_MSG_TYPE_SND, msg.type);
pkt = msg.content.ptr;
@ -642,7 +642,7 @@ static void test_rtr_sol_send(const ipv6_addr_t *dst)
ndp_rtr_sol_t *rtr_sol;
TEST_ASSERT_NOT_NULL(test_netif);
gnrc_ndp2_rtr_sol_send(test_netif, dst);
gnrc_ndp_rtr_sol_send(test_netif, dst);
msg_receive(&msg);
TEST_ASSERT_EQUAL_INT(GNRC_NETAPI_MSG_TYPE_SND, msg.type);
pkt = msg.content.ptr;
@ -705,7 +705,7 @@ static void test_rtr_adv_send(const ipv6_addr_t *src, const ipv6_addr_t *dst,
ndp_rtr_adv_t *rtr_adv;
TEST_ASSERT_NOT_NULL(test_netif);
gnrc_ndp2_rtr_adv_send(test_netif, src, dst, fin, exp_ext_opts);
gnrc_ndp_rtr_adv_send(test_netif, src, dst, fin, exp_ext_opts);
msg_receive(&msg);
TEST_ASSERT_EQUAL_INT(GNRC_NETAPI_MSG_TYPE_SND, msg.type);
pkt = msg.content.ptr;
@ -834,7 +834,7 @@ static void test_rtr_adv_send__src_dst_fin_ext_opts(void)
}
#endif
static Test *tests_gnrc_ndp2_build(void)
static Test *tests_gnrc_ndp_build(void)
{
EMB_UNIT_TESTFIXTURES(fixtures) {
new_TestFixture(test_nbr_sol_build__pktbuf_full),
@ -865,7 +865,7 @@ static Test *tests_gnrc_ndp2_build(void)
return (Test *)&tests;
}
static Test *tests_gnrc_ndp2_send(void)
static Test *tests_gnrc_ndp_send(void)
{
EMB_UNIT_TESTFIXTURES(fixtures) {
new_TestFixture(test_nbr_sol_send__src_NULL),
@ -917,9 +917,9 @@ static Test *tests_gnrc_ndp2_send(void)
int main(void)
{
TESTS_START();
TESTS_RUN(tests_gnrc_ndp2_build());
TESTS_RUN(tests_gnrc_ndp_build());
init_pkt_handler();
TESTS_RUN(tests_gnrc_ndp2_send());
TESTS_RUN(tests_gnrc_ndp_send());
TESTS_END();
return 0;
@ -1003,7 +1003,7 @@ static void init_pkt_handler(void)
msg_init_queue(msg_queue_main, MSG_QUEUE_SIZE);
gnrc_netreg_entry_init_pid(&netreg_entry, GNRC_NETREG_DEMUX_CTX_ALL,
sched_active_pid);
gnrc_netreg_register(GNRC_NETTYPE_NDP2, &netreg_entry);
gnrc_netreg_register(GNRC_NETTYPE_NDP, &netreg_entry);
netdev_test_setup(&dev, NULL);
test_netif = gnrc_netif_create(test_netif_stack, sizeof(test_netif_stack),
GNRC_NETIF_PRIO, "test-netif",

View File

@ -992,6 +992,7 @@ static void test_netapi_send__raw_unicast_ethernet_packet(void)
gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, "ABCDEFG",
sizeof("ABCDEFG"),
GNRC_NETTYPE_UNDEF);
TEST_ASSERT_NOT_NULL(pkt);
gnrc_pktsnip_t *netif = gnrc_netif_hdr_build(NULL, 0, dst, sizeof(dst));
TEST_ASSERT_NOT_NULL(netif);