Last active
July 11, 2016 21:19
-
-
Save jtopjian/b280b4f04942e456a880 to your computer and use it in GitHub Desktop.
IPv6 patch for wsrep_sst_xtrabackup-v2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- wsrep_sst_xtrabackup-v2.orig 2016-07-11 21:17:51.902461163 +0000 | |
+++ wsrep_sst_xtrabackup-v2 2016-05-29 03:16:48.450461163 +0000 | |
@@ -205,10 +205,10 @@ | |
stagemsg+="-OpenSSL-Encrypted-2" | |
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then | |
wsrep_log_info "Decrypting with PEM $tpem, CA: $tcert" | |
- tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio" | |
+ tcmd="socat -6 -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio" | |
else | |
wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert" | |
- tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}" | |
+ tcmd="socat -6 -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}" | |
fi | |
elif [[ $encrypt -eq 3 ]];then | |
wsrep_log_info "Using openssl based encryption with socat: with key and crt" | |
@@ -219,17 +219,17 @@ | |
stagemsg+="-OpenSSL-Encrypted-3" | |
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then | |
wsrep_log_info "Decrypting with certificate $tpem, key $tkey" | |
- tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,key=${tkey},verify=0${sockopt} stdio" | |
+ tcmd="socat -6 -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,key=${tkey},verify=0${sockopt} stdio" | |
else | |
wsrep_log_info "Encrypting with certificate $tpem, key $tkey" | |
- tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,key=${tkey},verify=0${sockopt}" | |
+ tcmd="socat -6 -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,key=${tkey},verify=0${sockopt}" | |
fi | |
else | |
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then | |
- tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" | |
+ tcmd="socat -6 -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" | |
else | |
- tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}" | |
+ tcmd="socat -6 -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}" | |
fi | |
fi | |
fi | |
@@ -483,12 +483,12 @@ | |
setup_ports() | |
{ | |
if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then | |
- SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') | |
- REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') | |
- lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }') | |
- sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }') | |
+ SST_PORT=$(echo ${WSREP_SST_OPT_ADDR##*:} | tr -d []) | |
+ REMOTEIP="[$(echo ${WSREP_SST_OPT_ADDR%:*} | tr -d [])]" | |
+ lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[/]' '{ print $3 }' | tr -d []) | |
+ sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[/]' '{ print $4 }' | tr -d []) | |
else | |
- SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }') | |
+ SST_PORT=$(echo ${WSREP_SST_OPT_ADDR##*:} | tr -d []) | |
fi | |
} | |
@@ -819,7 +819,7 @@ | |
if [ -z "${SST_PORT}" ] | |
then | |
SST_PORT=4444 | |
- ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}" | |
+ ADDR="[$(echo ${WSREP_SST_OPT_ADDR%:*} | tr -d [])]:${SST_PORT}" | |
fi | |
wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment