Ethereal-dev: [Ethereal-dev] Small change to lwapp dissector
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: David Frascone <dave@xxxxxxxxxxxx>
Date: Tue, 16 Dec 2003 12:21:03 -0600
LWAPP has been slightly modified to send control over 12223 and data over port 12222. However, since there is still a flag in the header, that determines control or data, the redundant port information can be ignored. HOWEVER: Now, the APs are sending their identification (mac address) as the first 6 bytes when control packets go from the AP and to the switch. Luckily, this can be determined by examining the ports. So, for all the possible messages: AP DATA -> AR AP Control -> AR AR DATA -> AP AR Control -> AP Only the AP Control -> AR has that problem. And, in that message, all we have to do is check that the destination port is 12223. This patch implements the above. Let me know if you want a packet to test with. -Dave -- David Frascone This isn't hell, but I can see it from here.
Index: packet-lwapp.c =================================================================== RCS file: /cvsroot/ethereal/packet-lwapp.c,v retrieving revision 1.4 diff -u -r1.4 packet-lwapp.c --- packet-lwapp.c 24 Sep 2003 23:35:39 -0000 1.4 +++ packet-lwapp.c 16 Dec 2003 18:15:13 -0000 @@ -69,6 +69,7 @@ static gint hf_lwapp_rssi = -1; static gint hf_lwapp_snr = -1; static gint hf_lwapp_control = -1; +static gint hf_lwapp_control_mac = -1; static gint hf_lwapp_control_type = -1; static gint hf_lwapp_control_seq_no = -1; static gint hf_lwapp_control_length = -1; @@ -345,11 +346,13 @@ proto_tree *tree) { LWAPP_Header header; - guint8 slotId; - guint8 version; - proto_tree *lwapp_tree; - proto_tree *flags_tree; - tvbuff_t *next_client; + guint8 slotId; + guint8 version; + proto_tree *lwapp_tree; + proto_tree *flags_tree; + tvbuff_t *next_client; + char dest_mac[6]; + guint8 have_destmac=0; /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; @@ -364,8 +367,20 @@ "LWAPP IP or Layer 2"); } - /* Copy our header */ - tvb_memcpy(tvb, (guint8*) &header, offset, sizeof(header)); + /* First, set up our dest mac, if we're a control packet with a + * dest of port 12223 */ + if (pinfo->destport == 12223 ) { + tvb_memcpy(tvb, (guint8*)dest_mac, offset, 6); + have_destmac = 1; + + /* Copy our header */ + tvb_memcpy(tvb, (guint8*) &header, offset + 6, sizeof(header)); + } else { + + /* Copy our header */ + tvb_memcpy(tvb, (guint8*) &header, offset, sizeof(header)); + } + /* * Fix the length (network byte ordering), and set our version & @@ -393,6 +408,12 @@ tvb_length(tvb), FALSE); lwapp_tree = proto_item_add_subtree(ti, ett_lwapp); + if (have_destmac) { + proto_tree_add_ether(lwapp_tree, hf_lwapp_control_mac, tvb, offset, + 6, dest_mac); + offset += 6; + } + proto_tree_add_uint(lwapp_tree, hf_lwapp_version, tvb, offset, 1, version); proto_tree_add_uint(lwapp_tree, hf_lwapp_slotid, @@ -425,7 +446,7 @@ } /* tree */ - next_client = tvb_new_subset(tvb, sizeof(LWAPP_Header), -1, -1); + next_client = tvb_new_subset(tvb, (have_destmac?6:0) + sizeof(LWAPP_Header), -1, -1); if ((header.flags & LWAPP_FLAGS_T) == 0) { call_dissector(swap_frame_control ? wlan_bsfc_handle : wlan_handle, next_client, pinfo, tree); @@ -473,6 +494,9 @@ { &hf_lwapp_control, { "Control Data (not dissected yet)","lwapp.control", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL }}, + { &hf_lwapp_control_mac, + { "AP Identity", "lwapp.apid", FT_ETHER, BASE_NONE, NULL, 0x0, + "Access Point Identity", HFILL }}, { &hf_lwapp_control_type, { "Control Type", "lwapp.control.type", FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL }}, @@ -556,6 +580,7 @@ /* new-style lwapp directly over UDP: L3-lwapp*/ dissector_add("udp.port", 12222, lwapp_handle); + dissector_add("udp.port", 12223, lwapp_handle); /* Lwapp over L2 */ dissector_add("ethertype", 0x88bb, lwapp_handle);
- Follow-Ups:
- Re: [Ethereal-dev] Small change to lwapp dissector
- From: Guy Harris
- Re: [Ethereal-dev] Small change to lwapp dissector
- Prev by Date: [Ethereal-dev] console with: asn1/default.tt
- Next by Date: Re: [Ethereal-dev] Compiler warning in menu.c
- Previous by thread: Re: [Ethereal-dev] console with: asn1/default.tt
- Next by thread: Re: [Ethereal-dev] Small change to lwapp dissector
- Index(es):