Changeset 12202


Ignore:
Timestamp:
05/22/09 15:07:05 (4 years ago)
Author:
eko
Message:

some more dual radio stuff

Location:
src/router/httpd
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/router/httpd/modules/broadcom.c

    r12145 r12202  
    651651    fread( webfile, len, 1, web ); 
    652652    webfile[len] = 0; 
    653     sprintf( temp, webfile, ifname, ifname, ifname, ifname ); 
     653    sprintf( temp, webfile, ifname, ifname, ifname, ifname, ifname, ifname ); 
    654654    free( webfile ); 
    655655    fclose( web ); 
     656    do_ej_buffer( temp, stream ); 
     657} 
     658 
     659void do_activetable( struct mime_handler *handler, char *path, webs_t stream, 
     660             char *query ) 
     661{ 
     662    char *temp2 = &path[indexof( path, '-' ) + 1]; 
     663    char ifname[16]; 
     664 
     665    strcpy( ifname, temp2 ); 
     666    ifname[indexof( ifname, '.' )] = 0; 
     667    FILE *web = getWebsFile( "WL_ActiveTable.asp" ); 
     668    unsigned int len = getWebsFileLen( "WL_ActiveTable.asp" ); 
     669    char *webfile = ( char * )malloc( len + 1 ); 
     670 
     671    fread( webfile, len, 1, web ); 
     672    webfile[len] = 0; 
     673    fclose( web ); 
     674 
     675    char temp[32768]; 
     676 
     677    memset( temp, 0, 32768 ); 
     678    int ai = 0; 
     679    int i = 0; 
     680    int weblen = strlen( webfile ); 
     681 
     682    for( i = 0; i < weblen; i++ ) 
     683    { 
     684        if( webfile[i] == '%' ) 
     685        { 
     686            i++; 
     687            switch ( webfile[i] ) 
     688            { 
     689                case '%': 
     690                    temp[ai++] = '%'; 
     691                    break; 
     692                case 's': 
     693                    strcpy( &temp[ai], ifname ); 
     694                    ai += strlen( ifname ); 
     695                    break; 
     696                default: 
     697                    temp[ai++] = webfile[i]; 
     698                    break; 
     699            } 
     700        } 
     701        else 
     702            temp[ai++] = webfile[i]; 
     703    } 
     704    free( webfile ); 
    656705    do_ej_buffer( temp, stream ); 
    657706} 
     
    884933    {"WL_WPATable", "save", "wireless_2", 1, REFRESH, "security_save"}, 
    885934    {"WL_WPATable", "keysize", "wireless_2", 1, REFRESH, "security_save"}, 
    886     {"WL_ActiveTable", "add_mac", "", 1, REFRESH, "add_active_mac"}, 
     935    {"WL_ActiveTable-wl0", "add_mac", "", 1, REFRESH, "add_active_mac"}, 
     936    {"WL_ActiveTable-wl1", "add_mac", "", 1, REFRESH, "add_active_mac"}, 
    887937    /* 
    888938     * Siafu addition  
     
    10881138        do_filtertable( NULL, path, wp, NULL ); // refresh 
    10891139    // #ifdef HAVE_MADWIFI 
     1140    else if( !strncmp( path, "WL_ActiveTable", 14 ) ) 
     1141        do_activetable( NULL, path, wp, NULL ); // refresh 
    10901142    else if( !strncmp( path, "Wireless_WDS", 12 ) ) 
    10911143        do_wds( NULL, path, wp, NULL ); // refresh 
     
    13961448        if( !strncmp( path, "WL_FilterTable", 14 ) ) 
    13971449            do_filtertable( NULL, path, wp, NULL );     // refresh 
     1450        else if( !strncmp( path, "WL_ActiveTable", 14 ) ) 
     1451            do_activetable( NULL, path, wp, NULL );     // refresh       
    13981452        else if( !strncmp( path, "Wireless_WDS", 12 ) ) 
    13991453            do_wds( NULL, path, wp, NULL );     // refresh 
     
    21352189    // #ifdef HAVE_MADWIFI 
    21362190    {"Wireless_WDS*", "text/html", no_cache, NULL, do_wds, do_auth, 1}, 
     2191    {"WL_ActiveTable*", "text/html", no_cache, NULL, do_activetable, do_auth, 1},    
    21372192    {"Wireless_Advanced*", "text/html", no_cache, NULL, do_wireless_adv, do_auth, 1}, 
    21382193    // #endif 
  • src/router/httpd/validate/validators.c

    r12129 r12202  
    14191419        sprintf( mlist, "%s_maclist", ifname ); 
    14201420        nvram_set( mlist, buf ); 
     1421        if( !strcmp( ifname, "wl0" ) ) 
     1422        { 
    14211423        nvram_set( "wl_active_mac", "" ); 
    14221424        nvram_set( "wl0_active_mac", "" ); 
     1425        } 
     1426        else 
     1427        nvram_set( "wl1_active_mac", "" ); 
    14231428    } 
    14241429    free(buf); 
  • src/router/httpd/validate/webs.c

    r12173 r12202  
    914914    char buf[1000] = "", *cur = buf; 
    915915    int i, count = 0; 
     916     
     917    char *iface = websGetVar( wp, "iface", NULL ); 
    916918 
    917919    nvram_set( "wl_active_add_mac", "1" ); 
     
    948950                         wl_client_macs[atoi( index )].hwaddr ); 
    949951    } 
    950     nvram_set( "wl_active_mac", buf ); 
    951     nvram_set( "wl0_active_mac", buf ); 
     952    if( !strcmp( iface "wl0" ) ) 
     953    { 
     954        nvram_set( "wl_active_mac", buf ); 
     955        nvram_set( "wl0_active_mac", buf ); 
     956        } 
     957    else 
     958        nvram_set( "wl1_active_mac", buf ) 
    952959} 
    953960 
  • src/router/httpd/visuals/dd-wrt.c

    r12179 r12202  
    15281528    int i; 
    15291529 
    1530     if( nvram_match( "wl0_mode", "wet" ) )      // dhcpd settings disabled in  
     1530    if( nvram_match( "wl0_mode", "wet" ) || nvram_match( "wl0_mode", "apstawet" ))      // dhcpd settings disabled in  
    15311531        // client bridge mode, so we 
    15321532        // wont display it 
    15331533        return; 
    1534     if( nvram_match( "wl0_mode", "apstawet" ) ) // dhcpd settings disabled in  
     1534    if( nvram_match( "wl1_mode", "wet" ) || nvram_match( "wl1_mode", "apstawet" ) )     // dhcpd settings disabled in  
    15351535        // client bridge mode, so we 
    15361536        // wont display it 
     
    78707870    } 
    78717871 
    7872     websWrite( wp, "<option value=\"%s\" %s >WLAN</option>\n", 
    7873                nvram_safe_get( "wl0_ifname" ), nvram_match( "rflow_if", 
     7872    int cnt = get_wl_instances(  ); 
     7873    int c; 
     7874 
     7875    for( c = 0; c < cnt; c++ ) 
     7876    { 
     7877    sprintf( var, "wl%d_ifname", c ); 
     7878    websWrite( wp, "<option value=\"%s\" %s >WLAN%d</option>\n", 
     7879               nvram_safe_get( var ), nvram_match( "rflow_if", 
    78747880                                                            nvram_safe_get 
    7875                                                             ( "wl0_ifname" ) ) 
    7876                ? "selected=\"selected\"" : "" ); 
     7881                                                            ( var ) ) 
     7882               ? "selected=\"selected\"" : "", c); 
     7883        } 
    78777884 
    78787885    char *wanif = nvram_safe_get( "wan_ifname" ); 
  • src/router/httpd/visuals/ejs.c

    r12199 r12202  
    8585struct onload onloads[] = { 
    8686    // { "Filters", filter_onload }, 
    87     {"WL_ActiveTable", wl_active_onload}, 
     87    {"WL_ActiveTable-wl0", wl_active_onload}, 
     88    {"WL_ActiveTable-wl1", wl_active_onload}, 
    8889    {"MACClone", macclone_onload}, 
    8990    {"FilterSummary", filtersummary_onload}, 
     
    20182019    if( nvram_match( "wl0_mode", "wet" ) 
    20192020        || nvram_match( "wl0_mode", "apstawet" ) 
     2021        || nvram_match( "wl1_mode", "wet" ) 
     2022        || nvram_match( "wl1_mode", "apstawet" ) 
    20202023        || nvram_match( "wan_proto", "disabled" ) ) 
    20212024    { 
  • src/router/httpd/visuals/status.c

    r11810 r12202  
    209209    if( nvram_match( "wl0_mode", "wet" ) 
    210210        || nvram_match( "wl0_mode", "apstawet" ) 
     211        || nvram_match( "wl1_mode", "wet" ) 
     212        || nvram_match( "wl1_mode", "apstawet" ) 
    211213        || !strcmp( wan_proto, "disabled" ) ) 
    212214    { 
  • src/router/httpd/visuals/wireless.c

    r12129 r12202  
    4242 
    4343#define ASSOCLIST_TMP   "/tmp/.wl_assoclist" 
    44 #define ASSOCLIST_CMD   "wl assoclist" 
     44#define ASSOCLIST_CMD   "assoclist" 
    4545 
    4646#define LEASES_NAME_IP  "/tmp/.leases_name_ip" 
     
    398398    char line[80]; 
    399399    int dhcp_table_count; 
    400  
    401     if( !strcmp( argv[0], "online" ) ) 
     400    char *type, *ifname; 
     401     
     402    ejArgs( argc, argv, "%s %s", &type, &ifname ); 
     403 
     404    if( !strcmp( type, "online" ) ) 
    402405    { 
    403406        for( i = 0; i < MAX_LEASES; i++ ) 
     
    411414 
    412415        nv_count = 0;           // init mac list 
     416         
     417        char *iface; 
     418        if( !strcmp( ifname, "wl0" ) ) 
     419                iface = get_wl_instance_name( 0 ); 
     420        else if ( !strcmp( ifname, "wl1" ) ) 
     421                iface = get_wl_instance_name( 1 ); 
     422        else 
     423                iface = nvram_safe_get( "wl0_ifname" ); 
     424                         
    413425#ifdef HAVE_MADWIFI 
    414426        char *maclist = nvram_safe_get( "ath0_maclist" ); 
    415427#else 
    416         char *maclist = nvram_safe_get( "wl0_maclist" ); 
     428        char var[32]; 
     429        sprintf( var, "%s_maclist", ifname ); 
     430        char *maclist = nvram_safe_get( var ); 
    417431#endif 
    418432        foreach( word, maclist, next ) 
     
    424438            nv_count++; 
    425439        } 
    426         sysprintf( "%s > %s", ASSOCLIST_CMD, ASSOCLIST_TMP ); 
     440        sysprintf( "wl -i %s %s > %s", iface, ASSOCLIST_CMD, ASSOCLIST_TMP ); 
    427441 
    428442        if( ( fp = fopen( ASSOCLIST_TMP, "r" ) ) ) 
     
    462476            fclose( fp ); 
    463477        } 
    464         if( !strcmp( argv[0], "online" ) ) 
     478        if( !strcmp( type, "online" ) ) 
    465479        { 
    466480            dhcp_table_count = dhcp_lease_table_init(  );       // init dhcp 
     
    473487    } 
    474488 
    475     if( !strcmp( argv[0], "offline" ) ) 
     489    if( !strcmp( type, "offline" ) ) 
    476490    { 
    477491        get_hostname_ip( "offline", OLD_NAME_IP ); 
    478492    } 
    479493 
    480     if( !strcmp( argv[0], "online" ) ) 
     494    if( !strcmp( type, "online" ) ) 
    481495    { 
    482496        for( i = 0; i < nv_count; i++ ) 
     
    493507        } 
    494508    } 
    495     else if( !strcmp( argv[0], "offline" ) ) 
     509    else if( !strcmp( type, "offline" ) ) 
    496510    { 
    497511        for( i = 0; i < nv_count; i++ ) 
     
    721735    int count = 0; 
    722736 
    723     sysprintf( "%s > %s", ASSOCLIST_CMD, ASSOCLIST_TMP ); 
     737    sysprintf( "wl %s > %s", ASSOCLIST_CMD, ASSOCLIST_TMP ); 
    724738 
    725739    if( ( fp = fopen( ASSOCLIST_TMP, "r" ) ) ) 
Note: See TracChangeset for help on using the changeset viewer.