aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2021-02-04 12:20:30 +0100
committerMauro Sardara <msardara@cisco.com>2021-02-05 09:54:15 +0100
commit8d08f8dd79ac12874ba0da6b26973f5a33163131 (patch)
tree554993ddd190183a0722112ace984f6077e0aa8e /lib
parentf77f2a01fb49b52f02d6493e926d0ccc41abf4d0 (diff)
[HICN-679] Do not throw exception when receiving corrupted/not-hicn packet from network layer
Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I082e3c1b5fc9f535089114cfe14940f094947b66 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/includes/hicn/common.h2
-rw-r--r--lib/src/common.c15
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/includes/hicn/common.h b/lib/includes/hicn/common.h
index 30f370241..6904c6314 100644
--- a/lib/includes/hicn/common.h
+++ b/lib/includes/hicn/common.h
@@ -250,7 +250,7 @@ u32 cumulative_hash32 (const void *data, size_t len, u32 lastValue);
u32 hash32 (const void *data, size_t len);
u64 cumulative_hash64 (const void *data, size_t len, u64 lastValue);
u64 hash64 (const void *data, size_t len);
-void hicn_packet_dump (uint8_t * buffer, size_t len);
+void hicn_packet_dump (const uint8_t * buffer, size_t len);
#endif /* ! HICN_VPP_PLUGIN */
diff --git a/lib/src/common.c b/lib/src/common.c
index 78d25b770..228a59d1e 100644
--- a/lib/src/common.c
+++ b/lib/src/common.c
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <hicn/common.h>
+#include <hicn/util/log.h>
@@ -109,7 +110,7 @@ hash64 (const void *data, size_t len)
}
void
-hicn_packet_dump (uint8_t * buffer, size_t len)
+hicn_packet_dump (const uint8_t * buffer, size_t len)
{
int i;
unsigned char buff[17];
@@ -118,7 +119,7 @@ hicn_packet_dump (uint8_t * buffer, size_t len)
// Output description if given.
if (len == 0)
{
- printf (" ZERO LENGTH\n");
+ TRACE (" ZERO LENGTH\n");
return;
}
@@ -131,14 +132,14 @@ hicn_packet_dump (uint8_t * buffer, size_t len)
{
// Just don't print ASCII for the zeroth line.
if (i != 0)
- printf (" %s\n", buff);
+ TRACE (" %s\n", buff);
// Output the offset.
- printf (" %04x ", i);
+ TRACE (" %04x ", i);
}
// Now the hex code for the specific character.
- printf (" %02x", pc[i]);
+ TRACE (" %02x", pc[i]);
// And store a printable ASCII character for later.
if ((pc[i] < 0x20) || (pc[i] > 0x7e))
@@ -151,12 +152,12 @@ hicn_packet_dump (uint8_t * buffer, size_t len)
// Pad out last line if not exactly 16 characters.
while ((i % 16) != 0)
{
- printf (" ");
+ TRACE (" ");
i++;
}
// And print the final ASCII bit.
- printf (" %s\n", buff);
+ TRACE (" %s\n", buff);
}
/*