Changeset 9126


Ignore:
Timestamp:
02/27/08 02:37:19 (5 years ago)
Author:
BrainSlayer
Message:

prevent hammering

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/services/sysinit/sysinit-broadcom.c

    r9124 r9126  
    11591159enable_dtag_vlan (int enable) 
    11601160{ 
     1161  int donothing = 0; 
     1162  if (nvram_match ("vdsl_state", "1") && enable) 
     1163    donothing = 1; 
     1164  if (nvram_match ("vdsl_state", "0") && !enable) 
     1165    donothing = 1; 
     1166 
    11611167  char *vlan7ports = NULL; 
    11621168  vlan7ports = "4t 5"; 
     
    11761182      if (getRouterBrand () == ROUTER_WRT600N) 
    11771183        eth = "eth2"; 
     1184      if (donothing) 
     1185        return eth; 
    11781186      if (enable) 
    11791187        { 
     
    11981206  system2 ("echo 1 > /proc/switch/eth1/reset"); 
    11991207  char tmp[200]; 
    1200   if (enable) 
    1201     { 
    1202       sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/1/ports", ""); 
    1203       system2 (tmp); 
    1204       sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/1/ports", ""); 
    1205       system2 (tmp); 
    1206       sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/0/ports", 
    1207                nvram_safe_get ("vlan0ports")); 
    1208       system2 (tmp); 
    1209       sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/0/ports", 
    1210                nvram_safe_get ("vlan0ports")); 
    1211       system2 (tmp); 
    1212       sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/7/ports", vlan7ports); 
    1213       system2 (tmp); 
    1214       sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/7/ports", vlan7ports); 
    1215       system2 (tmp); 
    1216     } 
    1217   else 
    1218     { 
    1219       int i; 
    1220       for (i = 0; i < 16; i++) 
    1221         { 
    1222           sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/%d/ports", "", i); 
     1208  if (!donothing) 
     1209    { 
     1210      if (enable) 
     1211        { 
     1212          sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/1/ports", ""); 
    12231213          system2 (tmp); 
    1224           sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/%d/ports", "", i); 
     1214          sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/1/ports", ""); 
    12251215          system2 (tmp); 
    1226         } 
    1227       for (i = 0; i < 16; i++) 
    1228         { 
    1229           char vlanb[16]; 
    1230           sprintf (vlanb, "vlan%dports", i); 
    1231           if (nvram_get (vlanb) == NULL || nvram_match (vlanb, "")) 
    1232             continue; 
    1233           sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/%d/ports", 
    1234                    nvram_safe_get (vlanb), i); 
     1216          sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/0/ports", 
     1217                   nvram_safe_get ("vlan0ports")); 
    12351218          system2 (tmp); 
    1236           sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/%d/ports", 
    1237                    nvram_safe_get (vlanb), i); 
     1219          sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/0/ports", 
     1220                   nvram_safe_get ("vlan0ports")); 
    12381221          system2 (tmp); 
     1222          sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/7/ports", 
     1223                   vlan7ports); 
     1224          system2 (tmp); 
     1225          sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/7/ports", 
     1226                   vlan7ports); 
     1227          system2 (tmp); 
     1228        } 
     1229      else 
     1230        { 
     1231          int i; 
     1232          for (i = 0; i < 16; i++) 
     1233            { 
     1234              sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/%d/ports", "", 
     1235                       i); 
     1236              system2 (tmp); 
     1237              sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/%d/ports", "", 
     1238                       i); 
     1239              system2 (tmp); 
     1240            } 
     1241          for (i = 0; i < 16; i++) 
     1242            { 
     1243              char vlanb[16]; 
     1244              sprintf (vlanb, "vlan%dports", i); 
     1245              if (nvram_get (vlanb) == NULL || nvram_match (vlanb, "")) 
     1246                continue; 
     1247              sprintf (tmp, "echo %s > /proc/switch/eth0/vlan/%d/ports", 
     1248                       nvram_safe_get (vlanb), i); 
     1249              system2 (tmp); 
     1250              sprintf (tmp, "echo %s > /proc/switch/eth1/vlan/%d/ports", 
     1251                       nvram_safe_get (vlanb), i); 
     1252              system2 (tmp); 
     1253            } 
    12391254        } 
    12401255    } 
Note: See TracChangeset for help on using the changeset viewer.