tests: make gnrc_ipv6_ext test compilable with gnrc_netif2
Test currently not working
This commit is contained in:
parent
6e605177c9
commit
01c21fa274
@ -13,7 +13,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "net/gnrc/ipv6/netif.h"
|
#include "net/gnrc/netif2/internal.h"
|
||||||
|
#include "net/ipv6/ext/rh.h"
|
||||||
#include "net/gnrc/rpl/srh.h"
|
#include "net/gnrc/rpl/srh.h"
|
||||||
|
|
||||||
#define ENABLE_DEBUG (0)
|
#define ENABLE_DEBUG (0)
|
||||||
@ -72,7 +73,7 @@ int gnrc_rpl_srh_process(ipv6_hdr_t *ipv6, gnrc_rpl_srh_t *rh)
|
|||||||
tmp_addr_len = sizeof(ipv6_addr_t) - tmp_pref_elided;
|
tmp_addr_len = sizeof(ipv6_addr_t) - tmp_pref_elided;
|
||||||
}
|
}
|
||||||
memcpy(&tmp.u8[tmp_pref_elided], &addr_vec[k * compri_addr_len], tmp_addr_len);
|
memcpy(&tmp.u8[tmp_pref_elided], &addr_vec[k * compri_addr_len], tmp_addr_len);
|
||||||
if (gnrc_ipv6_netif_find_by_addr(NULL, &tmp) != KERNEL_PID_UNDEF) {
|
if (gnrc_netif2_get_by_ipv6_addr(&tmp) != NULL) {
|
||||||
if (found && ((k - found_pos) > 1)) {
|
if (found && ((k - found_pos) > 1)) {
|
||||||
DEBUG("RPL SRH: found multiple addresses that belong to me - discard\n");
|
DEBUG("RPL SRH: found multiple addresses that belong to me - discard\n");
|
||||||
/* TODO send an ICMP Parameter Problem (Code 0) and discard the packet */
|
/* TODO send an ICMP Parameter Problem (Code 0) and discard the packet */
|
||||||
|
|||||||
@ -29,38 +29,39 @@
|
|||||||
#include "net/gnrc/pktbuf.h"
|
#include "net/gnrc/pktbuf.h"
|
||||||
#include "net/gnrc/netreg.h"
|
#include "net/gnrc/netreg.h"
|
||||||
#include "net/gnrc/netapi.h"
|
#include "net/gnrc/netapi.h"
|
||||||
#include "net/gnrc/netif.h"
|
#include "net/gnrc/netif2.h"
|
||||||
#include "net/gnrc/netif/hdr.h"
|
#include "net/gnrc/netif/hdr.h"
|
||||||
|
|
||||||
static void _init_interface(void)
|
static void _init_interface(void)
|
||||||
{
|
{
|
||||||
kernel_pid_t ifs[GNRC_NETIF_NUMOF];
|
gnrc_netif2_t *iface;
|
||||||
ipv6_addr_t addr = IPV6_ADDR_UNSPECIFIED;
|
ipv6_addr_t addr = IPV6_ADDR_UNSPECIFIED;
|
||||||
|
|
||||||
gnrc_netif_get(ifs);
|
iface = gnrc_netif2_iter(NULL);
|
||||||
|
|
||||||
addr.u8[0] = 0xfd;
|
addr.u8[0] = 0xfd;
|
||||||
addr.u8[1] = 0x01;
|
addr.u8[1] = 0x01;
|
||||||
addr.u8[15] = 0x02;
|
addr.u8[15] = 0x02;
|
||||||
/* fd01::02 */
|
/* add addresses fd01::02/64 and fd01::3/64 to interface */
|
||||||
gnrc_ipv6_netif_add_addr(ifs[0], &addr, 64, GNRC_IPV6_NETIF_ADDR_FLAGS_UNICAST);
|
for (uint8_t i = 0x2; i <= 0x3; i++) {
|
||||||
|
addr.u8[15] = i;
|
||||||
addr.u8[15] = 0x03;
|
if (gnrc_netapi_set(iface->pid, NETOPT_IPV6_ADDR, 64U << 8U, &addr,
|
||||||
/* fd01::03 */
|
sizeof(addr)) < 0) {
|
||||||
gnrc_ipv6_netif_add_addr(ifs[0], &addr, 64, GNRC_IPV6_NETIF_ADDR_FLAGS_UNICAST);
|
printf("error: unable to add IPv6 address fd01::%x/64 to interface %u\n",
|
||||||
|
addr.u8[15], iface->pid);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _send_packet_raw(void)
|
static void _send_packet_raw(void)
|
||||||
{
|
{
|
||||||
kernel_pid_t ifs[GNRC_NETIF_NUMOF];
|
gnrc_netif2_t *iface = gnrc_netif2_iter(NULL);
|
||||||
|
|
||||||
gnrc_netif_get(ifs);
|
|
||||||
|
|
||||||
gnrc_netif_hdr_t netif_hdr;
|
gnrc_netif_hdr_t netif_hdr;
|
||||||
|
|
||||||
gnrc_netif_hdr_init(&netif_hdr, 8, 8);
|
gnrc_netif_hdr_init(&netif_hdr, 8, 8);
|
||||||
|
|
||||||
netif_hdr.if_pid = ifs[0];
|
netif_hdr.if_pid = iface->pid;
|
||||||
|
|
||||||
uint8_t data[] = {
|
uint8_t data[] = {
|
||||||
/* IPv6 Header */
|
/* IPv6 Header */
|
||||||
@ -128,15 +129,13 @@ static void _send_packet_raw(void)
|
|||||||
|
|
||||||
static void _send_packet_parsed(void)
|
static void _send_packet_parsed(void)
|
||||||
{
|
{
|
||||||
kernel_pid_t ifs[GNRC_NETIF_NUMOF];
|
gnrc_netif2_t *iface = gnrc_netif2_iter(NULL);
|
||||||
|
|
||||||
gnrc_netif_get(ifs);
|
|
||||||
|
|
||||||
gnrc_netif_hdr_t netif_hdr;
|
gnrc_netif_hdr_t netif_hdr;
|
||||||
|
|
||||||
gnrc_netif_hdr_init(&netif_hdr, 8, 8);
|
gnrc_netif_hdr_init(&netif_hdr, 8, 8);
|
||||||
|
|
||||||
netif_hdr.if_pid = ifs[0];
|
netif_hdr.if_pid = iface->pid;
|
||||||
|
|
||||||
uint8_t ipv6_data[] = {
|
uint8_t ipv6_data[] = {
|
||||||
/* IPv6 Header */
|
/* IPv6 Header */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user