aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch')
-rw-r--r--package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch b/package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch
new file mode 100644
index 0000000000..a1217668f5
--- /dev/null
+++ b/package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch
@@ -0,0 +1,79 @@
+From 2127850302de2bd8dccff0e31415ce0218750773 Mon Sep 17 00:00:00 2001
+From: Ioana Ciornei <ioana.ciornei@nxp.com>
+Date: Tue, 24 Oct 2017 16:29:53 +0000
+Subject: [PATCH 06/12] scripts: use strings instead of arrays
+
+Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
+---
+ scripts/ls-main | 21 ++++++++++++++-------
+ 1 file changed, 14 insertions(+), 7 deletions(-)
+
+diff --git a/scripts/ls-main b/scripts/ls-main
+index a39df2c..b0c742e 100755
+--- a/scripts/ls-main
++++ b/scripts/ls-main
+@@ -485,7 +485,9 @@ create_dpsw() {
+
+ # Make a link in case there is an end point specified
+ index=0
+- for i in "${endpoint[@]}"; do
++ echo "${endpoint}" |
++ while read -r i
++ do
+ connect $root_c "$dpsw.$index" "$i"
+ index=$((index + 1))
+ done
+@@ -519,8 +521,8 @@ process_addsw() {
+ max_fdb_mc_groups=32
+ # dpsw object label
+ label=
+- #Endpoint objects provided as argument
+- endpoint=()
++ # Endpoint objects provided as argument
++ endpoint=
+ ifcnt=0
+ container=$root_c
+
+@@ -559,7 +561,7 @@ process_addsw() {
+ container="${i#*=}"
+ ;;
+ @(dpni|dpmac).+([0-9]))
+- endpoint[$ifcnt]="$(echo ${i#*=} | tr -d ,)"
++ endpoint="${endpoint}"$'\n'"${i}"
+ ifcnt=$((ifcnt + 1))
+ ;;
+ *)
+@@ -571,14 +573,19 @@ process_addsw() {
+ done
+
+ # Check if there are more endpoints provided than the number of the interfaces
+- if [ $num_ifs -lt ${#endpoint[@]} ]; then
++ if [ $num_ifs -lt $ifcnt ]; then
+ echo "Error: there are more endpoints provided than the number of the interfaces"
+ usage_addsw
+ exit 1
+ fi
+
++ # Delete first empty line from the endpoint string
++ endpoint="$(echo "${endpoint}" | tail -n +2)"
++
+ # Check if the endpoints are valid
+- for i in "${endpoint[@]}"; do
++ echo "${endpoint}" |
++ while read -r i
++ do
+ type_of_endpoint "$i"
+ check_endpoint "$i"
+ has_endpoint "$i"
+@@ -592,7 +599,7 @@ process_addsw() {
+ if (( $object_exists_status == 1 )); then
+ echo "Created ETHSW object $dpsw with ${num_ifs} ports"
+
+- if [ $num_ifs -gt ${#endpoint[@]} ]; then
++ if [ $num_ifs -gt $ifcnt ]; then
+ echo "Do not forget to connect devices to interface(s)."
+ fi
+ fi
+--
+2.14.1
+