static int rtl871x_new_sta(struct rtl871x_driver_data *drv, u8 *addr) { struct hostapd_data *hapd = drv->hapd; int ielen = 0, res=0; u8 iebuf[32], *piebuf=NULL; memset(iebuf, 0 , sizeof(iebuf)); if (rtl871x_get_sta_wpaie(drv, iebuf, addr)) { wpa_printf(MSG_DEBUG, "%s: Failed to get WPA/RSN IE: %s", __func__, strerror(errno)); goto no_ie; } if ((iebuf[0] == WLAN_EID_VENDOR_SPECIFIC) || (iebuf[0] == WLAN_EID_RSN) ) { piebuf = iebuf; ielen = iebuf[1]; if (ielen == 0) piebuf = NULL; else ielen += 2; } no_ie: drv_event_assoc(hapd, addr, piebuf, ielen, 0); if (memcmp(addr, drv->acct_mac, ETH_ALEN) == 0) { /* Cached accounting data is not valid anymore. */ memset(drv->acct_mac, 0, ETH_ALEN); memset(&drv->acct_data, 0, sizeof(drv->acct_data)); } return res; }
static int rtl871x_new_sta(struct rtl871x_driver_data *drv, u8 *addr) { struct hostapd_data *hapd = drv->hapd; //struct ieee80211req_wpaie ie; int ielen = 0, res=0; //u8 *iebuf = NULL; u8 iebuf[32], *piebuf=NULL; /* * Fetch negotiated WPA/RSN parameters from the driver. */ //memset(&ie, 0, sizeof(ie)); //memcpy(ie.wpa_macaddr, addr, IEEE80211_ADDR_LEN); memset(iebuf, 0 , sizeof(iebuf)); if (rtl871x_get_sta_wpaie(drv, iebuf, addr)) { //if (set80211priv(drv, IEEE80211_IOCTL_GETWPAIE, &ie, sizeof(ie))) { wpa_printf(MSG_DEBUG, "%s: Failed to get WPA/RSN IE: %s", __func__, strerror(errno)); goto no_ie; } //wpa_hexdump(MSG_MSGDUMP, "req WPA IE", // ie.wpa_ie, IEEE80211_MAX_OPT_IE); //wpa_hexdump(MSG_MSGDUMP, "req RSN IE", // ie.rsn_ie, IEEE80211_MAX_OPT_IE); //iebuf = ie.wpa_ie; /* if (iebuf[0] != WLAN_EID_VENDOR_SPECIFIC) iebuf[1] = 0; if (iebuf[1] == 0 && ie.rsn_ie[1] > 0) { iebuf = ie.rsn_ie; if (iebuf[0] != WLAN_EID_RSN) iebuf[1] = 0; } */ if ((iebuf[0] == WLAN_EID_VENDOR_SPECIFIC) || (iebuf[0] == WLAN_EID_RSN) ) { piebuf = iebuf; ielen = iebuf[1]; if (ielen == 0) piebuf = NULL; else ielen += 2; } no_ie: //res = rtl871x_notif_assoc(hapd, addr, piebuf, ielen); //drv_event_assoc(hapd, addr, piebuf, ielen); drv_event_assoc(hapd, addr, piebuf, ielen, 0); if (memcmp(addr, drv->acct_mac, ETH_ALEN) == 0) { /* Cached accounting data is not valid anymore. */ memset(drv->acct_mac, 0, ETH_ALEN); memset(&drv->acct_data, 0, sizeof(drv->acct_data)); } return res; }