summaryrefslogtreecommitdiff
path: root/target/linux/brcm47xx
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2013-03-09 19:24:43 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2013-03-09 19:24:43 +0000
commit694050a4cf932b71e4d9ccdbe36927b16e047f55 (patch)
tree8cc5195f04ddeda2116368c72269dbfb7898bfd7 /target/linux/brcm47xx
parent72af5b4b3533cab8663b591b60b3291a630e8b23 (diff)
downloadmtk-20170518-694050a4cf932b71e4d9ccdbe36927b16e047f55.zip
mtk-20170518-694050a4cf932b71e4d9ccdbe36927b16e047f55.tar.gz
mtk-20170518-694050a4cf932b71e4d9ccdbe36927b16e047f55.tar.bz2
brcm47xx: netconfig: add bacis support for swconfig
Parse the cpu port from swconfig and explicitly mark the cpu port as tagged. SVN-Revision: 35911
Diffstat (limited to 'target/linux/brcm47xx')
-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 61bcb25..b4be21f 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"