Changeset 11641


Ignore:
Timestamp:
02/18/09 11:07:31 (4 years ago)
Author:
BrainSlayer
Message:

fix single delete

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/httpd/validate/webs.c

    r11640 r11641  
    4444{ 
    4545    char *enable; 
     46 
    4647    enable = websGetVar( wp, "wan_proto", NULL ); 
    4748    nvram_set( "wan_proto", enable ); 
     
    296297    f_name = websGetVar( wp, "f_name", NULL ); 
    297298    f_status = websGetVar( wp, "f_status", NULL );      // 0=>Disable / 
    298                                                         // 1,2=>Enable 
     299    // 1,2=>Enable 
    299300    f_status2 = websGetVar( wp, "f_status2", NULL );    // deny=>Deny / 
    300                                                         // allow=>Allow 
     301    // allow=>Allow 
    301302    if( !f_id || !f_name || !f_status || !f_status2 ) 
    302303    { 
     
    537538void delete_static_route( webs_t wp ) 
    538539{ 
    539     addAction("routing"); 
     540    addAction( "routing" ); 
    540541    char *buf = malloc( 1000 ); 
    541542    char *buf_name = malloc( 1000 ); 
     543 
    542544    memset( buf, 0, 1000 ); 
    543545    memset( buf_name, 0, 1000 ); 
     
    10681070    // use Wol.asp as a debugging console 
    10691071#ifdef HAVE_REGISTER 
    1070 if (!isregistered_real()) 
    1071     return; 
     1072    if( !isregistered_real(  ) ) 
     1073        return; 
    10721074#endif 
    10731075    sysprintf( "%s > %s 2>&1 &", wol_cmd, PING_TMP ); 
     
    10871089    setenv( "PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1 ); 
    10881090#ifdef HAVE_REGISTER 
    1089 if (!isregistered_real()) 
    1090     return; 
     1091    if( !isregistered_real(  ) ) 
     1092        return; 
    10911093#endif 
    10921094    sysprintf( "alias ping=\'ping -c 3\'; eval \"%s\" > %s 2>&1 &", ip, 
     
    20582060    for( i = 0; i < bridgescount; i++ ) 
    20592061    { 
    2060         char *ifname, *tag, *prio,*mtu; 
     2062        char *ifname, *tag, *prio, *mtu; 
    20612063        char var[32]; 
    20622064        char ipaddr[32]; 
     
    20872089        if( strlen( prio ) == 0 ) 
    20882090            mtu = "1500"; 
    2089  
    20902091 
    20912092        sprintf( n, "%s_ipaddr", ifname ); 
     
    24832484{ 
    24842485    char n[80]; 
     2486 
    24852487#ifdef HAVE_MADWIFI 
    24862488    char sifs[80]; 
     
    24972499 
    24982500        cprintf( "copy value %s which is [%s] to nvram\n", n, wl ); 
    2499         if ( wl ) 
    2500         { 
    2501         if( !strcmp( prefix, "wl0" ) ) 
    2502             nvram_set( "wl_ssid", wl ); 
    2503         else 
    2504             nvram_set( "wl1_ssid", wl ); 
    2505     } 
     2501        if( wl ) 
     2502        { 
     2503            if( !strcmp( prefix, "wl0" ) ) 
     2504                nvram_set( "wl_ssid", wl ); 
     2505            else 
     2506                nvram_set( "wl1_ssid", wl ); 
     2507        } 
    25062508    } 
    25072509    copytonv( wp, "%s_distance", prefix ); 
     
    25542556        sprintf( turbo, "%s_rtsvalue", prefix ); 
    25552557        char *tw = websGetVar( wp, turbo, NULL ); 
     2558 
    25562559        if( tw ) 
    25572560        { 
     
    25682571    copytonv( wp, "%s_xr", prefix ); 
    25692572    copytonv( wp, "%s_outdoor", prefix ); 
    2570 //    copytonv( wp, "%s_compression", prefix ); // Atheros SuperG header 
    2571                                                 // compression 
     2573//    copytonv( wp, "%s_compression", prefix ); // Atheros SuperG header 
     2574    // compression 
    25722575    copytonv( wp, "%s_ff", prefix );    // ff = 0, Atheros SuperG fast 
    2573                                         // framing disabled, 1 fast framing 
    2574                                         // enabled 
     2576    // framing disabled, 1 fast framing 
     2577    // enabled 
    25752578    copytonv( wp, "%s_diversity", prefix ); 
    25762579    copytonv( wp, "%s_preamble", prefix ); 
     
    25852588    copytonv( wp, "%s_chanshift", prefix ); 
    25862589    copytonv( wp, "%s_doth", prefix ); 
    2587     copytonv( wp, "%s_maxassoc", prefix); 
     2590    copytonv( wp, "%s_maxassoc", prefix ); 
    25882591 
    25892592    sprintf( chanbw, "%s_channelbw", prefix ); 
     
    26172620        ifname = prefix; 
    26182621#else 
    2619     ifname = getRADev(prefix); 
     2622    ifname = getRADev( prefix ); 
    26202623#endif 
    26212624    copytonv( wp, "%s_multicast", ifname ); 
     
    26542657    copytonv( wp, "%s_ap_isolate", prefix ); 
    26552658    sprintf( n, "%s_mode", prefix ); 
    2656     if (nvram_match(n,"sta")) 
    2657         { 
     2659    if( nvram_match( n, "sta" ) ) 
     2660    { 
    26582661        char *wl = websGetVar( wp, n, NULL ); 
    2659         if (wl) 
    2660         if (!strcmp(wl,"ap") || !strcmp(wl,"wdsap") || !strcmp(wl,"infra") || !strcmp(wl,"wdssta")) 
     2662 
     2663        if( wl ) 
     2664            if( !strcmp( wl, "ap" ) || !strcmp( wl, "wdsap" ) 
     2665                || !strcmp( wl, "infra" ) || !strcmp( wl, "wdssta" ) ) 
    26612666            { 
    2662             nvram_set("wan_proto","disabled"); 
     2667                nvram_set( "wan_proto", "disabled" ); 
    26632668            } 
    2664         } 
     2669    } 
    26652670    copytonv( wp, n ); 
    26662671    if( !strcmp( prefix, "wl0" ) || !strcmp( prefix, "wl1" ) ) 
     
    26802685    } 
    26812686    int chanchanged = 0; 
     2687 
    26822688#ifdef HAVE_RT2880 
    26832689    copytonv( wp, "%s_greenfield", prefix ); 
     
    27012707    } 
    27022708#ifdef HAVE_MADWIFI 
    2703     if( cbwchanged || chanchanged) 
     2709    if( cbwchanged || chanchanged ) 
    27042710    { 
    27052711        if( nvram_match( chanbw, "40" ) ) 
     
    27372743        if( wl && !strcmp( prefix, "wl0" ) ) 
    27382744            nvram_set( "wl_channel", wl ); 
    2739         else if (wl) 
     2745        else if( wl ) 
    27402746            nvram_set( "wl1_channel", wl ); 
    27412747    } 
     
    27502756        if( wl && !strcmp( prefix, "wl0" ) ) 
    27512757            nvram_set( "wl_wchannel", wl ); 
    2752         else if (wl) 
     2758        else if( wl ) 
    27532759            nvram_set( "wl1_wchannel", wl ); 
    27542760 
     
    28332839void ttraff_erase( webs_t wp ) 
    28342840{ 
    2835         char line[2048]; 
    2836         char *name = NULL; 
    2837         system2( "nvram show | grep traff- > /tmp/.ttraff" );    
    2838         FILE *fp = fopen( "/tmp/.ttraff", "r" ); 
    2839         if( fp == NULL ) 
    2840         { 
    2841           return; 
    2842         } 
    2843         while( fgets( line, sizeof( line ), fp ) != NULL ) 
    2844         { 
    2845                 if (startswith (line, "traff-")) 
     2841    char line[2048]; 
     2842    char *name = NULL; 
     2843 
     2844    system2( "nvram show | grep traff- > /tmp/.ttraff" ); 
     2845    FILE *fp = fopen( "/tmp/.ttraff", "r" ); 
     2846 
     2847    if( fp == NULL ) 
     2848    { 
     2849        return; 
     2850    } 
     2851    while( fgets( line, sizeof( line ), fp ) != NULL ) 
     2852    { 
     2853        if( startswith( line, "traff-" ) ) 
     2854        { 
     2855            name = strtok( line, "=" ); 
     2856            if( strlen( name ) == 13 )  //only unset ttraf-XX-XXXX 
    28462857            { 
    2847                  name = strtok (line, "="); 
    2848                  if (strlen (name) == 13)  //only unset ttraf-XX-XXXX 
    2849                  { 
    2850                    nvram_unset (name); 
    2851              }  
     2858                nvram_unset( name ); 
    28522859            } 
    28532860        } 
    2854         nvram_commit ( ); 
    2855         unlink( "/tmp/.ttraff" ); 
     2861    } 
     2862    nvram_commit(  ); 
     2863    unlink( "/tmp/.ttraff" ); 
    28562864} 
    28572865 
     
    36683676        else 
    36693677        { 
     3678            int which = atoi( nvram_default_get( "forward_cur", "0" ) ); 
     3679            int i = atoi( v ); 
     3680            char val[32]; 
     3681 
     3682            sprintf( val, "forward_port%d", i ); 
     3683            int a; 
     3684 
     3685            nvram_unset( val ); 
     3686            for( a = i + 1; a < which; a++ ) 
     3687            { 
     3688                nvram_nset( nvram_nget( "forward_port%d", a ), 
     3689                            "forward_port%d", a - 1 ); 
     3690            } 
     3691            which--; 
     3692            sprintf( val, "forward_port%d", which ); 
     3693            nvram_unset( val ); 
     3694            if( which < 0 ) 
     3695                which = 0; 
     3696            sprintf( val, "%d", which ); 
     3697            nvram_set( "forward_cur", val ); 
     3698 
    36703699            sprintf( s, "forward_port%s", v ); 
    36713700            nvram_unset( s ); 
Note: See TracChangeset for help on using the changeset viewer.