From ba13d8f5bfb888c5838d639e226374b3bb82ef76 Mon Sep 17 00:00:00 2001
From: Martine Lenders <m.lenders@fu-berlin.de>
Date: Wed, 14 Nov 2018 14:33:09 +0100
Subject: [PATCH] gnrc_icmpv6_error: introduce debug messages

---
 .../network_layer/icmpv6/error/gnrc_icmpv6_error.c     | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/net/gnrc/network_layer/icmpv6/error/gnrc_icmpv6_error.c b/sys/net/gnrc/network_layer/icmpv6/error/gnrc_icmpv6_error.c
index 41dc9730f8..3533b721e0 100644
--- a/sys/net/gnrc/network_layer/icmpv6/error/gnrc_icmpv6_error.c
+++ b/sys/net/gnrc/network_layer/icmpv6/error/gnrc_icmpv6_error.c
@@ -18,6 +18,9 @@
 #include "net/gnrc/icmpv6/error.h"
 #include "net/gnrc/icmpv6.h"
 
+#define ENABLE_DEBUG    (0)
+#include "debug.h"
+
 /* all error messages are basically the same size and format */
 #define ICMPV6_ERROR_SZ (sizeof(icmpv6_error_dst_unr_t))
 #define ICMPV6_ERROR_SET_VALUE(data, value) \
@@ -127,12 +130,16 @@ static void _send(gnrc_pktsnip_t *pkt)
     if (pkt != NULL) {
         gnrc_netapi_send(gnrc_ipv6_pid, pkt);
     }
+    else {
+        DEBUG("gnrc_icmpv6_error: No space in packet buffer left\n");
+    }
 }
 
 void gnrc_icmpv6_error_dst_unr_send(uint8_t code, const gnrc_pktsnip_t *orig_pkt)
 {
     gnrc_pktsnip_t *pkt = _dst_unr_build(code, orig_pkt);
 
+    DEBUG("gnrc_icmpv6_error: trying to send destination unreachable error\n");
     _send(pkt);
 }
 
@@ -141,6 +148,7 @@ void gnrc_icmpv6_error_pkt_too_big_send(uint32_t mtu,
 {
     gnrc_pktsnip_t *pkt = _pkt_too_big_build(mtu, orig_pkt);
 
+    DEBUG("gnrc_icmpv6_error: trying to send packet too big error\n");
     _send(pkt);
 }
 
@@ -149,6 +157,7 @@ void gnrc_icmpv6_error_time_exc_send(uint8_t code,
 {
     gnrc_pktsnip_t *pkt = _time_exc_build(code, orig_pkt);
 
+    DEBUG("gnrc_icmpv6_error: trying to send time exceeded error\n");
     _send(pkt);
 }
 
@@ -157,6 +166,7 @@ void gnrc_icmpv6_error_param_prob_send(uint8_t code, void *ptr,
 {
     gnrc_pktsnip_t *pkt = _param_prob_build(code, ptr, orig_pkt);
 
+    DEBUG("gnrc_icmpv6_error: trying to send parameter problem error\n");
     _send(pkt);
 }
 
-- 
GitLab