brcm47xx: netconfig: add bacis support for swconfig

Parse the cpu port from swconfig and explicitly mark the cpu port as tagged.

SVN-Revision: 35911
This commit is contained in:
Hauke Mehrtens 2013-03-09 19:24:43 +00:00
parent 72af5b4b35
commit 694050a4cf
1 changed files with 27 additions and 25 deletions

View File

@ -83,8 +83,8 @@ start() {
FS="="
c["lan_ifname"]="eth0.1"
c["wan_ifname"]="eth0.2"
c["vlan1ports"]="1 2 3 4 5"
c["vlan2ports"]="0 5"
c["vlan1ports"]="1 2 3 4 5t"
c["vlan2ports"]="0 5t"
getline < "/proc/diag/model"
model=$0
for (i = 0; i < 6; i++) {
@ -92,12 +92,14 @@ start() {
mac_check = mac_check "[0-9a-fA-F][0-9a-fA-F]"
}
if (system("[ -d /proc/switch/eth0 ] ") == 0) {
getline < "/proc/switch/eth0/cpuport"
cpuport=$0
if (cpuport == "8") {
c["vlan1ports"]="1 2 3 4 8"
c["vlan2ports"]="0 8"
}
getline cpuport < "/proc/switch/eth0/cpuport"
}
if (system("command -v swconfig > /dev/null") == 0) {
"swconfig dev switch0 help \| sed -ne \"s\|.*cpu @ \\([0-9]*\\).*\|\\1\|p\"" | getline cpuport
}
if (cpuport == "8") {
c["vlan1ports"]="1 2 3 4 8t"
c["vlan2ports"]="0 8t"
}
}
@ -109,13 +111,13 @@ start() {
END {
if (((nvram["vlan0ports"] ~ /^0 1 2 3 8/ ) && (nvram["vlan1ports"] ~ /^4 8/ && (cpuport == "8"))) || \
((nvram["vlan1ports"] ~ /^0 1 2 3 8/ ) && (nvram["vlan2ports"] ~ /^4 8/ && (cpuport == "8")))) {
c["vlan1ports"] = "0 1 2 3 8"
c["vlan2ports"] = "4 8"
c["vlan1ports"] = "0 1 2 3 8t"
c["vlan2ports"] = "4 8t"
}
if (((nvram["vlan0ports"] ~ /^0 1 2 3 5/ ) && (nvram["vlan1ports"] ~ /^4 5/ && (cpuport == "5"))) || \
((nvram["vlan1ports"] ~ /^0 1 2 3 5/ ) && (nvram["vlan2ports"] ~ /^4 5/ && (cpuport == "5")))) {
c["vlan1ports"] = "0 1 2 3 5"
c["vlan2ports"] = "4 5"
c["vlan1ports"] = "0 1 2 3 5t"
c["vlan2ports"] = "4 5t"
}
if ((model == "ASUS WL-HDD") || (model == "ASUS WL-300g") || (model == "Linksys WAP54G V1")) {
c["wan_ifname"] = ""
@ -124,7 +126,7 @@ start() {
if (model == "ASUS WL-330gE") {
c["wan_ifname"] = ""
c["lan_ifname"] = "eth0.1"
c["vlan1ports"] = "4 5"
c["vlan1ports"] = "4 5t"
c["vlan2ports"] = ""
}
if ((model == "ASUS WL-500g") || (model == "Microsoft MN-700")) {
@ -132,8 +134,8 @@ start() {
c["lan_ifname"] = "eth0"
}
if ((model == "ASUS WL-500g Premium V2") || (model == "Dell TrueMobile 2300 v2") || (model == "Buffalo WHR-G125")) {
c["vlan1ports"] = "0 1 2 3 5"
c["vlan2ports"] = "4 5"
c["vlan1ports"] = "0 1 2 3 5t"
c["vlan2ports"] = "4 5t"
}
if (model == "Dell TrueMobile 2300") {
c["lan_ifname"] = "eth0"
@ -147,14 +149,14 @@ start() {
c["wan_ifname"] = "eth1"
}
if ((nvram["boardtype"] == "wgt634u") || (nvram["boardtype"] == "0x0467")) {
c["vlan1ports"] = "0 1 2 3 5"
c["vlan2ports"] = "4 5"
c["vlan1ports"] = "0 1 2 3 5t"
c["vlan2ports"] = "4 5t"
}
if ((nvram["boardtype"] == "0x042f") || (nvram["boardtype"] == "0x0472")) {
if (nvram["boardnum"] == "45") {
# WL-500gP
c["vlan1ports"] = "1 2 3 4 5"
c["vlan2ports"] = "0 5"
c["vlan1ports"] = "1 2 3 4 5t"
c["vlan2ports"] = "0 5t"
} else {
# Generic BCM94704
c["vlan1ports"] = "0 1 2 3 4 5u"
@ -198,12 +200,12 @@ start() {
if (model == "ASUS WL-700gE") {
c["lan_ifname"]="eth0.1"
c["wan_ifname"]="eth0.2"
c["vlan1ports"]="1 2 3 4 5"
c["vlan2ports"]="0 5"
c["vlan1ports"]="1 2 3 4 5t"
c["vlan2ports"]="0 5t"
}
if ((model == "Motorola WR850G V2/V3") || (model == "Siemens SE505 V2")) {
c["vlan1ports"]="0 1 2 3 5"
c["vlan2ports"]="4 5"
c["vlan1ports"]="0 1 2 3 5t"
c["vlan2ports"]="4 5t"
}
if (model == "ASUS WL-500W") {
c["lan_ifname"] = "eth0"
@ -214,8 +216,8 @@ start() {
if (model == "OvisLink WL-1600GL") {
c["lan_ifname"] = "eth0.1"
c["wan_ifname"] = "eth0.2"
c["vlan1ports"] = "0 1 2 3 5"
c["vlan2ports"] = "4 5"
c["vlan1ports"] = "0 1 2 3 5t"
c["vlan2ports"] = "4 5t"
}
if (model == "SimpleTech SimpleShare NAS") {
c["lan_ifname"] = "eth0"