From 733baac21e5447d997a38b38e79c7846ce20c486 Mon Sep 17 00:00:00 2001 From: Chris Maynard Date: Thu, 30 Aug 2012 15:23:54 +0000 Subject: Fix Session ID parsing. Patch from Fransesco Fondelli via bug 6881. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6881 svn path=/trunk/; revision=44701 --- epan/dissectors/packet-mpls-pm.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'epan/dissectors/packet-mpls-pm.c') diff --git a/epan/dissectors/packet-mpls-pm.c b/epan/dissectors/packet-mpls-pm.c index 027b65d7d9..af72f962ce 100644 --- a/epan/dissectors/packet-mpls-pm.c +++ b/epan/dissectors/packet-mpls-pm.c @@ -447,29 +447,22 @@ mpls_pm_build_cinfo(tvbuff_t *tvb, packet_info *pinfo, const char *str_pmt, gboolean *class_specific, guint32 *sid, guint8 *code) { - int offset = 0; - guint32 sid3, sid2, sid1, sid0; - col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "MPLS PM (%s)", str_pmt); col_clear(pinfo->cinfo, COL_INFO); - *response = (tvb_get_guint8(tvb, offset) & 0x08) ? TRUE : FALSE; - *class_specific = (tvb_get_guint8(tvb, offset) & 0x04) ? TRUE : FALSE; + *response = (tvb_get_guint8(tvb, 0) & 0x08) ? TRUE : FALSE; + *class_specific = (tvb_get_guint8(tvb, 0) & 0x04) ? TRUE : FALSE; *query = !(*response); - *code = tvb_get_guint8(tvb, offset + 1); + *code = tvb_get_guint8(tvb, 1); if (!(*class_specific)) { /* * FF: when the T flag is set to 0 the DS field can be considered * part of the Session Identifier. */ - *sid = tvb_get_ntohl(tvb, offset + 8); + *sid = tvb_get_ntohl(tvb, 8); } else { - sid3 = tvb_get_guint8(tvb, offset + 8); - sid2 = tvb_get_guint8(tvb, offset + 9); - sid1 = tvb_get_guint8(tvb, offset + 10); - sid0 = tvb_get_guint8(tvb, offset + 11) & 0xC0; - *sid = (sid0 >> 6) | (sid1 << 8) | (sid2 << 16) | (sid3 << 24); + *sid = tvb_get_ntohl(tvb, 8) >> 6; } if (*query) { -- cgit v1.2.3