if (ieee->wpa_enabled && network->wpa_ie_len) { 
if (network->wpa_ie_len) { 
static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,					   char *start, char *stop,					   struct ieee80211_network *network){	char custom[MAX_CUSTOM_LEN];	char *p;	struct iw_event iwe;	int i, j;	u8 max_rate, rate;	/* First entry *MUST* be the AP MAC address */	iwe.cmd = SIOCGIWAP;	iwe.u.ap_addr.sa_family = ARPHRD_ETHER;	memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN);	start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN);	/* Remaining entries will be displayed in the order we provide them */	/* Add the ESSID */	iwe.cmd = SIOCGIWESSID;	iwe.u.data.flags = 1;	if (network->flags & NETWORK_EMPTY_ESSID) {		iwe.u.data.length = sizeof("<hidden>");		start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");	} else {		iwe.u.data.length = min(network->ssid_len, (u8) 32);		start = iwe_stream_add_point(start, stop, &iwe, network->ssid);	}	/* Add the protocol name */	iwe.cmd = SIOCGIWNAME;	snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s",		 ieee80211_modes[network->mode]);	start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN);	/* Add mode */	iwe.cmd = SIOCGIWMODE;	if (network->capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {		if (network->capability & WLAN_CAPABILITY_ESS)			iwe.u.mode = IW_MODE_MASTER;		else			iwe.u.mode = IW_MODE_ADHOC;		start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN);	}	/* Add frequency/channel */	iwe.cmd = SIOCGIWFREQ;/*	iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode);	iwe.u.freq.e = 3; */	iwe.u.freq.m = network->channel;	iwe.u.freq.e = 0;	iwe.u.freq.i = 0;	start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);	/* Add encryption capability */	iwe.cmd = SIOCGIWENCODE;	if (network->capability & WLAN_CAPABILITY_PRIVACY)		iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;	else		iwe.u.data.flags = IW_ENCODE_DISABLED;	iwe.u.data.length = 0;	start = iwe_stream_add_point(start, stop, &iwe, network->ssid);	/* Add basic and extended rates */	max_rate = 0;	p = custom;	p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): ");	for (i = 0, j = 0; i < network->rates_len;) {		if (j < network->rates_ex_len &&		    ((network->rates_ex[j] & 0x7F) <		     (network->rates[i] & 0x7F)))			rate = network->rates_ex[j++] & 0x7F;		else			rate = network->rates[i++] & 0x7F;		if (rate > max_rate)			max_rate = rate;		p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),			      "%d%s ", rate >> 1, (rate & 1) ? ".5" : "");	}	for (; j < network->rates_ex_len; j++) {		rate = network->rates_ex[j] & 0x7F;		p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),			      "%d%s ", rate >> 1, (rate & 1) ? ".5" : "");		if (rate > max_rate)			max_rate = rate;	}	iwe.cmd = SIOCGIWRATE;	iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;	iwe.u.bitrate.value = max_rate * 500000;	start = iwe_stream_add_event(start, stop, &iwe, IW_EV_PARAM_LEN);	iwe.cmd = IWEVCUSTOM;	iwe.u.data.length = p - custom;	if (iwe.u.data.length)		start = iwe_stream_add_point(start, stop, &iwe, custom);	/* Add quality statistics */	iwe.cmd = IWEVQUAL;	iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED |	    IW_QUAL_NOISE_UPDATED;	if (!(network->stats.mask & IEEE80211_STATMASK_RSSI)) {		iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID |		    IW_QUAL_LEVEL_INVALID;		iwe.u.qual.qual = 0;		iwe.u.qual.level = 0;	} else {		iwe.u.qual.level = network->stats.rssi;		iwe.u.qual.qual =		    (100 *		     (ieee->perfect_rssi - ieee->worst_rssi) *		     (ieee->perfect_rssi - ieee->worst_rssi) -		     (ieee->perfect_rssi - network->stats.rssi) *		     (15 * (ieee->perfect_rssi - ieee->worst_rssi) +		      62 * (ieee->perfect_rssi - network->stats.rssi))) /		    ((ieee->perfect_rssi - ieee->worst_rssi) *		     (ieee->perfect_rssi - ieee->worst_rssi));		if (iwe.u.qual.qual > 100)			iwe.u.qual.qual = 100;		else if (iwe.u.qual.qual < 1)			iwe.u.qual.qual = 0;	}	if (!(network->stats.mask & IEEE80211_STATMASK_NOISE)) {		iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID;		iwe.u.qual.noise = 0;	} else {		iwe.u.qual.noise = network->stats.noise;	}	start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN);	iwe.cmd = IWEVCUSTOM;	p = custom;	iwe.u.data.length = p - custom;	if (iwe.u.data.length)		start = iwe_stream_add_point(start, stop, &iwe, custom);	if (ieee->wpa_enabled && network->wpa_ie_len) {		char buf[MAX_WPA_IE_LEN * 2 + 30];		u8 *p = buf;		p += sprintf(p, "wpa_ie=");		for (i = 0; i < network->wpa_ie_len; i++) {			p += sprintf(p, "%02x", network->wpa_ie[i]);		}		memset(&iwe, 0, sizeof(iwe));		iwe.cmd = IWEVCUSTOM;		iwe.u.data.length = strlen(buf);		start = iwe_stream_add_point(start, stop, &iwe, buf);	}	if (ieee->wpa_enabled && network->rsn_ie_len) {		char buf[MAX_WPA_IE_LEN * 2 + 30];		u8 *p = buf;		p += sprintf(p, "rsn_ie=");		for (i = 0; i < network->rsn_ie_len; i++) {			p += sprintf(p, "%02x", network->rsn_ie[i]);		}		memset(&iwe, 0, sizeof(iwe));		iwe.cmd = IWEVCUSTOM;		iwe.u.data.length = strlen(buf);		start = iwe_stream_add_point(start, stop, &iwe, buf);	}	/* Add EXTRA: Age to display seconds since last beacon/probe response	 * for given network. */	iwe.cmd = IWEVCUSTOM;	p = custom;	p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),		      " Last beacon: %lums ago",		      (jiffies - network->last_scanned) / (HZ / 100));	iwe.u.data.length = p - custom;	if (iwe.u.data.length)		start = iwe_stream_add_point(start, stop, &iwe, custom);	return start;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/20d64713ae71c0b0aa06084acbef2244021baaca/ieee80211_wx.c/clean/net/ieee80211/ieee80211_wx.c