Esempio n. 1
0
/*******************************************************************************
 *	wl_process_security_status()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Process the security status message signaled by the device.
 *
 *  PARAMETERS:
 *
 *      lp - a pointer to the device's private structure
 *
 *  RETURNS:
 *
 *      N/A
 *
 ******************************************************************************/
void wl_process_security_status( struct wl_private *lp )
{
    SECURITY_STATUS_STRCT *sec_stat;
    /*------------------------------------------------------------------------*/


    DBG_FUNC( "wl_process_security_status" );
    DBG_ENTER( DbgInfo );


    if( lp != NULL ) {
        sec_stat = (SECURITY_STATUS_STRCT *)&lp->sec_stat;

        wl_endian_translate_event( (ltv_t *)sec_stat );

        switch( sec_stat->securityStatus ) {
        case 1:
            DBG_TRACE( DbgInfo, "Security Status : Dissassociate [AP]\n" );
            break;

        case 2:
            DBG_TRACE( DbgInfo, "Security Status : Deauthenticate [AP]\n" );
            break;

        case 3:
            DBG_TRACE( DbgInfo, "Security Status : Authenticate Fail [STA] or [AP]\n" );
            break;

        case 4:
            DBG_TRACE( DbgInfo, "Security Status : MIC Fail\n" );
            break;

        case 5:
            DBG_TRACE( DbgInfo, "Security Status : Associate Fail\n" );
            break;

        default:
            DBG_TRACE( DbgInfo, "Security Status : UNKNOWN (0x%04x)\n",
                       sec_stat->securityStatus );
            break;
        }

        DBG_TRACE( DbgInfo, "STA Address     : %s\n",
                   DbgHwAddr( sec_stat->staAddr ));
        DBG_TRACE( DbgInfo, "Reason          : 0x%04x \n", sec_stat->reason );

    }

    DBG_LEAVE( DbgInfo );
    return;
} // wl_process_security_status
Esempio n. 2
0
/*******************************************************************************
 *	wl_process_assoc_status()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Process the association status event signaled by the device.
 *
 *  PARAMETERS:
 *
 *      lp - a pointer to the device's private structure
 *
 *  RETURNS:
 *
 *      N/A
 *
 ******************************************************************************/
void wl_process_assoc_status( struct wl_private *lp )
{
    ASSOC_STATUS_STRCT *assoc_stat;
    /*------------------------------------------------------------------------*/


    DBG_FUNC( "wl_process_assoc_status" );
    DBG_ENTER( DbgInfo );


    if( lp != NULL ) {
        assoc_stat = (ASSOC_STATUS_STRCT *)&lp->assoc_stat;

        wl_endian_translate_event( (ltv_t *)assoc_stat );

        switch( assoc_stat->assocStatus ) {
        case 1:
            DBG_TRACE( DbgInfo, "Association Status : STA Associated\n" );
            break;

        case 2:
            DBG_TRACE( DbgInfo, "Association Status : STA Reassociated\n" );
            break;

        case 3:
            DBG_TRACE( DbgInfo, "Association Status : STA Disassociated\n" );
            break;

        default:
            DBG_TRACE( DbgInfo, "Association Status : UNKNOWN (0x%04x)\n",
                       assoc_stat->assocStatus );
            break;
        }

        DBG_TRACE( DbgInfo, "STA Address        : %s\n",
                   DbgHwAddr( assoc_stat->staAddr ));

        if(( assoc_stat->assocStatus == 2 )  && ( assoc_stat->len == 8 )) {
            DBG_TRACE( DbgInfo, "Old AP Address     : %s\n",
                       DbgHwAddr( assoc_stat->oldApAddr ));
        }
    }

    DBG_LEAVE( DbgInfo );
    return;
} // wl_process_assoc_status
/*******************************************************************************
 *	wl_process_probe_response()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Process the probe responses retunred by the device as a result of an
 *      active scan.
 *
 *  PARAMETERS:
 *
 *      lp - a pointer to the device's private structure
 *
 *  RETURNS:
 *
 *      N/A
 *
 ******************************************************************************/
