Wireshark-dev: [Wireshark-dev] Adding live 802.15.4 Capture
From: Colin O'Flynn <coflynn@xxxxxxxxx>
Date: Tue, 30 Sep 2008 20:44:20 -0300
Hello, I am working on a project which routes IPv6 over 802.15.4, or 6lowpan. Part of this project (the part I'm working on) uses a USB stick to interface this network to the computer. This mounts a USB stick as a fake ethernet interface, so the computer can easily send/receive IPv6 packets. An easy addition to this is to send the raw 802.15.4 data over the ethernet interface. When I do this, I just set the "ETHTYPE" to a value specifying 802.15.4 data. The problem is the IEEE hasn't specified an offical value, so I just choose a value which is unassigned and I couldn't find refernces too anywhere. Simply by adding the line dissector_add("ethertype", 0x809A, ieee802154_handle); Wireshark will decode the packet, giving you live 802.15.4 capture! Thanks to Guy Harris for pointing me in the right direction there... I'm hoping to have this included in the main Wireshark branch... but am trying to get this as a user preference before submitting the patch. It's quite small so I've attached it here. The problem is I don't see "wpan" as an option in the prefrences dialog! Any hints to what I am doing wrong? It seems fairly simple, however I'm not very familiar with the Wireshark sources. Thanks, -Colin O'Flynn BTW: For those interested, the hardware is "RZ USBstick" by Atmel. It's $44 CAD, or you can get a development kit for $113 CAD with it. The software is open-source, based on Contiki.
--- /media/disk/packet-ieee802154.c 2008-09-25 23:48:38.000000000 -0300 +++ packet-ieee802154.c 2008-09-03 19:56:30.000000000 -0300 @@ -79,7 +79,6 @@ #include <epan/expert.h> #include <epan/addr_resolv.h> - #include "packet-ieee802154.h" #include "packet-frame.h" /* For Exception Handling */ @@ -87,10 +86,6 @@ #define DISSECT_IEEE802154_OPTION_CC24xx 0x00000001 /* FCS field contains a TI CC24xx style FCS. */ #define DISSECT_IEEE802154_OPTION_LINUX 0x00000002 /* Addressing fields are padded DLT_IEEE802_15_4_LINUX, not implemented. */ -/* ethertype for 802.15.4 tag - encapsulating an Ethernet packet */ -static unsigned int ieee802154_ethertype = 0x809A; -static unsigned int old_ieee802154_ethertype; - /* Function declarations */ /* Register Functions. Loads the dissector into Wireshark. */ void proto_reg_handoff_ieee802154 (void); @@ -1668,8 +1663,6 @@ &ett_ieee802154_bcn_pending }; - module_t *ieee802154_module; - /* Register Protocol name and description. */ proto_ieee802154 = proto_register_protocol("IEEE 802.15.4 Low-Rate Wireless PAN", "IEEE 802.15.4", "wpan"); @@ -1677,14 +1670,6 @@ proto_register_field_array(proto_ieee802154, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - /* add a user preference to set the 802.15.4 ethertype */ - ieee802154_module = prefs_register_protocol(proto_ieee802154, - proto_reg_handoff_ieee802154); - prefs_register_uint_preference(ieee802154_module, "802154_ethertype", - "802.15.4 Ethertype", - "Ethertype used to indicate IEEE 802.15.4 frame.", - 16, &ieee802154_ethertype); - /* Register the subdissector list */ register_heur_dissector_list("wpan", &ieee802154_heur_subdissector_list); @@ -1692,10 +1677,6 @@ register_dissector("wpan", dissect_ieee802154, proto_ieee802154); register_dissector("wpan_nofcs", dissect_ieee802154_nofcs, proto_ieee802154); register_dissector("wpan_cc24xx", dissect_ieee802154_cc24xx, proto_ieee802154); - - - - } /* proto_register_ieee802154 */ /*FUNCTION:------------------------------------------------------ @@ -1712,24 +1693,13 @@ */ void proto_reg_handoff_ieee802154(void) { - static gboolean prefs_initialized = FALSE; - static dissector_handle_t ieee802154_handle; + dissector_handle_t ieee802154_handle; + + /* Get the dissector handles. */ + ieee802154_handle = find_dissector("wpan"); + data_handle = find_dissector("data"); - if (!prefs_initialized){ - /* Get the dissector handles. */ - ieee802154_handle = find_dissector("wpan"); - - prefs_initialized = TRUE; - } else { - dissector_delete("ethertype", old_ieee802154_ethertype, ieee802154_handle); - } - - data_handle = find_dissector("data"); - - old_ieee802154_ethertype = ieee802154_ethertype; - /* Register dissector handles. */ dissector_add("wtap_encap", WTAP_ENCAP_IEEE802_15_4, ieee802154_handle); - dissector_add("ethertype", ieee802154_ethertype, ieee802154_handle); } /* proto_reg_handoff_ieee802154 */
- Follow-Ups:
- Re: [Wireshark-dev] Adding live 802.15.4 Capture
- From: Bill Meier
- Re: [Wireshark-dev] Adding live 802.15.4 Capture
- Prev by Date: Re: [Wireshark-dev] oracle sql dissector
- Next by Date: Re: [Wireshark-dev] Adding live 802.15.4 Capture
- Previous by thread: Re: [Wireshark-dev] oracle sql dissector
- Next by thread: Re: [Wireshark-dev] Adding live 802.15.4 Capture
- Index(es):