summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-11-09 20:08:28 +0100
committerHarald Welte <laforge@gnumonks.org>2015-11-09 20:08:28 +0100
commit0b39cc91817ebf29f11553368aea343bdd2f33bf (patch)
tree7da89eec454c8cb4e81b772a49dadbe7ab772857
parenta915c1c944938f332e70aff8927f19b6e381eeea (diff)
hapc_test: don't print checksum if it matches
-rw-r--r--hapc_test.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hapc_test.c b/hapc_test.c
index a240c14..377c22d 100644
--- a/hapc_test.c
+++ b/hapc_test.c
@@ -28,12 +28,18 @@ static uint8_t compute_checksum(const uint8_t *data, unsigned int len)
void dump_frame(const struct hapc_msg_hdr *hdr)
{
unsigned int len = hapc_payload_len(hdr);
+ uint8_t csum_frame, csum_computed;
printf("len=%4u, flow_id=%s: ", len,
get_value_string(hapc_flow_names, hdr->flow_id));
- printf("checksum=0x%02x, computed=0x%02x\n",
- hapc_frame_csum(hdr), compute_checksum((const uint8_t *) hdr, sizeof(*hdr)+len));
+ csum_frame = hapc_frame_csum(hdr);
+ csum_computed = compute_checksum((const uint8_t *) hdr, sizeof(*hdr)+len);
+
+ if (csum_frame != csum_computed) {
+ printf("CSUM ERROR (%02x != %02x)\n", csum_frame, csum_computed);
+ return;
+ }
switch (hdr->flow_id) {
case HAPC_FLOW_OBJECT:
personal git repositories of Harald Welte. Your mileage may vary