Wireshark-dev: Re: [Wireshark-dev] Issue with packet-ieee802154.c

From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
Date: Tue, 20 Jan 2015 23:25:18 +0100
2015-01-20 20:09 GMT+01:00 Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>:
Hi Robert,

it is possible to push your patch on Gerrit ? and/or also create a bug in bugtracker ? (with pcap sample) for try

Regards,

Regards,
Pascal.


On Tue, Jan 20, 2015 at 7:29 PM, Robert Cragie <robert.cragie@xxxxxxxxxxxxx> wrote:
Recent commit ecaa1f8d21b1284a267ca08d4d698ca99fbcab83 (onvert variables that were static just because of SET_ADDRESS macro to use the proper pinfo->pool instead) has introduced an error in packet-ieee802154.c. The extended addresses were network byte order before but are now being interpreted the other way around. Perhaps there is still a way of using TVB_SET_ADDRESS but it is not obvious to me right now. I reverted as follows (note I am using an experimental version of packet-ieee802154.c so the line numbers may be different):

diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 0c2bc84..ca0b8cb 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -768,16 +768,21 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
         offset += 2;
     }
     else if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_EXT) {
+        static guint64 addr; /* has to be static due to SET_ADDRESS */
+
         /* Get the address */
         packet->dst64 = tvb_get_letoh64(tvb, offset);
 
+        /* Copy and convert the address to network byte order. */
+        addr = pntoh64(&(packet->dst64));
+
         /* Display the destination address. */
         /* XXX - OUI resolution doesn't happen when displaying resolved
          * EUI64 addresses; that should probably be fixed in
          * epan/addr_resolv.c.
          */
-        TVB_SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, tvb, offset, 8);
-        TVB_SET_ADDRESS(&pinfo->dst, AT_EUI64, tvb, offset, 8);
+        SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, 8, &addr);
+        SET_ADDRESS(&pinfo->dst, AT_EUI64, 8, &addr);
         if (tree) {
             proto_tree_add_item(ieee802154_tree, hf_ieee802154_dst64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
             proto_item_append_text(proto_root, ", Dst: %s", eui64_to_display(wmem_packet_scope(), packet->dst64));
@@ -876,16 +881,21 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
         offset += 2;
     }
     else if (packet->src_addr_mode == IEEE802154_FCF_ADDR_EXT) {
+        static guint64 addr; /* has to be static due to SET_ADDRESS */
+
         /* Get the address. */
         packet->src64 = tvb_get_letoh64(tvb, offset);
 
+        /* Copy and convert the address to network byte order. */
+        addr = pntoh64(&(packet->src64));
+
         /* Display the source address. */
         /* XXX - OUI resolution doesn't happen when displaying resolved
          * EUI64 addresses; that should probably be fixed in
          * epan/addr_resolv.c.
          */
-        TVB_SET_ADDRESS(&pinfo->dl_src, AT_EUI64, tvb, offset, 8);
-        TVB_SET_ADDRESS(&pinfo->src, AT_EUI64, tvb, offset, 8);
+        SET_ADDRESS(&pinfo->dl_src, AT_EUI64, 8, &addr);
+        SET_ADDRESS(&pinfo->src, AT_EUI64, 8, &addr);
         if (tree) {
             proto_tree_add_item(ieee802154_tree, hf_ieee802154_src64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
             proto_item_append_text(proto_root, ", Src: %s", eui64_to_display(wmem_packet_scope(), packet->src64));


___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe


___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe