brcm47xx: netconfig: add bacis support for swconfig

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

SVN-Revision: 35911
v19.07.3_mercusys_ac12_duma
Hauke Mehrtens 11 years ago
parent 72af5b4b35
commit 694050a4cf

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

Loading…
Cancel
Save