void wl_process_probe_response( struct wl_private *lp )
{
    PROBE_RESP  *probe_rsp;
    hcf_8       *wpa_ie = NULL;
    hcf_16      wpa_ie_len = 0;
    /*------------------------------------------------------------------------*/


    DBG_FUNC( "wl_process_probe_response" );
    DBG_ENTER( DbgInfo );


    if( lp != NULL ) {
        probe_rsp = (PROBE_RESP *)&lp->ProbeResp;

        wl_endian_translate_event( (ltv_t *)probe_rsp );

        DBG_TRACE( DbgInfo, "(%s) =========================\n", lp->dev->name );
        DBG_TRACE( DbgInfo, "(%s) length      : 0x%04x.\n",  lp->dev->name,
                probe_rsp->length );

        if( probe_rsp->length > 1 ) {
            DBG_TRACE( DbgInfo, "(%s) infoType    : 0x%04x.\n", lp->dev->name,
                    probe_rsp->infoType );

            DBG_TRACE( DbgInfo, "(%s) signal      : 0x%02x.\n", lp->dev->name,
                    probe_rsp->signal );

            DBG_TRACE( DbgInfo, "(%s) silence     : 0x%02x.\n", lp->dev->name,
                    probe_rsp->silence );

            DBG_TRACE( DbgInfo, "(%s) rxFlow      : 0x%02x.\n", lp->dev->name,
                    probe_rsp->rxFlow );

            DBG_TRACE( DbgInfo, "(%s) rate        : 0x%02x.\n", lp->dev->name,
                    probe_rsp->rate );

            DBG_TRACE( DbgInfo, "(%s) frame cntl  : 0x%04x.\n", lp->dev->name,
                    probe_rsp->frameControl );

            DBG_TRACE( DbgInfo, "(%s) durID       : 0x%04x.\n", lp->dev->name,
                    probe_rsp->durID );

		DBG_TRACE(DbgInfo, "(%s) address1    : %pM\n", lp->dev->name,
			probe_rsp->address1);

		DBG_TRACE(DbgInfo, "(%s) address2    : %pM\n", lp->dev->name,
			probe_rsp->address2);

		DBG_TRACE(DbgInfo, "(%s) BSSID       : %pM\n", lp->dev->name,
			probe_rsp->BSSID);

            DBG_TRACE( DbgInfo, "(%s) sequence    : 0x%04x.\n", lp->dev->name,
                    probe_rsp->sequence );

		DBG_TRACE(DbgInfo, "(%s) address4    : %pM\n", lp->dev->name,
			probe_rsp->address4);

            DBG_TRACE( DbgInfo, "(%s) datalength  : 0x%04x.\n", lp->dev->name,
                    probe_rsp->dataLength );

		DBG_TRACE(DbgInfo, "(%s) DA          : %pM\n", lp->dev->name,
			probe_rsp->DA);

		DBG_TRACE(DbgInfo, "(%s) SA          : %pM\n", lp->dev->name,
			probe_rsp->SA);

#ifdef WARP

            DBG_TRACE( DbgInfo, "(%s) channel     : %d\n", lp->dev->name,
                    probe_rsp->channel );

            DBG_TRACE( DbgInfo, "(%s) band        : %d\n", lp->dev->name,
                    probe_rsp->band );
#else
            DBG_TRACE( DbgInfo, "(%s) lenType     : 0x%04x.\n", lp->dev->name,
                    probe_rsp->lenType );
#endif  // WARP

            DBG_TRACE( DbgInfo, "(%s) timeStamp   : %d.%d.%d.%d.%d.%d.%d.%d\n",
                    lp->dev->name,
                    probe_rsp->timeStamp[0],
                    probe_rsp->timeStamp[1],
                    probe_rsp->timeStamp[2],
                    probe_rsp->timeStamp[3],
                    probe_rsp->timeStamp[4],
                    probe_rsp->timeStamp[5],
                    probe_rsp->timeStamp[6],
                    probe_rsp->timeStamp[7]);

            DBG_TRACE( DbgInfo, "(%s) beaconInt   : 0x%04x.\n", lp->dev->name,
                    probe_rsp->beaconInterval );

            DBG_TRACE( DbgInfo, "(%s) capability  : 0x%04x.\n", lp->dev->name,
                    probe_rsp->capability );

            DBG_TRACE( DbgInfo, "(%s) SSID len    : 0x%04x.\n", lp->dev->name,
                    probe_rsp->rawData[1] );


            if( probe_rsp->rawData[1] > 0 ) {
                char ssid[HCF_MAX_NAME_LEN];

                memset( ssid, 0, sizeof( ssid ));
                strncpy( ssid, &probe_rsp->rawData[2],
                            probe_rsp->rawData[1] );

                DBG_TRACE( DbgInfo, "(%s) SSID        : %s\n",
                            lp->dev->name, ssid );
            }


            /* Parse out the WPA-IE, if one exists */
            wpa_ie = wl_parse_wpa_ie( probe_rsp, &wpa_ie_len );
            if( wpa_ie != NULL ) {
                DBG_TRACE( DbgInfo, "(%s) WPA-IE      : %s\n",
                lp->dev->name, wl_print_wpa_ie( wpa_ie, wpa_ie_len ));
            }

            DBG_TRACE( DbgInfo, "(%s) flags       : 0x%04x.\n",
                        lp->dev->name, probe_rsp->flags );
        }

        DBG_TRACE( DbgInfo, "\n" );


        /* If probe response length is 1, then the scan is complete */
        if( probe_rsp->length == 1 ) {
            DBG_TRACE( DbgInfo, "SCAN COMPLETE\n" );
            lp->probe_results.num_aps = lp->probe_num_aps;
            lp->probe_results.scan_complete = TRUE;

            /* Reset the counter for the next scan request */
            lp->probe_num_aps = 0;

            /* Send a wireless extensions event that the scan completed */
            wl_wext_event_scan_complete( lp->dev );
        } else {
            /* Only copy to the table if the entry is unique; APs sometimes
                respond more than once to a probe */
            if( lp->probe_num_aps == 0 ) {
                /* Copy the info to the ScanResult structure in the private
                adapter struct */
                memcpy( &( lp->probe_results.ProbeTable[lp->probe_num_aps] ),
                        probe_rsp, sizeof( PROBE_RESP ));

                /* Increment the number of APs detected */
                lp->probe_num_aps++;
            } else {
                int count;
                int unique = 1;

                for( count = 0; count < lp->probe_num_aps; count++ ) {
                    if( memcmp( &( probe_rsp->BSSID ),
                        lp->probe_results.ProbeTable[count].BSSID,
                        ETH_ALEN ) == 0 ) {
                        unique = 0;
                    }
                }

                if( unique ) {
                    /* Copy the info to the ScanResult structure in the
                    private adapter struct. Only copy if there's room in the
                    table */
                    if( lp->probe_num_aps < MAX_NAPS )
                    {
                        memcpy( &( lp->probe_results.ProbeTable[lp->probe_num_aps] ),
                                probe_rsp, sizeof( PROBE_RESP ));
                    }
                    else
                    {
                        DBG_WARNING( DbgInfo, "Num of scan results exceeds storage, truncating\n" );
                    }

                    /* Increment the number of APs detected. Note I do this
                        here even when I don't copy the probe response to the
                        buffer in order to detect the overflow condition */
                    lp->probe_num_aps++;
                }
            }
        }
    }

    DBG_LEAVE( DbgInfo );
    return;
} // wl_process_probe_response