contrib/hostapd/hostapd/driver_prism54.c
static void prism54_handle_auth(struct prism54_driver_data *drv,
				void *buf, size_t len)
{
	struct obj_mlmeex *mlme;
	pimdev_hdr *hdr;
	struct sta_info *sta;
	int resp;

	hdr = (pimdev_hdr *) buf;
	mlme = (struct obj_mlmeex *) &hdr[1];
	if (len < sizeof(*mlme)) {
		printf("bad auth packet\n");
		return;
	}

	if (mlme->state == htons(DOT11_STATE_AUTHING)) {
		sta = ap_sta_add(drv->hapd, (u8 *) &mlme->address[0]);
		if (drv->hapd->tkip_countermeasures) {
			resp = WLAN_REASON_MICHAEL_MIC_FAILURE;
			goto fail;
		}
		mac_id_refresh(drv, mlme->id, &mlme->address[0]);
		if (!sta) {
			resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
			goto fail;
		}
		sta->flags &= ~WLAN_STA_PREAUTH;
		
		ieee802_1x_notify_pre_auth(sta->eapol_sm, 0);
		sta->flags |= WLAN_STA_AUTH;
		wpa_auth_sm_event(sta->wpa_sm, WPA_AUTH);
		mlme->code = 0;
		mlme->state=htons(DOT11_STATE_AUTH);
		hdr->op = htonl(PIMOP_SET);
		hdr->oid = htonl(DOT11_OID_AUTHENTICATEEX);
		mlme->size = 0;
		sta->timeout_next = STA_NULLFUNC;
		send(drv->pim_sock, hdr, sizeof(*hdr) + sizeof(*mlme), 0);
	}
	return;

fail:
	printf("auth fail: %x\n", resp);
	mlme->code = host_to_le16(resp);
	mlme->size = 0;
	if (sta)
		sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
	hdr->oid = htonl(DOT11_OID_DEAUTHENTICATEEX);
	hdr->op = htonl(PIMOP_SET);
	send(drv->pim_sock, hdr, sizeof(*hdr)+sizeof(*mlme), 0);
}
/* to auth it, just allow it now, later for os/sk */
to auth it, just allow it now, later for os/sk
to auth it just allow it now later for os / sk
static void prism54_handle_auth(struct prism54_driver_data *drv,
				void *buf, size_t len)
{
	struct obj_mlmeex *mlme;
	pimdev_hdr *hdr;
	struct sta_info *sta;
	int resp;
	hdr = (pimdev_hdr *) buf;
	mlme = (struct obj_mlmeex *) &hdr[1];
	if (len < sizeof(*mlme)) {
		printf("bad auth packet\n");
		return;
	}
	if (mlme->state == htons(DOT11_STATE_AUTHING)) {
		sta = ap_sta_add(drv->hapd, (u8 *) &mlme->address[0]);
		if (drv->hapd->tkip_countermeasures) {
			resp = WLAN_REASON_MICHAEL_MIC_FAILURE;
			goto fail;
		}
		mac_id_refresh(drv, mlme->id, &mlme->address[0]);
		if (!sta) {
			resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
			goto fail;
		}
		sta->flags &= ~WLAN_STA_PREAUTH;
		ieee802_1x_notify_pre_auth(sta->eapol_sm, 0);
		sta->flags |= WLAN_STA_AUTH;
		wpa_auth_sm_event(sta->wpa_sm, WPA_AUTH);
		mlme->code = 0;
		mlme->state=htons(DOT11_STATE_AUTH);
		hdr->op = htonl(PIMOP_SET);
		hdr->oid = htonl(DOT11_OID_AUTHENTICATEEX);
		mlme->size = 0;
		sta->timeout_next = STA_NULLFUNC;
		send(drv->pim_sock, hdr, sizeof(*hdr) + sizeof(*mlme), 0);
	}
	return;
fail:
	printf("auth fail: %x\n", resp);
	mlme->code = host_to_le16(resp);
	mlme->size = 0;
	if (sta)
		sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
	hdr->oid = htonl(DOT11_OID_DEAUTHENTICATEEX);
	hdr->op = htonl(PIMOP_SET);
	send(drv->pim_sock, hdr, sizeof(*hdr)+sizeof(*mlme), 0);
}
static void prism54_handle_auth ( struct prism54_driver_data * drv , void * buf , size_t len ) { struct obj_mlmeex * mlme ; pimdev_hdr * hdr ; struct sta_info * sta ; int resp ; hdr = ( pimdev_hdr * ) buf ; mlme = ( struct obj_mlmeex * ) & hdr [ 1 ] ; if ( len < sizeof ( * mlme ) ) { printf ( " \n " ) ; return ; } if ( mlme -> state == htons ( DOT11_STATE_AUTHING ) ) { sta = ap_sta_add ( drv -> hapd , ( u8 * ) & mlme -> address [ 0 ] ) ; if ( drv -> hapd -> tkip_countermeasures ) { resp = WLAN_REASON_MICHAEL_MIC_FAILURE ; goto fail ; } mac_id_refresh ( drv , mlme -> id , & mlme -> address [ 0 ] ) ; if ( ! sta ) { resp = WLAN_STATUS_UNSPECIFIED_FAILURE ; goto fail ; } sta -> flags &= ~ WLAN_STA_PREAUTH ; ieee802_1x_notify_pre_auth ( sta -> eapol_sm , 0 ) ; sta -> flags |= WLAN_STA_AUTH ; wpa_auth_sm_event ( sta -> wpa_sm , WPA_AUTH ) ; mlme -> code = 0 ; mlme -> state = htons ( DOT11_STATE_AUTH ) ; hdr -> op = htonl ( PIMOP_SET ) ; hdr -> oid = htonl ( DOT11_OID_AUTHENTICATEEX ) ; mlme -> size = 0 ; sta -> timeout_next = STA_NULLFUNC ; send ( drv -> pim_sock , hdr , sizeof ( * hdr ) + sizeof ( * mlme ) , 0 ) ; } return ; fail : printf ( " \n " , resp ) ; mlme -> code = host_to_le16 ( resp ) ; mlme -> size = 0 ; if ( sta ) sta -> flags &= ~ ( WLAN_STA_AUTH | WLAN_STA_ASSOC ) ; hdr -> oid = htonl ( DOT11_OID_DEAUTHENTICATEEX ) ; hdr -> op = htonl ( PIMOP_SET ) ; send ( drv -> pim_sock , hdr , sizeof ( * hdr ) + sizeof ( * mlme ) , 0 ) ; }
to auth it, just allow it now, later for os/sk
to auth it just allow it now later for os / sk