base-files: emit tagged switch configuration by default
authorJo-Philipp Wich <jo@mein.io>
Sat, 15 Oct 2016 23:31:03 +0000 (01:31 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 1 Feb 2017 23:13:49 +0000 (00:13 +0100)
Instead of only using tagged CPU port configurations when more than one VLAN
is present on the switch, always emit tagged configurations unless a board
explicitely opts out of this behaviour by using the previously introduced
[0-9]u@netdev syntax.

Emitting default tagged configurations has the following benefits:

 - Relation of switch vlans to netdevs is easier to understand, especially
   for multi-cpu-port switches

 - Adding additional VLANs (e.g. to break out a LAN port for other purposes)
   becomes easier as users are not forced to change the existing untagged
   VLAN to tagged and the existing ifname notation from ethX to ethX.Y
   anymore, drastly reducing the likelyhood of soft-bricks.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
package/base-files/files/lib/functions/uci-defaults.sh

index 3500d49baabd06bdd0dec568dea32c942118138a..f4c1d968e2494b3bfb12e93c5a083c955a7abbbd 100755 (executable)
@@ -160,7 +160,7 @@ _ucidef_finish_switch_roles() {
                                        json_select ..
                                json_select ..
 
-                               if [ $n_vlan -gt $n_cpu -o ${need_tag:-0} -eq 1 ]; then
+                               if [ ${need_tag:-0} -eq 1 -o ${want_untag:-0} -ne 1 ]; then
                                        num="${num}t"
                                        device="${device}.${index}"
                                fi