]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Add 32-bit netmask support to "ip addr show" stub
authorMartin Schwenke <martin@meltin.net>
Thu, 7 Apr 2016 02:06:52 +0000 (12:06 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 15 Apr 2016 03:57:17 +0000 (05:57 +0200)
In this case do not show broadcast address.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/eventscripts/stubs/ip

index cc88bb62e31fc924e6b6b6608f803a4729b1a057..2468e44ea6494b8b82c83fbabc9f489b6615a058 100755 (executable)
@@ -214,12 +214,10 @@ ip_addr_show ()
     fi
     calc_brd ()
     {
-       case "${local#*/}" in
-           24)
-               brd="${local%.*}.255"
-               ;;
-           *)
-               not_implemented "list ... fake bits other than 24: ${local#*/}"
+           case "${local#*/}" in
+           24) brd="${local%.*}.255" ;;
+           32) brd="" ;;
+           *) not_implemented "list ... fake bits other than 24/32: ${local#*/}"
        esac
     }
     show_iface()
@@ -236,14 +234,14 @@ ip_addr_show ()
                read local scope <"$pf"
                if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
                    calc_brd
-                   echo "    inet ${local} brd ${brd} scope ${scope} ${dev}"
+                   echo "    inet ${local} ${brd:+brd ${brd} }scope ${scope} ${dev}"
                fi
            fi
            if $secondary && [ -r "$sf" ] ; then
                while read local scope ; do
                    if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
                        calc_brd
-                       echo "    inet ${local} brd ${brd} scope ${scope} secondary ${dev}"
+                       echo "    inet ${local} ${brd:+brd }${brd} scope ${scope} secondary ${dev}"
                    fi
                done <"$sf"
            fi