Output corrupted frame reasons.
authorFlorian Pose <fp@igh-essen.com>
Wed, 05 Nov 2008 09:59:20 +0000
changeset 1303 448f2e9fa483
parent 1302 92a2a3d1bb79
child 1304 853c83c72f44
Output corrupted frame reasons.
master/master.c
--- a/master/master.c	Tue Oct 28 13:31:20 2008 +0000
+++ b/master/master.c	Wed Nov 05 09:59:20 2008 +0000
@@ -750,6 +750,11 @@
     ec_datagram_t *datagram;
 
     if (unlikely(size < EC_FRAME_HEADER_SIZE)) {
+        if (master->debug_level) {
+            EC_DBG("Corrupted frame received (size %u < %u byte):\n",
+                    size, EC_FRAME_HEADER_SIZE);
+            ec_print_data(frame_data, size);
+        }
         master->stats.corrupted++;
         ec_master_output_stats(master);
         return;
@@ -762,6 +767,11 @@
     cur_data += EC_FRAME_HEADER_SIZE;
 
     if (unlikely(frame_size > size)) {
+        if (master->debug_level) {
+            EC_DBG("Corrupted frame received (invalid frame size %u for "
+                    "received size %u):\n", frame_size, size);
+            ec_print_data(frame_data, size);
+        }
         master->stats.corrupted++;
         ec_master_output_stats(master);
         return;
@@ -778,6 +788,11 @@
 
         if (unlikely(cur_data - frame_data
                      + data_size + EC_DATAGRAM_FOOTER_SIZE > size)) {
+            if (master->debug_level) {
+                EC_DBG("Corrupted frame received (invalid data size %u):\n",
+                        data_size);
+                ec_print_data(frame_data, size);
+            }
             master->stats.corrupted++;
             ec_master_output_stats(master);
             return;