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

Ethereal-dev: [Ethereal-dev] Malformed packet

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: ana <ana@xxxxxxxxxxxxxxx>
Date: Wed, 26 Mar 2003 12:47:43 +0100
Hi!

I continuos working on the DSR (Dynamic Source Route) protocol. The report Malformed packet is in every packet. It will be caused by the offset declaration, I don't know really. Perhaps you can take a look to the code and see the problem.

This is the dissector code:

guint8 optdatalen,offset= 0x00;
guint16 header_len;

while ((header_len-offset)!=0)
           {

           pdu_type = tvb_get_guint8(tvb,4+offset);
           optdatalen = tvb_get_guint8(tvb,5+offset);

           switch (pdu_type)
               {

                 case DSR_ROUTE_REQ:
tf = proto_tree_add_uint(dsr_tree, hf_dsr_pdutype, tvb, 4+offset, 1, pdu_type); pdutype_tree = proto_item_add_subtree(tf, ett_dsr); proto_tree_add_uint(pdutype_tree, hf_dsr_optdatalen, tvb, 5+offset, 1, optdatalen);
                      break;
                 case DSR_SRC_ROUTE:
tf = proto_tree_add_uint(dsr_tree, hf_dsr_pdutype, tvb, 4+offset, 1, pdu_type); pdutype_tree = proto_item_add_subtree(tf, ett_dsr); proto_tree_add_uint(pdutype_tree, hf_dsr_optdatalen, tvb, 5+offset, 1, optdatalen); break; case DSR_ROUTE_REPLY: tf = proto_tree_add_uint(dsr_tree, hf_dsr_pdutype, tvb, 4+offset, 1, pdu_type); pdutype_tree = proto_item_add_subtree(tf, ett_dsr); proto_tree_add_uint(pdutype_tree, hf_dsr_optdatalen, tvb, 5+offset, 1, optdatalen); break; }
           header_len-=(optdatalen+2);

           if (pdu_type==DSR_PAD0)
               optdatalen+=1;
           else
               optdatalen+=2;

           offset+=optdatalen;
}

Hope toy can help me.
Thanks in advanced,

Ana Rodriguez
Spain