In this post I will put few points over frame encapsulation. We will see few points that we need to understand in frame encapsulation. We will also see how mac80211(which sits on top of ath9k/ath5k etc) encapsulates it. Top layers send the frame in 802.3 format. It is the job of the driver to strip the 802.3 header and insert the 802.11 header. This process of stripping the 802.3 header and inserting the 802.11 header is called encapsulation.
In this particular post I will cover ToDS, FromDS and address fields of the 802.11 header. The actual values that goes to in each field varies with mode (like station, AP, WDS etc). Following table enumerates each mode and possible values for each field. In mac80211, please refer the function, ieee80211_subif_start_xmit.Please note that this path is only 802.11 data frames.
Mode | Address 1 | Address2 | Address3 | Address4 | ToDS | FromDS |
---|---|---|---|---|---|---|
AP | Destination Address. Generally one of the associated stations. |
BSSID. In general this is the MAC address of the VAP. |
Source Address. In general one of the local MAC addresses of the AP or MAC address of machine sitting in the backend network of the AP. |
N/A | 0 | 1 |
Station | BSSID. In general this is the MAC address of the AP. |
Source Address. (Station's MACaddress). |
Destination Address. In general one of the local addresses of the AP or MAC address of a machine sitting in the backend network of the AP. |
N/A | 1 | 0 |
WDS | Receiver address |
Transmitter address | Destination Address. In general one of the local addresses of the Receiver or MAC address of a machine sitting in the backend network of the Receiver. |
Source Address. In general one of the local addresses of the Source or MAC address of a machine sitting in the backend network of the Source. |
1 | 1 |
Ad-hoc | Destination Address |
Source address | BSSID | N/A | 0 | 0 |
Following are few examples. You can verify them using any sniffer like Wireshark, Airopeek etc.
Assume we have a setup like STA<---->AP<---->PC.
In this setup AP is a bridge and STA is associated to the AP. PC is connected to AP with Ethernet interface. We will focus only on the communication between AP and Station.
A packet originated at PC an destined to STA, will have address1 filled with STA's MAC address, address 2 filled with BSSID(In general AP's MAC address) and address3 filled with PC's MAC address.
Assume we have a setup like STA<---->AP<---->PC.
In this setup AP is a Router and STA is associated to the AP. PC is connected to AP with Ethernet interface. Assume AP is the default gateway router for PC to reach STA. We will focus only on the communication between AP and Station.
A packet originated at PC an destined to STA, will have address1 filled
with STA's MAC address, address 2 filled with BSSID(In general AP's MAC
address) and address3 filled AP's MAC address.
Setup3:
Assume we have a setup like STA<---->AP<---->PC.
Assume we have a setup like STA<---->AP<---->PC.
In this setup AP is a bridge and STA is associated to the AP. PC is connected to AP with Ethernet interface. We will focus only on the communication between AP and Station.
A packet originated at STA an destined to PC, will have address1
filled with BSSID(In general
AP's MAC address), address 2 filled with STA's MAC address, and address3 filled with PC's MAC address.
No comments:
Post a Comment