aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/base-files/etc/init.d
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@openwrt.org>2013-03-09 19:24:43 +0000
committerHauke Mehrtens <hauke@openwrt.org>2013-03-09 19:24:43 +0000
commita5d279ddecf8dd1c7fa93aa45dafb0059093529f (patch)
treed41c7b9cf264e9a948f169a41f4294161bb239f4 /target/linux/brcm47xx/base-files/etc/init.d
parent76c2afef66d2c00a98e478a216a5dded05f67de0 (diff)
downloadmaster-187ad058-a5d279ddecf8dd1c7fa93aa45dafb0059093529f.tar.gz
master-187ad058-a5d279ddecf8dd1c7fa93aa45dafb0059093529f.tar.bz2
master-187ad058-a5d279ddecf8dd1c7fa93aa45dafb0059093529f.zip
brcm47xx: netconfig: add bacis support for swconfig
Parse the cpu port from swconfig and explicitly mark the cpu port as tagged. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35911 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm47xx/base-files/etc/init.d')
-rwxr-xr-xtarget/linux/brcm47xx/base-files/etc/init.d/netconfig52
1 files changed, 27 insertions, 25 deletions
diff --git a/target/linux/brcm47xx/base-files/etc/init.d/netconfig b/target/linux/brcm47xx/base-files/etc/init.d/netconfig
index 61bcb25ddd..b4be21fe93 100755
--- a/target/linux/brcm47xx/base-files/etc/init.d/netconfig
+++ b/target/linux/brcm47xx/base-files/etc/init.d/netconfig
@@ -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"