Skip to content

Commit

Permalink
[PATCH] Fixed some endian issues with 802.11 header usage in ieee8021…
Browse files Browse the repository at this point in the history
…1_rx.c

Fixed some endian issues with 802.11 header usage in ieee80211_rx.c

Signed-off-by: James Ketrenos <jketreno@linux.intel.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
  • Loading branch information
James Ketrenos authored and Jeff Garzik committed Sep 16, 2005
1 parent 9c8a11d commit fd27817
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions net/ieee80211/ieee80211_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,11 +787,11 @@ static inline int ieee80211_network_init(struct ieee80211_device *ieee,

/* Pull out fixed field data */
memcpy(network->bssid, beacon->header.addr3, ETH_ALEN);
network->capability = beacon->capability;
network->capability = le16_to_cpu(beacon->capability);
network->last_scanned = jiffies;
network->time_stamp[0] = beacon->time_stamp[0];
network->time_stamp[1] = beacon->time_stamp[1];
network->beacon_interval = beacon->beacon_interval;
network->time_stamp[0] = le32_to_cpu(beacon->time_stamp[0]);
network->time_stamp[1] = le32_to_cpu(beacon->time_stamp[1]);
network->beacon_interval = le16_to_cpu(beacon->beacon_interval);
/* Where to pull this? beacon->listen_interval; */
network->listen_interval = 0x0A;
network->rates_len = network->rates_ex_len = 0;
Expand Down Expand Up @@ -1070,8 +1070,9 @@ static inline void ieee80211_process_probe_response(struct ieee80211_device
escape_essid(info_element->data,
info_element->len),
MAC_ARG(beacon->header.addr3),
WLAN_FC_GET_STYPE(beacon->header.
frame_ctl) ==
WLAN_FC_GET_STYPE(le16_to_cpu
(beacon->header.
frame_ctl)) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
return;
Expand Down Expand Up @@ -1122,8 +1123,9 @@ static inline void ieee80211_process_probe_response(struct ieee80211_device
escape_essid(network.ssid,
network.ssid_len),
MAC_ARG(network.bssid),
WLAN_FC_GET_STYPE(beacon->header.
frame_ctl) ==
WLAN_FC_GET_STYPE(le16_to_cpu
(beacon->header.
frame_ctl)) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
#endif
Expand All @@ -1134,8 +1136,9 @@ static inline void ieee80211_process_probe_response(struct ieee80211_device
escape_essid(target->ssid,
target->ssid_len),
MAC_ARG(target->bssid),
WLAN_FC_GET_STYPE(beacon->header.
frame_ctl) ==
WLAN_FC_GET_STYPE(le16_to_cpu
(beacon->header.
frame_ctl)) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
update_network(target, &network);
Expand All @@ -1148,20 +1151,23 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))) {
case IEEE80211_STYPE_ASSOC_RESP:
IEEE80211_DEBUG_MGMT("received ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
WLAN_FC_GET_STYPE(le16_to_cpu
(header->frame_ctl)));
break;

case IEEE80211_STYPE_REASSOC_RESP:
IEEE80211_DEBUG_MGMT("received REASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
WLAN_FC_GET_STYPE(le16_to_cpu
(header->frame_ctl)));
break;

case IEEE80211_STYPE_PROBE_RESP:
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
WLAN_FC_GET_STYPE(le16_to_cpu
(header->frame_ctl)));
IEEE80211_DEBUG_SCAN("Probe response\n");
ieee80211_process_probe_response(ieee,
(struct
Expand All @@ -1171,7 +1177,8 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee,

case IEEE80211_STYPE_BEACON:
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
WLAN_FC_GET_STYPE(le16_to_cpu
(header->frame_ctl)));
IEEE80211_DEBUG_SCAN("Beacon\n");
ieee80211_process_probe_response(ieee,
(struct
Expand All @@ -1181,10 +1188,12 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee,

default:
IEEE80211_DEBUG_MGMT("received UNKNOWN (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
WLAN_FC_GET_STYPE(le16_to_cpu
(header->frame_ctl)));
IEEE80211_WARNING("%s: Unknown management packet: %d\n",
ieee->dev->name,
WLAN_FC_GET_STYPE(header->frame_ctl));
WLAN_FC_GET_STYPE(le16_to_cpu
(header->frame_ctl)));
break;
}
}
Expand Down

0 comments on commit fd27817

Please sign in to comment.