Changeset 13854


Ignore:
Timestamp:
02/05/10 11:55:07 (3 years ago)
Author:
eko
Message:

more general vlan7 tagging (for e.g wrt160nv3)

File:
1 edited

Legend:

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

    r13786 r13854  
    19471947        } 
    19481948 
    1949         if (nvram_match("switch_type", "BCM5325"))      // special condition 
     1949        if (nvram_match("switch_type", "BCM5325") && (getRouterBrand() != ROUTER_WRT160NV3))    // special condition 
    19501950                // for Broadcom 
    19511951                // Gigabit Phy 
     
    20292029                        eth = "eth0"; 
    20302030        } 
    2031  
     2031         
     2032        char *vlan_lan_ports = nvram_save_get("vlan0ports"); 
     2033        char *vlan_wan_ports = nvram_save_get("vlan1ports"); 
     2034        int lan_vlan_num = 0; 
     2035        int wan_vlan_num = 1; 
     2036         
     2037        if (nvram_match("vlan2ports", "0 5") || nvram_match("vlan2ports", "4 5")) { //e.g wrt160nv3 
     2038                vlan_lan_ports = nvram_save_get("vlan1ports"); 
     2039                vlan_wan_ports = nvram_save_get("vlan2ports"); 
     2040                lan_vlan_num = 1; 
     2041                wan_vlan_num = 2; 
     2042                if (nvram_match("vlan2ports", "4 5")) 
     2043                        vlan7ports = "4t 5"; 
     2044                else 
     2045                        vlan7ports = "0t 5";                     
     2046        } 
     2047         
    20322048        if (!donothing) { 
    20332049                sysprintf("echo 1 > /proc/switch/%s/reset", eth); 
    20342050                if (enable) { 
    20352051                        fprintf(stderr, "enable vlan port mapping %s/%s\n", 
    2036                                 nvram_safe_get("vlan0ports"), vlan7ports); 
     2052                                vlan_lan_ports, vlan7ports); 
    20372053                        if (!nvram_match("dtag_vlan8", "1") 
    20382054                            || nvram_match("wan_vdsl", "0")) { 
    20392055                                sysprintf 
    2040                                     ("echo \"%s\" > /proc/switch/%s/vlan/0/ports", 
    2041                                      nvram_safe_get("vlan0ports"), eth); 
     2056                                    ("echo \"%s\" > /proc/switch/%s/vlan/%d/ports", 
     2057                                     vlan_lan_ports, eth, lan_vlan_num); 
    20422058                                start_setup_vlans(); 
    20432059                                sysprintf 
    2044                                     ("echo \"%s\" > /proc/switch/%s/vlan/1/ports", 
    2045                                      "", eth); 
     2060                                    ("echo \"%s\" > /proc/switch/%s/vlan/%d/ports", 
     2061                                     "", eth, wan_vlan_num); 
    20462062                                sysprintf 
    20472063                                    ("echo \"%s\" > /proc/switch/%s/vlan/7/ports", 
     
    20492065                        } else { 
    20502066                                sysprintf 
    2051                                     ("echo \"%s\" > /proc/switch/%s/vlan/0/ports", 
    2052                                      nvram_safe_get("vlan0ports"), eth); 
     2067                                    ("echo \"%s\" > /proc/switch/%s/vlan/%d/ports", 
     2068                                     vlan_lan_ports, eth, lan_vlan_num); 
    20532069                                start_setup_vlans(); 
    20542070                                sysprintf 
    2055                                     ("echo \"%s\" > /proc/switch/%s/vlan/1/ports", 
    2056                                      "", eth); 
     2071                                    ("echo \"%s\" > /proc/switch/%s/vlan/%d/ports", 
     2072                                     "", eth, wan_vlan_num); 
    20572073                                sysprintf 
    20582074                                    ("echo \"%s\" > /proc/switch/%s/vlan/7/ports", 
     
    20642080                } else { 
    20652081                        fprintf(stderr, "disable vlan port mapping %s/%s\n", 
    2066                                 nvram_safe_get("vlan0ports"), 
    2067                                 nvram_safe_get("vlan1ports")); 
     2082                                vlan_lan_ports, 
     2083                                vlan_wan_ports); 
    20682084                        sysprintf("echo \"%s\" > /proc/switch/%s/vlan/8/ports", 
    20692085                                  "", eth); 
    20702086                        sysprintf("echo \"%s\" > /proc/switch/%s/vlan/7/ports", 
    20712087                                  "", eth); 
    2072                         sysprintf("echo \"%s\" > /proc/switch/%s/vlan/0/ports", 
    2073                                   nvram_safe_get("vlan0ports"), eth); 
    2074                         sysprintf("echo \"%s\" > /proc/switch/%s/vlan/1/ports", 
    2075                                   nvram_safe_get("vlan1ports"), eth); 
     2088                        sysprintf("echo \"%s\" > /proc/switch/%s/vlan/%d/ports", 
     2089                                  vlan_lan_ports, eth, lan_vlan_num); 
     2090                        sysprintf("echo \"%s\" > /proc/switch/%s/vlan/%d/ports", 
     2091                                  vlan_wan_ports, eth, wan_vlan_num); 
    20762092                        start_setup_vlans(); 
    20772093                } 
Note: See TracChangeset for help on using the changeset viewer.