]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - examples/cbq.init-v0.7.3
rdma: align uapi headers with 4.20-rc5
[mirror_iproute2.git] / examples / cbq.init-v0.7.3
index 35a0a05ea18f36860ea5b02e4134b46ca27a5999..ec7839481fb6f928a97f10b121f859833a7fde28 100644 (file)
 #      class. By default, TBF is used. Note that attaching TBF to CBQ class
 #      shapes the traffic to conform to TBF parameters and prevents the class
 #      from borrowing bandwidth from its parent even if you have BOUNDED set
-#      to "no". To allow the class to borrow bandwith (provided it is not
+#      to "no". To allow the class to borrow bandwidth (provided it is not
 #      bounded), you must set LEAF to "none" or "sfq".
 #
 #      If you want to ensure (approximately) fair sharing of bandwidth among
 #
 # Note:        Don't forget to set LEAF to "none" or "sfq", otherwise the class will
 #      have TBF attached to itself and will not be able to borrow unused
-#      bandwith from its parent.
+#      bandwidth from its parent.
 #
 # ISOLATED=yes|no                              optional, default "no"
 #
 # MARK=<mark>
 #
 #      These parameters make up "fw" filter rules that select traffic for
-#      each of the classes accoring to firewall "mark". Mark is a decimal
+#      each of the classes according to firewall "mark". Mark is a decimal
 #      number packets are tagged with if firewall rules say so. You can
 #      use multiple MARK fields per config.
 #
@@ -532,7 +532,7 @@ cbq_off () {
 
 ### Prefixed message
 cbq_message () {
-       echo -e "**CBQ: $@"
+       echo -e "**CBQ: $*"
 } # cbq_message
 
 ### Failure message
@@ -560,15 +560,15 @@ cbq_time2abs () {
 ### Display CBQ setup
 cbq_show () {
        for dev in `cbq_device_list`; do
-               [ `tc qdisc show dev $dev| wc -l` -eq 0 ] && continue
+               [ "`tc qdisc show dev $dev| wc -l`" -eq 0 ] && continue
                echo -e "### $dev: queueing disciplines\n"
                tc $1 qdisc show dev $dev; echo
 
-               [ `tc class show dev $dev| wc -l` -eq 0 ] && continue
+               [ "`tc class show dev $dev| wc -l`" -eq 0 ] && continue
                echo -e "### $dev: traffic classes\n"
                tc $1 class show dev $dev; echo
 
-               [ `tc filter show dev $dev| wc -l` -eq 0 ] && continue
+               [ "`tc filter show dev $dev| wc -l`" -eq 0 ] && continue
                echo -e "### $dev: filtering rules\n"
                tc $1 filter show dev $dev; echo
        done
@@ -578,14 +578,14 @@ cbq_show () {
 ### Check configuration and load DEVICES, DEVFIELDS and CLASSLIST from $1
 cbq_init () {
        ### Get a list of configured classes
-       CLASSLIST=`find $1 \( -type f -or -type l \) -name 'cbq-*' \
-               -not -name '*~' -maxdepth 1 -printf "%f\n"| sort`
+       CLASSLIST=`find $1 -maxdepth 1 \( -type f -or -type l \) -name 'cbq-*' \
+               -not -name '*~' -printf "%f\n"| sort`
        [ -z "$CLASSLIST" ] &&
                cbq_failure "no configuration files found in $1!"
 
        ### Gather all DEVICE fields from $1/cbq-*
-       DEVFIELDS=`find $1 \( -type f -or -type l \) -name 'cbq-*' \
-                 -not -name '*~' -maxdepth 1| xargs sed -n 's/#.*//; \
+       DEVFIELDS=`find $1 -maxdepth 1 \( -type f -or -type l \) -name 'cbq-*' \
+                 -not -name '*~' -print0 | xargs -0 sed -n 's/#.*//; \
                  s/[[:space:]]//g; /^DEVICE=[^,]*,[^,]*\(,[^,]*\)\?/ \
                  { s/.*=//; p; }'| sort -u`
        [ -z "$DEVFIELDS" ] &&
@@ -593,7 +593,7 @@ cbq_init () {
 
        ### Check for different DEVICE fields for the same device
        DEVICES=`echo "$DEVFIELDS"| sed 's/,.*//'| sort -u`
-       [ `echo "$DEVICES"| wc -l` -ne `echo "$DEVFIELDS"| wc -l` ] &&
+       [ "`echo "$DEVICES"| wc -l`" -ne "`echo "$DEVFIELDS"| wc -l`" ] &&
                cbq_failure "different DEVICE fields for single device!\n$DEVFIELDS"
 } # cbq_init
 
@@ -618,7 +618,7 @@ cbq_load_class () {
        PRIO_MARK=$PRIO_MARK_DEFAULT
        PRIO_REALM=$PRIO_REALM_DEFAULT
 
-       eval `echo "$CFILE"| grep -E "^($CBQ_WORDS)="`
+       eval "`echo "$CFILE"| grep -E "^($CBQ_WORDS)="`"
 
        ### Require RATE/WEIGHT
        [ -z "$RATE" -o -z "$WEIGHT" ] &&
@@ -661,7 +661,7 @@ if [ "$1" = "compile" ]; then
 
        ### echo-only version of "tc" command
        tc () {
-               echo "$TC $@"
+               echo "$TC $*"
        } # tc
 
 elif [ -n "$CBQ_DEBUG" ]; then
@@ -669,13 +669,13 @@ elif [ -n "$CBQ_DEBUG" ]; then
 
        ### Logging version of "ip" command
        ip () {
-               echo -e "\n# ip $@" >> $CBQ_DEBUG
+               echo -e "\n# ip $*" >> $CBQ_DEBUG
                $IP "$@" 2>&1 | tee -a $CBQ_DEBUG
        } # ip
 
        ### Logging version of "tc" command
        tc () {
-               echo -e "\n# tc $@" >> $CBQ_DEBUG
+               echo -e "\n# tc $*" >> $CBQ_DEBUG
                $TC "$@" 2>&1 | tee -a $CBQ_DEBUG
        } # tc
 else
@@ -711,8 +711,8 @@ if [ "$1" != "compile" -a "$2" != "nocache" -a -z "$CBQ_DEBUG" ]; then
        ### validate the cache
        [ "$2" = "invalidate" -o ! -f $CBQ_CACHE ] && VALID=0
        if [ $VALID -eq 1 ]; then
-               [ `find $CBQ_PATH -maxdepth 1 -newer $CBQ_CACHE| \
-                 wc -l` -gt 0 ] && VALID=0
+               [ "`find $CBQ_PATH -maxdepth 1 -newer $CBQ_CACHE| \
+                 wc -l`" -gt 0 ] && VALID=0
        fi
 
        ### compile the config if the cache is invalid