Wireshark-bugs: [Wireshark-bugs] [Bug 6881] Support for MPLS Packet Loss and Delay Measurement,
Date: Thu, 9 Aug 2012 08:16:42 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6881

--- Comment #15 from FF <francesco.fondelli@xxxxxxxxx> 2012-08-09 08:16:41 PDT ---
(In reply to comment #13)
> (In reply to comment #12)
> > sure, you are right (grrr I tested this with sid = 1, 2 and 3).  Would you 
> > mind to also remove those ugly spaces between types and variables, I 
> > mean:
> > 
> >      } else {
> >          <...>
> >          *sid = ((guint32)sid0 >> 6) | ((guint32)sid1 << 8) |
> >                 ((guint32)sid2 << 16) | ((guint32)sid3 << 24);
> >      }
> > 
> > thanks a lot!
> > ciao
> > FF
> 
> Done in SVN #41118

Hi Bill,

actually, I think I made a mess... my_brain.reboot()

   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |Version| Flags |  Control Code |        Message Length         |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  | DFlags|  OTF  |                   Reserved                    |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                       Session Identifier          |    DS     |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Session Identifier (sid in my code) is encoded in network byte order
and is *26* bits (DS is part of the Session Identifier in case of
class_specific flag is not set).

So... what I think is correct is:

    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);
    } 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 << 2) | (sid2 << 10) | (sid3 << 18);
        *sid = g_ntohl(*sid);
    }

In case you think this is correct feel free to use attachment 8930.

thank you
ciao
FF

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.