From: Martin Schwenke Date: Thu, 7 Apr 2016 02:06:52 +0000 (+1000) Subject: ctdb-tests: Add 32-bit netmask support to "ip addr show" stub X-Git-Tag: talloc-2.1.7~256 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47a68ff440ceb3affb2dcca5bea79938a154f5be;p=thirdparty%2Fsamba.git ctdb-tests: Add 32-bit netmask support to "ip addr show" stub In this case do not show broadcast address. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/eventscripts/stubs/ip b/ctdb/tests/eventscripts/stubs/ip index cc88bb62e31..2468e44ea64 100755 --- a/ctdb/tests/eventscripts/stubs/ip +++ b/ctdb/tests/eventscripts/stubs/ip @@ -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