[etherlab-dev] [PATCH] FoE: fix read packet number check
author"Dave Page <dave.page@gleeble.com>"
Wed, 22 Jan 2014 13:01:45 +1300
changeset 2604 8476f196755b
parent 2603 d366b909b486
child 2605 f3843f68644f
[etherlab-dev] [PATCH] FoE: fix read packet number check
master/fsm_foe.c
--- a/master/fsm_foe.c	Fri Apr 17 10:22:11 2015 +0200
+++ b/master/fsm_foe.c	Wed Jan 22 13:01:45 2014 +1300
@@ -733,7 +733,8 @@
         )
 {
     size_t rec_size;
-    uint8_t *data, opCode, packet_no, mbox_prot;
+    uint32_t packet_no;
+    uint8_t *data, opCode, mbox_prot;
 
     ec_slave_t *slave = fsm->slave;
 
@@ -799,9 +800,10 @@
         return;
     }
 
-    packet_no = EC_READ_U16(data + 2);
+    packet_no = EC_READ_U32(data + 2);
     if (packet_no != fsm->rx_expected_packet_no) {
-        EC_SLAVE_ERR(slave, "Received unexpected packet number.\n");
+        EC_SLAVE_ERR(slave, "Received packet number %u, expected %u.\n",
+                packet_no, fsm->rx_expected_packet_no);
         ec_foe_set_rx_error(fsm, FOE_PACKETNO_ERROR);
         return;
     }