Changeset 11986


Ignore:
Timestamp:
04/22/09 17:24:33 (4 years ago)
Author:
BrainSlayer
Message:

some code reduction, fix array out of bound problem and take care about changed lan mac addr for custom bridge configs

Location:
src/router
Files:
2 edited

Legend:

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

    r11955 r11986  
    278278 
    279279} 
    280  
     280static void applytake(char *value) 
     281{ 
     282    if(value && !strcmp( value, "ApplyTake" ) ) 
     283    { 
     284        nvram_commit(  ); 
     285        service_restart(  ); 
     286    } 
     287} 
    281288void save_policy( webs_t wp ) 
    282289{ 
     
    332339 
    333340    nvram_set( filter_buf, buf ); 
    334  
    335     if( !strcmp( value, "ApplyTake" ) ) 
    336     { 
    337         nvram_commit(  ); 
    338         service_restart(  ); 
    339     } 
     341    applytake(value); 
    340342 
    341343    D( "okay" ); 
     
    390392 
    391393    // char *services_length = websGetVar (wp, "services_length0", NULL); 
    392     char word[1025], *next; 
     394    char word[1026], *next; 
    393395    char delim[] = "( )"; 
    394396    char var[32] = ""; 
     
    448450    validate_services_port( wp ); 
    449451    char *value = websGetVar( wp, "action", "" ); 
    450  
    451     if( !strcmp( value, "ApplyTake" ) ) 
    452     { 
    453         nvram_commit(  ); 
    454         service_restart(  ); 
    455     } 
     452    applytake(value); 
    456453} 
    457454 
     
    594591    free( buf_name ); 
    595592    free( buf ); 
    596     if( !strcmp( value, "ApplyTake" ) ) 
    597     { 
    598         nvram_commit(  ); 
    599         service_restart(  ); 
    600     } 
     593    applytake(value); 
    601594    return; 
    602595} 
     
    906899    } 
    907900#endif 
    908     if( !strcmp( value, "ApplyTake" ) ) 
    909     { 
    910         nvram_commit(  ); 
    911         service_restart(  ); 
    912     } 
     901    applytake(value); 
    913902} 
    914903 
     
    13471336    { 
    13481337        addAction( "qos" ); 
    1349         if( !strcmp( value, "ApplyTake" ) ) 
    1350         { 
    1351             nvram_commit(  ); 
    1352             service_restart(  ); 
    1353         } 
     1338        applytake(value); 
    13541339        return; 
    13551340    } 
     
    15311516 
    15321517    addAction( "qos" ); 
    1533     if( !strcmp( value, "ApplyTake" ) ) 
    1534     { 
    1535         nvram_commit(  ); 
    1536         service_restart(  ); 
    1537     } 
     1518    applytake(value); 
    15381519 
    15391520} 
     
    22032184#endif 
    22042185 
    2205     if( !strcmp( value, "ApplyTake" ) ) 
    2206     { 
    2207         nvram_commit(  ); 
    2208         service_restart(  ); 
    2209     } 
     2186    applytake(value); 
    22102187} 
    22112188 
     
    28162793    // nvram_commit (); 
    28172794#endif 
    2818     if( !strcmp( value, "ApplyTake" ) ) 
    2819     { 
    2820         nvram_commit(  ); 
    2821         service_restart(  ); 
    2822     } 
     2795    applytake(value); 
    28232796} 
    28242797 
  • src/router/services/services/vlantagging.c

    r11721 r11986  
    169169        } 
    170170    } 
    171  
     171    struct ifreq ifr; 
     172    char eabuf[32]; 
     173    strncpy( ifr.ifr_name, nvram_safe_get("lan_ifname"), IFNAMSIZ ); 
     174    if( ioctl( s, SIOCGIFHWADDR, &ifr ) == 0 ) 
     175    { 
     176        nvram_set( "lan_hwaddr",ether_etoa( ifr.ifr_hwaddr.sa_data, eabuf ) ); 
     177    } 
    172178} 
    173179 
Note: See TracChangeset for help on using the changeset viewer.