# HG changeset patch
# User "Dave Page <dave.page@gleeble.com>"
# Date 1390348905 -46800
# Node ID 8476f196755b90ea6011662ed0390af44c6a176b
# Parent  d366b909b4862620a76dbb336eba70bcda910798
[etherlab-dev] [PATCH] FoE: fix read packet number check

diff -r d366b909b486 -r 8476f196755b 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;
     }