Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Patch to fix LANforge protcol.

From: Brent Lovelace <brent.lovelace@xxxxxxxxxxxxxxx>
Date: Thu, 9 Jun 2016 14:15:09 -0700
The attached patch fixes a bug we noticed in wireshark.

--
Brent Lovelace
Candela Technologies
brent.lovelace@xxxxxxxxxxxxxxx
Office: 360-380-1618

>From 557655e907d5bc988ee019c1b10689d3864ed943 Mon Sep 17 00:00:00 2001
From: Brent Lovelace <brent.lovelace@xxxxxxxxxxxxxxx>
Date: Thu, 9 Jun 2016 13:34:37 -0700
Subject: [PATCH] Fix LANforge protocol regression in 7541b470

Allows LANforge protocol to be properly decoded again.
This fixes commit 7541b470206726239051a0453ceeb377d80cb19d
by Anders Broman <anders.broman@xxxxxxxxxxxx> in 2013.

Signed-off-by: Brent Lovelace <brent.lovelace@xxxxxxxxxxxxxxx>
---
 epan/dissectors/packet-lanforge.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/epan/dissectors/packet-lanforge.c b/epan/dissectors/packet-lanforge.c
index 2dbc958..353a3c7 100644
--- a/epan/dissectors/packet-lanforge.c
+++ b/epan/dissectors/packet-lanforge.c
@@ -37,7 +37,7 @@ void proto_register_lanforge(void);
 void proto_reg_handoff_lanforge(void);
 
 /* magic num used for heuristic */
-#define LANFORGE_MAGIC 0x1a2b3c4d
+static const guint8 lanforge_magic[] = { 0x1a, 0x2b, 0x3c, 0x4d };
 
 /* Initialize the protocol and registered fields */
 static int proto_lanforge = -1;
@@ -69,7 +69,7 @@ static gboolean dissect_lanforge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
     nstime_t tstamp;
     guint32 tss;
     guint32 tmpi;
-    guint32 pld_len, magic;
+    guint32 pld_len;
 
     /* check for min size */
     if(tvb_captured_length(tvb) < 28) {  /* Not a LANforge packet. */
@@ -77,10 +77,8 @@ static gboolean dissect_lanforge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
     }
 
     /* check for magic number */
-    magic = tvb_get_ntohl(tvb,0);
-    if(magic != LANFORGE_MAGIC){
-        /* Not a LANforge packet. */
-        return FALSE;
+    if(tvb_memeql(tvb, 4, lanforge_magic, 4) == -1) { /* Not a LANforge packet. */
+       return FALSE;
     }
 
     /* Make entries in Protocol column and Info column on summary display */
-- 
1.9.1