[SCM] Samba Shared Repository - branch master updated
Amitay Isaacs
amitay at samba.org
Thu Jan 30 21:31:03 MST 2014
The branch, master has been updated
via b112a33 ctdb/tests/eventscripts: Avoid errors on broken pipe
via 1640f36 ctdb/tests/eventscripts: Improve ip command stub secondary handling
via e5778cc ctdb/daemon: reloadips must register state of asynchronous controls
from 05c1fe5 s4:tls_tstream: allow mode of SSL keyfile to be 0400, not only 0600
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b112a3317cbedc73a6e17b3f711fec84f0d41d4e
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Jan 28 14:34:15 2014 +1100
ctdb/tests/eventscripts: Avoid errors on broken pipe
ctdb_get_my_public_addresses() attempts to echo things and this causes
an error if head has taken the first line and the pipe is closed.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Fri Jan 31 05:30:38 CET 2014 on sn-devel-104
commit 1640f36d5831b2575d117fac335f3324ceefa9f8
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Jan 28 16:07:53 2014 +1100
ctdb/tests/eventscripts: Improve ip command stub secondary handling
It should support primary and secondaries per network instead of per
interface.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit e5778cc172eb9fab6382f1c600326f6cc99b9162
Author: Martin Schwenke <martin at meltin.net>
Date: Wed Jan 22 16:02:46 2014 +1100
ctdb/daemon: reloadips must register state of asynchronous controls
Otherwise ctdb_client_async_wait() is a no-op.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
-----------------------------------------------------------------------
Summary of changes:
ctdb/server/ctdb_takeover.c | 3 +
ctdb/tests/eventscripts/scripts/local.sh | 6 +-
ctdb/tests/eventscripts/stubs/ip | 81 ++++++++++++++++++++++--------
3 files changed, 65 insertions(+), 25 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index b918e5a..c21736e 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -4458,6 +4458,7 @@ static int ctdb_reloadips_child(struct ctdb_context *ctdb)
goto failed;
}
+ ctdb_client_async_add(async_data, state);
}
}
@@ -4534,6 +4535,8 @@ static int ctdb_reloadips_child(struct ctdb_context *ctdb)
" failed sending CTDB_CONTROL_ADD_PUBLIC_IP\n"));
goto failed;
}
+
+ ctdb_client_async_add(async_data, state);
}
}
diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
index e8bf3c4..85894a4 100644
--- a/ctdb/tests/eventscripts/scripts/local.sh
+++ b/ctdb/tests/eventscripts/scripts/local.sh
@@ -396,7 +396,7 @@ ctdb_get_my_public_addresses ()
# This is suitable for passing to takeip/releaseip
ctdb_get_1_public_address ()
{
- ctdb_get_my_public_addresses | head -n 1
+ ctdb_get_my_public_addresses | { head -n 1 ; cat >/dev/null ; }
}
ctdb_not_implemented ()
@@ -445,7 +445,7 @@ create_policy_routing_config ()
if [ "$_num_ips" = "all" ] ; then
cat
else
- head -n "$_num_ips"
+ { head -n "$_num_ips" ; cat >/dev/null ; }
fi |
while read _dev _ip _bits ; do
_net=$(ipv4_host_addr_to_net "$_ip" "$_bits")
@@ -474,7 +474,7 @@ check_routes ()
if [ "$_num_ips" = "all" ] ; then
cat
else
- head -n "$_num_ips"
+ { head -n "$_num_ips" ; cat >/dev/null ; }
fi | {
while read _dev _ip _bits ; do
_net=$(ipv4_host_addr_to_net "$_ip" "$_bits")
diff --git a/ctdb/tests/eventscripts/stubs/ip b/ctdb/tests/eventscripts/stubs/ip
index d852cf8..f076cb9 100755
--- a/ctdb/tests/eventscripts/stubs/ip
+++ b/ctdb/tests/eventscripts/stubs/ip
@@ -143,7 +143,7 @@ ip_addr_show ()
if [ -z "$devices" ] ; then
# No device specified? Get all the primaries...
devices=$(ls "${FAKE_IP_STATE}/addresses/"*-primary 2>/dev/null | \
- sed -e 's at .*/@@' -e 's at -primary$@@')
+ sed -e 's at .*/@@' -e 's at -.*-primary$@@' | sort -u)
fi
calc_brd ()
{
@@ -157,27 +157,33 @@ ip_addr_show ()
}
show_iface()
{
- pf="${FAKE_IP_STATE}/addresses/${dev}-primary"
- sf="${FAKE_IP_STATE}/addresses/${dev}-secondary"
ip_link_show "$dev"
- if $primary && [ -r "$pf" ] ; then
- read local <"$pf"
- if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
- calc_brd
- echo " inet ${local} brd ${brd} scope global ${dev}"
- fi
- fi
- if $secondary && [ -r "$sf" ] ; then
- while read local ; do
+
+ nets=$(ls "${FAKE_IP_STATE}/addresses/${dev}"-*-primary 2>/dev/null | \
+ sed -e 's at .*/@@' -e "s@${dev}-\(.*\)-primary\$@\1@")
+
+ for net in $nets ; do
+ pf="${FAKE_IP_STATE}/addresses/${dev}-${net}-primary"
+ sf="${FAKE_IP_STATE}/addresses/${dev}-${net}-secondary"
+ if $primary && [ -r "$pf" ] ; then
+ read local <"$pf"
if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
calc_brd
- echo " inet ${local} brd ${brd} scope global secondary ${dev}"
+ echo " inet ${local} brd ${brd} scope global ${dev}"
fi
- done <"$sf"
- fi
- if [ -z "$_to" ] ; then
- echo " valid_lft forever preferred_lft forever"
- fi
+ fi
+ if $secondary && [ -r "$sf" ] ; then
+ while read local ; do
+ if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
+ calc_brd
+ echo " inet ${local} brd ${brd} scope global secondary ${dev}"
+ fi
+ done <"$sf"
+ fi
+ if [ -z "$_to" ] ; then
+ echo " valid_lft forever preferred_lft forever"
+ fi
+ done
}
n=1
for dev in $devices ; do
@@ -189,6 +195,33 @@ ip_addr_show ()
done
}
+# Copied from 13.per_ip_routing for now... so this is lazy testing :-(
+ipv4_host_addr_to_net ()
+{
+ _host="$1"
+ _maskbits="$2"
+
+ # Convert the host address to an unsigned long by splitting out
+ # the octets and doing the math.
+ _host_ul=0
+ for _o in $(export IFS="." ; echo $_host) ; do
+ _host_ul=$(( ($_host_ul << 8) + $_o)) # work around Emacs color bug
+ done
+
+ # Calculate the mask and apply it.
+ _mask_ul=$(( 0xffffffff << (32 - $_maskbits) ))
+ _net_ul=$(( $_host_ul & $_mask_ul ))
+
+ # Now convert to a network address one byte at a time.
+ _net=""
+ for _o in $(seq 1 4) ; do
+ _net="$(($_net_ul & 255))${_net:+.}${_net}"
+ _net_ul=$(($_net_ul >> 8))
+ done
+
+ echo "${_net}/${_maskbits}"
+}
+
ip_addr_add ()
{
local=""
@@ -220,8 +253,10 @@ ip_addr_add ()
not_implemented "addr add (without dev)"
fi
mkdir -p "${FAKE_IP_STATE}/addresses"
- pf="${FAKE_IP_STATE}/addresses/${dev}-primary"
- sf="${FAKE_IP_STATE}/addresses/${dev}-secondary"
+ net_str=$(ipv4_host_addr_to_net $(IFS="/" ; echo $local))
+ net_str=$(echo "$net_str" | sed -e 's@/@_@')
+ pf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-primary"
+ sf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-secondary"
# We could lock here... but we should be the only ones playing
# around here with these stubs.
if [ ! -f "$pf" ] ; then
@@ -260,8 +295,10 @@ ip_addr_del ()
not_implemented "addr del (without dev)"
fi
mkdir -p "${FAKE_IP_STATE}/addresses"
- pf="${FAKE_IP_STATE}/addresses/${dev}-primary"
- sf="${FAKE_IP_STATE}/addresses/${dev}-secondary"
+ net_str=$(ipv4_host_addr_to_net $(IFS="/" ; echo $local))
+ net_str=$(echo "$net_str" | sed -e 's@/@_@')
+ pf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-primary"
+ sf="${FAKE_IP_STATE}/addresses/${dev}-${net_str}-secondary"
# We could lock here... but we should be the only ones playing
# around here with these stubs.
if [ ! -f "$pf" ] ; then
--
Samba Shared Repository
More information about the samba-cvs
mailing list