[source] base-files: always set proto passed to _ucidef_set_interface()

LEDE Commits lede-commits at lists.infradead.org
Sat Mar 11 05:14:51 PST 2017


mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/0f01253b257b8e832bea8b63115d4a4280375ccb

commit 0f01253b257b8e832bea8b63115d4a4280375ccb
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Wed Feb 15 08:39:05 2017 +0100

    base-files: always set proto passed to _ucidef_set_interface()
    
    Overwrite an already set proto if a new one is passed to
    _ucidef_set_interface() similar to what is done for the interface.
    
    It is required when using ""ucidef_set_interface_wan 'ptm0' 'pppoe'"
    after some initial wan interface configuration is already done by
    ucidef_add_switch.
    
    The "json_is_a protocol string" guard is meant to not reset an earlier
    set interface proto in case something like
    "ucidef_set_interface_lan 'eth0'" is used afterwards.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 package/base-files/files/lib/functions/uci-defaults.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index f4c1d96..9fad189 100755
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -35,7 +35,7 @@ _ucidef_set_interface() {
 	json_select_object "$name"
 	json_add_string ifname "$iface"
 
-	if ! json_is_a protocol string; then
+	if ! json_is_a protocol string || [ -n "$proto" ]; then
 		case "$proto" in
 			static|dhcp|none|pppoe) : ;;
 			*)



More information about the lede-commits mailing list