From cb59b0586dd86fdc5a00e405fbaa76fb1eaf62c6 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 24 Oct 2017 17:23:23 +0200 Subject: [dnbd3-proxy-mode] Exclude own ip addresses from alt-servers --- .../data/opt/openslx/scripts/systemd-setup_dnbd3_proxy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'core/modules/dnbd3-proxy-mode') diff --git a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy index 2881e0f3..58a23c33 100755 --- a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy +++ b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy @@ -67,9 +67,11 @@ uplinkTimeout=1250 clientTimeout=15000 [logging] -consoleMask=ERROR WARNING +consoleMask=ERROR WARNING MINOR INFO EOF +MY_IPS=$(ip a | grep '^\s*inet\s' | awk '{print $2}') + # helper to echo given list of IPs to ${DNBD3_CONF_DIR}/alt-servers # optionally takes a single char prefix as first param and # adds it to the IP (for private dnbd3 servers) @@ -78,6 +80,9 @@ add_alt_server() { local PRE= [ "x$1" = "x-" ] && PRE='-' && shift for ALT in "$@"; do + for ip in $MY_IPS; do + [ "x$ALT" = "x${ip%/*}" ] && return 0 # Ignore self + done echo "${PRE}${ALT}" >> "${DNBD3_CONF_DIR}/alt-servers" [ "x${ALT}" = "x${SLX_PXE_SERVER_IP}" ] && FOUND_SAT="oui" done @@ -93,7 +98,7 @@ add_alt_server '-' ${SLX_DNBD3_PRIVATE} chmod a+Xr "${DNBD3_CONF_DIR}" # create rpc.acl to allow the satellite only -rm -f "${DNBD3_CONF_DIR}/rpc.acl" +rm -f "${DNBD3_CONF_DIR}/rpc.acl" for SRV in ${SLX_KCL_SERVERS}; do echo "$SRV STATS CLIENT_LIST IMAGE_LIST" >> "${DNBD3_CONF_DIR}/rpc.acl" done -- cgit v1.2.3-55-g7522