pktdump: add icmpv6 print
This commit is contained in:
parent
40a6664831
commit
7fdd473271
@ -273,6 +273,7 @@ endif
|
|||||||
ifneq (,$(filter gnrc_icmpv6,$(USEMODULE)))
|
ifneq (,$(filter gnrc_icmpv6,$(USEMODULE)))
|
||||||
USEMODULE += inet_csum
|
USEMODULE += inet_csum
|
||||||
USEMODULE += gnrc_ipv6
|
USEMODULE += gnrc_ipv6
|
||||||
|
USEMODULE += icmpv6
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter gnrc_rpl_srh,$(USEMODULE)))
|
ifneq (,$(filter gnrc_rpl_srh,$(USEMODULE)))
|
||||||
|
|||||||
@ -28,6 +28,9 @@ endif
|
|||||||
ifneq (,$(filter netdev2_test,$(USEMODULE)))
|
ifneq (,$(filter netdev2_test,$(USEMODULE)))
|
||||||
DIRS += net/netdev2_test
|
DIRS += net/netdev2_test
|
||||||
endif
|
endif
|
||||||
|
ifneq (,$(filter icmpv6,$(USEMODULE)))
|
||||||
|
DIRS += net/network_layer/icmpv6
|
||||||
|
endif
|
||||||
ifneq (,$(filter ipv4_addr,$(USEMODULE)))
|
ifneq (,$(filter ipv4_addr,$(USEMODULE)))
|
||||||
DIRS += net/network_layer/ipv4/addr
|
DIRS += net/network_layer/ipv4/addr
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -217,6 +217,13 @@ typedef struct __attribute__((packed)) {
|
|||||||
network_uint16_t seq; /**< Sequence number */
|
network_uint16_t seq; /**< Sequence number */
|
||||||
} icmpv6_echo_t;
|
} icmpv6_echo_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Print the given ICMPv6 header to STDOUT
|
||||||
|
*
|
||||||
|
* @param[in] hdr ICMPv6 header to print
|
||||||
|
*/
|
||||||
|
void icmpv6_hdr_print(icmpv6_hdr_t *hdr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "net/gnrc/pktdump.h"
|
#include "net/gnrc/pktdump.h"
|
||||||
#include "net/gnrc.h"
|
#include "net/gnrc.h"
|
||||||
|
#include "net/icmpv6.h"
|
||||||
#include "net/ipv6/addr.h"
|
#include "net/ipv6/addr.h"
|
||||||
#include "net/ipv6/hdr.h"
|
#include "net/ipv6/hdr.h"
|
||||||
#include "net/udp.h"
|
#include "net/udp.h"
|
||||||
@ -71,6 +72,7 @@ static void _dump_snip(gnrc_pktsnip_t *pkt)
|
|||||||
#ifdef MODULE_GNRC_ICMPV6
|
#ifdef MODULE_GNRC_ICMPV6
|
||||||
case GNRC_NETTYPE_ICMPV6:
|
case GNRC_NETTYPE_ICMPV6:
|
||||||
printf("NETTYPE_ICMPV6 (%i)\n", pkt->type);
|
printf("NETTYPE_ICMPV6 (%i)\n", pkt->type);
|
||||||
|
icmpv6_hdr_print(pkt->data);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MODULE_GNRC_TCP
|
#ifdef MODULE_GNRC_TCP
|
||||||
|
|||||||
1
sys/net/network_layer/icmpv6/Makefile
Normal file
1
sys/net/network_layer/icmpv6/Makefile
Normal file
@ -0,0 +1 @@
|
|||||||
|
include $(RIOTBASE)/Makefile.base
|
||||||
27
sys/net/network_layer/icmpv6/icmpv6_hdr_print.c
Normal file
27
sys/net/network_layer/icmpv6/icmpv6_hdr_print.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 HAW Hamburg
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @author smlng <s@mlng.net>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include "net/icmpv6.h"
|
||||||
|
|
||||||
|
void icmpv6_hdr_print(icmpv6_hdr_t *hdr)
|
||||||
|
{
|
||||||
|
printf(" type: %3" PRIu8 " code: %3" PRIu8 "\n", hdr->type, hdr->code);
|
||||||
|
printf(" cksum: 0x4%" PRIx16 "\n", byteorder_ntohs(hdr->csum));
|
||||||
|
}
|
||||||
|
/** @} */
|
||||||
Loading…
x
Reference in New Issue
Block a user