struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 
struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; 
static void handle_beacon(local_info_t *local, struct sk_buff *skb,			  struct hostap_80211_rx_status *rx_stats){	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;	char *body = skb->data + IEEE80211_MGMT_HDR_LEN;	int len, left;	u16 *pos, beacon_int, capability;	char *ssid = NULL;	unsigned char *supp_rates = NULL;	int ssid_len = 0, supp_rates_len = 0;	struct sta_info *sta = NULL;	int new_sta = 0, channel = -1;	len = skb->len - IEEE80211_MGMT_HDR_LEN;	if (len < 8 + 2 + 2) {		printk(KERN_DEBUG "handle_beacon - too short payload "		       "(len=%d)\n", len);		return;	}	pos = (u16 *) body;	left = len;	/* Timestamp (8 octets) */	pos += 4; left -= 8;	/* Beacon interval (2 octets) */	beacon_int = __le16_to_cpu(*pos);	pos++; left -= 2;	/* Capability information (2 octets) */	capability = __le16_to_cpu(*pos);	pos++; left -= 2;	if (local->ap->ap_policy != AP_OTHER_AP_EVEN_IBSS &&	    capability & WLAN_CAPABILITY_IBSS)		return;	if (left >= 2) {		unsigned int ileft;		unsigned char *u = (unsigned char *) pos;		if (*u == WLAN_EID_SSID) {			u++; left--;			ileft = *u;			u++; left--;			if (ileft > left || ileft > MAX_SSID_LEN) {				PDEBUG(DEBUG_AP, "SSID: overflow\n");				return;			}			if (local->ap->ap_policy == AP_OTHER_AP_SAME_SSID &&			    (ileft != strlen(local->essid) ||			     memcmp(local->essid, u, ileft) != 0)) {				/* not our SSID */				return;			}			ssid = u;			ssid_len = ileft;			u += ileft;			left -= ileft;		}		if (*u == WLAN_EID_SUPP_RATES) {			u++; left--;			ileft = *u;			u++; left--;			if (ileft > left || ileft == 0 || ileft > 8) {				PDEBUG(DEBUG_AP, " - SUPP_RATES len error\n");				return;			}			supp_rates = u;			supp_rates_len = ileft;			u += ileft;			left -= ileft;		}		if (*u == WLAN_EID_DS_PARAMS) {			u++; left--;			ileft = *u;			u++; left--;			if (ileft > left || ileft != 1) {				PDEBUG(DEBUG_AP, " - DS_PARAMS len error\n");				return;			}			channel = *u;			u += ileft;			left -= ileft;		}	}	spin_lock_bh(&local->ap->sta_table_lock);	sta = ap_get_sta(local->ap, hdr->addr2);	if (sta != NULL)		atomic_inc(&sta->users);	spin_unlock_bh(&local->ap->sta_table_lock);	if (sta == NULL) {		/* add new AP */		new_sta = 1;		sta = ap_add_sta(local->ap, hdr->addr2);		if (sta == NULL) {			printk(KERN_INFO "prism2: kmalloc failed for AP "			       "data structure\n");			return;		}		hostap_event_new_sta(local->dev, sta);		/* mark APs authentication and associated for pseudo ad-hoc		 * style communication */		sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC;		if (local->ap->autom_ap_wds) {			hostap_wds_link_oper(local, sta->addr, WDS_ADD);		}	}	sta->ap = 1;	if (ssid) {		sta->u.ap.ssid_len = ssid_len;		memcpy(sta->u.ap.ssid, ssid, ssid_len);		sta->u.ap.ssid[ssid_len] = '\0';	} else {		sta->u.ap.ssid_len = 0;		sta->u.ap.ssid[0] = '\0';	}	sta->u.ap.channel = channel;	sta->rx_packets++;	sta->rx_bytes += len;	sta->u.ap.last_beacon = sta->last_rx = jiffies;	sta->capability = capability;	sta->listen_interval = beacon_int;	atomic_dec(&sta->users);	if (new_sta) {		memset(sta->supported_rates, 0, sizeof(sta->supported_rates));		memcpy(sta->supported_rates, supp_rates, supp_rates_len);		prism2_check_tx_rates(sta);	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d041674d62e1ad565f2fb6d53ae80b31d6656033/hostap_ap.c/clean/drivers/net/wireless/hostap/hostap_ap.c