diff options
author | Jo-Philipp Wich <jo@mein.io> | 2016-10-16 01:13:55 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2016-11-02 01:06:29 +0100 |
commit | 5e0441aaf0531e18222093e4084f4795fcba2343 (patch) | |
tree | cf12427aa8aa0bcae698c38624d0fa4622f875ea /package | |
parent | 317b3556a494b2c6f02ef3e965ac42e77342ee4e (diff) | |
download | upstream-5e0441aaf0531e18222093e4084f4795fcba2343.tar.gz upstream-5e0441aaf0531e18222093e4084f4795fcba2343.tar.bz2 upstream-5e0441aaf0531e18222093e4084f4795fcba2343.zip |
base-files: uci-defaults: support requesting untagged switch port configuration
Introduce support for a new [0-9]u@netdev syntax to ucidev_add_switch() to let
board.d network files request default network switch configurations which do
not use tagged CPU ports.
This commit itself has no effect on generated configurations at the moment
since we still emit untagged configurations by default but it allows boards to
opt-out from default tagged configs in case we start emitting tagged settings
by default.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'package')
-rwxr-xr-x | package/base-files/files/lib/functions/uci-defaults.sh | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index e39b0a5776..3500d49baa 100755 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -94,7 +94,7 @@ ucidef_set_interface_raw() { } _ucidef_add_switch_port() { - # inherited: $num $device $need_tag $role $index $prev_role + # inherited: $num $device $need_tag $want_untag $role $index $prev_role # inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5 n_ports=$((n_ports + 1)) @@ -102,10 +102,11 @@ _ucidef_add_switch_port() { json_select_array ports json_add_object json_add_int num "$num" - [ -n "$device" ] && json_add_string device "$device" - [ -n "$need_tag" ] && json_add_boolean need_tag "$need_tag" - [ -n "$role" ] && json_add_string role "$role" - [ -n "$index" ] && json_add_int index "$index" + [ -n "$device" ] && json_add_string device "$device" + [ -n "$need_tag" ] && json_add_boolean need_tag "$need_tag" + [ -n "$want_untag" ] && json_add_boolean want_untag "$want_untag" + [ -n "$role" ] && json_add_string role "$role" + [ -n "$index" ] && json_add_int index "$index" json_close_object json_select .. @@ -140,7 +141,7 @@ _ucidef_add_switch_port() { _ucidef_finish_switch_roles() { # inherited: $name $n_cpu $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5 - local index role roles num device need_tag port ports + local index role roles num device need_tag want_untag port ports json_select switch json_select "$name" @@ -155,7 +156,7 @@ _ucidef_finish_switch_roles() { json_select "$name" json_select ports json_select "$port" - json_get_vars num device need_tag + json_get_vars num device need_tag want_untag json_select .. json_select .. @@ -207,10 +208,15 @@ ucidef_add_switch() { num="${port%%@*}" device="${port##*@}" need_tag=0 + want_untag=0 [ "${num%t}" != "$num" ] && { num="${num%t}" need_tag=1 } + [ "${num%u}" != "$num" ] && { + num="${num%u}" + want_untag=1 + } ;; [0-9]*:*:[0-9]*) num="${port%%:*}" @@ -227,7 +233,7 @@ ucidef_add_switch() { _ucidef_add_switch_port fi - unset num device role index need_tag + unset num device role index need_tag want_untag done json_select .. json_select .. |