static void bsd_new_sta(void *priv, void *ctx, u8 addr[IEEE80211_ADDR_LEN]) { struct ieee80211req_wpaie ie; int ielen = 0; u8 *iebuf = NULL; /* * Fetch and validate any negotiated WPA/RSN parameters. */ memset(&ie, 0, sizeof(ie)); memcpy(ie.wpa_macaddr, addr, IEEE80211_ADDR_LEN); if (get80211var(priv, IEEE80211_IOC_WPAIE, &ie, sizeof(ie)) < 0) { printf("Failed to get WPA/RSN information element.\n"); goto no_ie; } iebuf = ie.wpa_ie; ielen = ie.wpa_ie[1]; if (ielen == 0) iebuf = NULL; else ielen += 2; no_ie: drv_event_assoc(ctx, addr, iebuf, ielen, 0); }
static void madwifi_new_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN]) { struct hostapd_data *hapd = drv->hapd; struct ieee80211req_wpaie ie; int ielen = 0; u8 *iebuf = NULL; /* * Fetch negotiated WPA/RSN parameters from the system. */ memset(&ie, 0, sizeof(ie)); memcpy(ie.wpa_macaddr, addr, IEEE80211_ADDR_LEN); if (set80211priv(drv, IEEE80211_IOCTL_GETWPAIE, &ie, sizeof(ie))) { /* * See ATH_WPS_IE comment in the beginning of the file for a * possible cause for the failure.. */ wpa_printf(MSG_DEBUG, "%s: Failed to get WPA/RSN IE: %s", __func__, strerror(errno)); goto no_ie; } wpa_hexdump(MSG_MSGDUMP, "madwifi req WPA IE", ie.wpa_ie, IEEE80211_MAX_OPT_IE); wpa_hexdump(MSG_MSGDUMP, "madwifi req RSN IE", ie.rsn_ie, IEEE80211_MAX_OPT_IE); iebuf = ie.wpa_ie; /* madwifi seems to return some random data if WPA/RSN IE is not set. * Assume the IE was not included if the IE type is unknown. */ if (iebuf[0] != WLAN_EID_VENDOR_SPECIFIC) iebuf[1] = 0; if (iebuf[1] == 0 && ie.rsn_ie[1] > 0) { /* madwifi-ng svn #1453 added rsn_ie. Use it, if wpa_ie was not * set. This is needed for WPA2. */ iebuf = ie.rsn_ie; if (iebuf[0] != WLAN_EID_RSN) iebuf[1] = 0; } ielen = iebuf[1]; if (ielen == 0) iebuf = NULL; else ielen += 2; no_ie: drv_event_assoc(hapd, addr, iebuf, ielen); 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)); } }
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 ar6000_new_sta(struct ar6000_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN]) { struct hostapd_data *hapd = drv->hapd; struct ieee80211req_wpaie *ie; int ielen, res; u8 *iebuf = NULL; u8 buf[528]; //sizeof(struct ieee80211req_wpaie) + 4 + extra 6 bytes /* * Fetch negotiated WPA/RSN parameters from the system. */ memset(buf, 0, sizeof(buf)); ((int *)buf)[0] = IEEE80211_IOCTL_GETWPAIE; ie = (struct ieee80211req_wpaie *)&buf[4]; memcpy(ie->wpa_macaddr, addr, IEEE80211_ADDR_LEN); if (set80211priv(drv, AR6000_IOCTL_EXTENDED, buf, sizeof(*ie)+4)) { wpa_printf(MSG_ERROR, "%s: Failed to get WPA/RSN IE", __func__); goto no_ie; } ie = (struct ieee80211req_wpaie *)&buf[4]; wpa_hexdump(MSG_MSGDUMP, "atheros req WPA IE", ie->wpa_ie, IEEE80211_MAX_OPT_IE); wpa_hexdump(MSG_MSGDUMP, "atheros req RSN IE", ie->rsn_ie, IEEE80211_MAX_OPT_IE); #ifdef ATH_WPS_IE wpa_hexdump(MSG_MSGDUMP, "atheros req WPS IE", ie->wps_ie, IEEE80211_MAX_OPT_IE); #endif /* ATH_WPS_IE */ iebuf = ie->wpa_ie; ielen = iebuf[1]; /* atheros seems to return some random data if WPA/RSN IE is not set. * Assume the IE was not included if the IE type is unknown. */ if (iebuf[0] != WLAN_EID_VENDOR_SPECIFIC) iebuf[1] = 0; if (iebuf[1] == 0 && ie->rsn_ie[1] > 0) { /* atheros-ng svn #1453 added rsn_ie. Use it, if wpa_ie was not * set. This is needed for WPA2. */ iebuf = ie->rsn_ie; if (iebuf[0] != WLAN_EID_RSN) iebuf[1] = 0; } ielen = iebuf[1]; #ifdef ATH_WPS_IE /* if WPS IE is present, preference is given to WPS */ if (ie->wps_ie && (ie->wps_ie[1] > 0 && (ie->wps_ie[0] == WLAN_EID_VENDOR_SPECIFIC))) { iebuf = ie->wps_ie; ielen = ie->wps_ie[1]; } #endif /* ATH_WPS_IE */ if (ielen == 0) iebuf = NULL; else ielen += 2; no_ie: drv_event_assoc(hapd, addr, iebuf, 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 0; }
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; }