Index: openwrt/package/base-files/files/lib/functions/uci-defaults.sh =================================================================== --- openwrt.orig/package/base-files/files/lib/functions/uci-defaults.sh +++ openwrt/package/base-files/files/lib/functions/uci-defaults.sh @@ -162,7 +162,7 @@ _ucidef_finish_switch_roles() { if [ ${need_tag:-0} -eq 1 -o ${want_untag:-0} -ne 1 ]; then num="${num}t" - device="${device}.${index}" + device="${device}.$((index - 1))" fi json_select roles Index: openwrt/package/base-files/files/bin/config_generate =================================================================== --- openwrt.orig/package/base-files/files/bin/config_generate +++ openwrt/package/base-files/files/bin/config_generate @@ -161,10 +161,11 @@ generate_switch_vlans_ports() { json_get_vars ports json_select .. + vlan_num=$((role - 1)) uci -q batch <<-EOF add network switch_vlan set network.@switch_vlan[-1].device='$switch' - set network.@switch_vlan[-1].vlan='$role' + set network.@switch_vlan[-1].vlan='$vlan_num' set network.@switch_vlan[-1].ports='$ports' EOF done Index: openwrt/target/linux/ar71xx/base-files/etc/board.d/02_network =================================================================== --- openwrt.orig/target/linux/ar71xx/base-files/etc/board.d/02_network +++ openwrt/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -12,8 +12,9 @@ ar71xx_setup_interfaces() case "$board" in airgatewaypro) + ucidef_set_interface_raw "wifi" "wlan0" "static" ucidef_add_switch "switch0" \ - "0@eth0" "4:lan" "5:wan" + "0@eth0" "4:lan" "5t:wan" "5t:dtdlink" ;; airrouter|\ ap121|\ @@ -57,9 +58,10 @@ ar71xx_setup_interfaces() whr-hp-gn|\ wzr-hp-ag300h|\ zbt-we1526) - ucidef_set_interfaces_lan_wan "eth0.1" "eth1" + ucidef_set_interface_wan "eth1" + ucidef_set_interface_raw "wifi" "wlan0" "static" ucidef_add_switch "switch0" \ - "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" + "0@eth0" "4:lan:1" "3:lan:2" "2:lan:3" "1t:unused" "1t:dtdlink" ;; alfa-ap120c|\ all0305|\ @@ -101,6 +103,7 @@ ar71xx_setup_interfaces() mr900|\ mr900v2|\ mynet-rext|\ + nanostation-m-xw|\ pqi-air-pen|\ rb-411|\ rb-411u|\ @@ -157,7 +160,9 @@ ar71xx_setup_interfaces() wifi-pineapple-nano|\ wndap360|\ wp543) - ucidef_set_interface_lan "eth0" + ucidef_set_interfaces_lan_wan "eth0" "eth0.1" + ucidef_set_interface_raw "wifi" "wlan0" "static" + ucidef_set_interface_raw "dtdlink" "eth0.2" "static" ;; a40|\ a60|\ @@ -176,7 +181,6 @@ ar71xx_setup_interfaces() pb42|\ pb44|\ rb-951ui-2hnd|\ - rb-952ui-5ac2nd|\ routerstation|\ tl-wr710n|\ tl-wr720n-v3|\ @@ -185,14 +189,23 @@ ar71xx_setup_interfaces() wpe72|\ wrtnode2q) ucidef_set_interfaces_lan_wan "eth1" "eth0" + ucidef_set_interface_raw "wifi" "wlan0" "static" + ucidef_set_interface_raw "dtdlink" "eth1.2" "static" ;; rb-750-r2|\ rb-750p-pbr2|\ rb-750up-r2|\ rb-951ui-2nd) - ucidef_set_interfaces_lan_wan "eth1.1" "eth0" + ucidef_set_interface_wan "eth0" + ucidef_set_interface_raw "wifi" "wlan0" "static" + ucidef_add_switch "switch0" \ + "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4t:unused" "4t:dtdlink" + ;; + rb-952ui-5ac2nd) + ucidef_set_interface_wan "eth0" + ucidef_set_interface_raw "wifi" "wlan1" "static" ucidef_add_switch "switch0" \ - "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" + "0@eth1" "4:lan:1" "3:lan:2" "2:lan:3" "1t:unused" "1t:dtdlink" ;; all0258n|\ all0315n|\ @@ -202,7 +215,9 @@ ar71xx_setup_interfaces() ja76pf2|\ rocket-m-ti|\ ubnt-unifi-outdoor) - ucidef_set_interface_lan "eth0 eth1" + ucidef_set_interfaces_lan_wan "eth0" "eth0.1" + ucidef_set_interface_raw "wifi" "wlan0" "static" + ucidef_set_interface_raw "dtdlink" "eth0.2" "static" ;; wzr-hp-g300nh2) ucidef_add_switch "switch0" \ @@ -217,8 +232,9 @@ ar71xx_setup_interfaces() rb-962uigs-5hact2hnt|\ wlr8100|\ wzr-hp-g450h) + ucidef_set_interface_raw "wifi" "wlan0" "static" ucidef_add_switch "switch0" \ - "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" + "0@eth0" "2:lan" "3:lan" "4:lan" "1:wan" "5t:dtdlink" ;; ap135-020|\ ap136-020|\ @@ -300,11 +316,13 @@ ar71xx_setup_interfaces() cpe510|\ wbs210|\ wbs510) + ucidef_set_interface_raw "wifi" "wlan0" "static" ucidef_add_switch "switch0" \ - "0@eth0" "5:lan" "4:wan" + "0@eth0" "5:lan" "4t:wan" "4t:dtdlink" ;; cr3000) ucidef_set_interfaces_lan_wan "eth0.1" "eth1" + ucidef_set_interface_raw "wifi" "wlan0" "static" ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2" ;; @@ -456,10 +474,6 @@ ar71xx_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "5:wan" "6@eth1" ;; - nanostation-m-xw) - ucidef_add_switch "switch0" \ - "0@eth0" "5:lan" "1:wan" - ;; onion-omega) ucidef_set_interface_lan "wlan0" ;; @@ -469,9 +483,10 @@ ar71xx_setup_interfaces() "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth1" ;; routerstation-pro) - ucidef_set_interfaces_lan_wan "eth1.1" "eth0" + ucidef_set_interface_wan "eth0" + ucidef_set_interface_raw "wifi" "wlan0" "static" ucidef_add_switch "switch0" \ - "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1" + "0@eth1" "2:lan:3" "3:lan:2" "4t:unused" "4t:dtdlink" ;; rb-493g) ucidef_set_interfaces_lan_wan "eth0.1 eth1.1" "eth1.2" @@ -572,8 +587,16 @@ ar71xx_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "5:wan" ;; + nanostation-m) + ucidef_set_interface_lan "eth0 eth1" + ucidef_set_interface_wan "eth0.1 eth1.1" + ucidef_set_interface_raw "dtdlink" "eth0.2 eth1.2" "static" + ucidef_set_interface_raw "wifi" "wlan0" "static" + ;; *) - ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_set_interface_raw "wifi" "wlan0" "static" + ucidef_set_interfaces_lan_wan "eth0" "eth0.1" + ucidef_set_interface_raw "dtdlink" "eth0.2" "static" ;; esac }