This is our old Q&A Site. Please post any new questions and answers at

I'm getting confused while trying to write code to read frames that contain a CAPWAP header. If I open the file in Wireshark, it prints "(Swapped)" next to the Frame Control Field of the IEEE 802.11 Data decode following the CAPWAP header, and I have no idea how Wireshark realized it needed to do that. I tried reading the packet-ieee80211.c source code file to find out what is being done, but I can't track it down...

This is how the decode of the CAPWAP frame looks like:

CAPWAP decode

If you look at the hex view you'll see that it says "01 08", which would normally decode to this being a management frame (Type = 0). But somehow Wireshark knows it needs to "swap" something (what exactly? Looks like the "01" byte lower nibble is swapped?). Very confused. Maybe someone with more 802.11 skill can shed a light? Thanks!

BTW don't get confused by the "2c" byte following the "01 08", that's the value for the 44 microsecond duration following the flags. It's not the 2c mentioned for the FCF. Not sure why that value is even mentioned at that position ("0x082c (Swapped)")...

asked 24 Sep '16, 16:38

Jasper's gravatar image

Jasper ♦♦
accept rate: 18%

I'm not sure that an 802.11 skill alone (not that I'd have one) is sufficient here, it has to do with the dissector code and with how it is invoked.

If you take the 802.11 part of your frame alone (from your 01 08 till the end of the frame) and import them indicating a plain IEEE 802.11 Wireless LAN encapsulation, the wlan dissector doesn't handle them the same - in this case, it does interpret the contents of the FCF as announcing a retransmitted control frame, with all the impact to dissection of the rest of it. If you manually swap the two bytes of the FCF, making them 08 01, you get a much more logical interpretation as a TCP SYN packet on its way from STA to AP. Any "logical" operation (nibble or bit pair swapping) cannot explain a change from 0x1 to 0x8.

But the code, packet-ieee80211.c, contains the following remark:

 * Dissect 802.11 with a variable-length link-layer header and a byte-swapped
 * control field and with no FCS (some hardware sends out LWAPP-encapsulated
 * 802.11 packets with the control field byte swapped).
dissect_ieee80211_common(tvb, pinfo, tree, IEEE80211_COMMON_OPT_BROKEN_FC|IEEE80211_COMMON_OPT_NORMAL_QOS, &phdr);

(note the IEEE80211_COMMON_OPT_BROKEN_FC bit, and note that the comment probably means "with a byte-swapped control field", not "with a swapped control-field byte").

LWAPP (RFC 5412) is essentially an indirect reference to CAPWAP (RFC 5415), and CAPWAP doesn't say anything regarding changing the order of FCF bytes. However, there is no heuristic testing which interpretation of the FCF yields better results - encapsulation of the 802.11 frame into CAPWAP implies swapping of the FCF's bytes, dot.

So it seems to me to be an an-initial-mistake-gone-de-facto-standard case.

BTW, the occurrence of the 2c in the "swapped" interpretation of the Frame Control Field in the dissector is likely to be a bug, it really refers to the next byte and shows whatever is there.

permanent link

answered 25 Sep '16, 04:18

sindy's gravatar image

accept rate: 24%

edited 25 Sep '16, 05:41

Thanks, @sindy, this is pretty much in line with what I suspect (mistake-gone-de-facto-standard and "2c" being a bug) - the problem I have is how I can detect/determine that what I see is such a case and not a "normal" 802.11 header...

So you think the 802.11 dissector handles the decoding differently by knowing it was sent as a CAPWAP payload?

(25 Sep '16, 04:29) Jasper ♦♦

So you think the 802.11 dissector handles the decoding differently

I am sure that the fact that the data came CAPWAP-encapsulated alone causes the ieee80211 dissector to swap the FCF bytes while dissecting. I cannot show you the responsible line of the code but I have tested that by fiddling around with the packet data (changing the FCF byte order to the correct one in the complete frame and still getting them dissected as swapped).

how I can detect/determine that what I see is such a case

I'm not sure there is a reliable way to do it on a single frame. Over several (tens of) frames, trying to dissect them both ways and choosing the one which returns less errors might be sufficiently reliable.

(25 Sep '16, 04:51) sindy

Thanks, I think you're right... I'll try to check if the 802.11 layer was sent via CAPWAP and swap the FCF. I also converted your first comment to an answer so I can accept it ;-)

(25 Sep '16, 05:38) Jasper ♦♦

The issue seems to have been around since a while ago: (it is not the first encounter of the issue, just a note that the already existing preference has been moved to a more appropriate place) (still referring to LWAPP and Ethereal rather than CAPWAP and Wireshark) (an evolution of the same document which still doesn't explain why the CAPWAP encapsulation swaps the bytes).

(25 Sep '16, 06:17) sindy
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 24 Sep '16, 16:38

question was seen: 1,377 times

last updated: 25 Sep '16, 06:17

p​o​w​e​r​e​d by O​S​Q​A