Changeset 10805


Ignore:
Timestamp:
11/07/08 10:16:21 (5 years ago)
Author:
BrainSlayer
Message:

some scan fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/services/tools/site_survey_ralink.c

    r10803 r10805  
    112112#define DOT11_CAP_ESS                           0x0001 
    113113#define DOT11_CAP_IBSS                          0x0002 
    114  
    115     unsigned char b1[32],b2[32],b3[32],b4[32],b5[32],b6[32],b7[32],b8[32]; 
     114#define DOT11_CAP_PRIVACY                       0x0010  /* d11 cap. privacy */ 
     115 
     116    unsigned char b1[32],b2[64],b3[32],b4[32],b5[32],b6[32],b7[32],b8[32]; 
    116117    int i = 0; 
    117118 
     
    121122     
    122123    memset( site_survey_lists, sizeof( site_survey_lists ), 0 ); 
    123      
     124    if (nvram_match("wl0_mode","ap") || nvram_match("wl0_mode","apsta")) 
     125    { 
    124126    eval( "iwpriv", "ra0","set","SiteSurvey=1" ); // only in ap mode 
    125127    sleep(4); //wait 4 seconds per spec 
     128    } 
    126129     
    127130    FILE *scan = popen("iwpriv ra0 get_site_survey","rb"); 
     
    133136        if (feof(scan)) 
    134137            break; 
    135         int ret = fscanf(scan,"%s %s %s %s %s %s %s %s",b1,b2,b3,b4,b5,b6,b7,b8); //skip second line 
    136         if (ret<8) 
     138        fread(b1,4,1,scan); 
     139        b1[4]=0; 
     140        b1[strlen(b1)]=0; 
     141        fread(b2,33,1,scan); 
     142        b2[32]=0; 
     143        b2[strlen(b2)]=0; 
     144        int ret = fscanf(scan,"%s %s %s %s %s %s",b3,b4,b5,b6,b7,b8); //skip second line 
     145        if (ret<6) 
    137146            break; 
    138147        site_survey_lists[i].channel = atoi(b1); // channel 
     
    157166        if (!strcmp(b8,"Ad")) 
    158167            site_survey_lists[i].capability=DOT11_CAP_IBSS;      
     168 
     169        if (strcmp(b5,"OPEN")) 
     170            site_survey_lists[i].capability|=DOT11_CAP_PRIVACY;  
     171             
    159172        i++; 
    160173    } 
Note: See TracChangeset for help on using the changeset viewer.