mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-03 10:20:36 +00:00
Don't use sed -r in udp_proxy_wrapper.sh
This commit is contained in:
parent
4ac73e7804
commit
22829e9860
@ -2,16 +2,14 @@
|
|||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
MBEDTLS_BASE="$(pwd)/$(dirname $0)/../../"
|
MBEDTLS_BASE="$(dirname -- "$0")/../.."
|
||||||
TPXY_BIN="$MBEDTLS_BASE/test/udp_proxy"
|
TPXY_BIN="$MBEDTLS_BASE/programs/test/udp_proxy"
|
||||||
SRV_BIN="$MBEDTLS_BASE/programs/ssl/ssl_server2"
|
SRV_BIN="$MBEDTLS_BASE/programs/ssl/ssl_server2"
|
||||||
|
|
||||||
: ${VERBOSE:=0}
|
: ${VERBOSE:=0}
|
||||||
VERBOSE=1
|
FULL_PARAMS=$*
|
||||||
|
PROXY_PARAMS=${FULL_PARAMS%%" -- "*}
|
||||||
PARAM_SEP="^(.*)--(.*)$"
|
SERVER_PARAMS=${FULL_PARAMS#*" -- "}
|
||||||
PROXY_PARAMS=$(echo $@ | sed -n -r "s/$PARAM_SEP/\1/p")
|
|
||||||
SERVER_PARAMS=$(echo $@ | sed -n -r "s/$PARAM_SEP/\2/p")
|
|
||||||
|
|
||||||
stop_proxy() {
|
stop_proxy() {
|
||||||
test -n "${TPXY_PID:-}" &&
|
test -n "${TPXY_PID:-}" &&
|
||||||
@ -49,13 +47,13 @@ if [ -z "$DTLS_ENABLED" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SERVER_PORT_ORIG=$(echo "$SERVER_PARAMS" | sed -n -r "s/^.*server_port=([0-9]+).*$/\1/p")
|
SERVER_PORT_ORIG=$(echo "$SERVER_PARAMS" | sed -n "s/^.*server_port=\([0-9]*\).*$/\1/p")
|
||||||
if [ -z "$SERVER_PORT_ORIG" ]; then
|
if [ -z "$SERVER_PORT_ORIG" ]; then
|
||||||
echo " * No server port specified - exit"
|
echo " * No server port specified - exit"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SERVER_ADDR_ORIG=$(echo "$SERVER_PARAMS" | sed -n -r "s/^.*server_addr=([a-zA-Z0-9\.]+).*$/\1/p")
|
SERVER_ADDR_ORIG=$(echo "$SERVER_PARAMS" | sed -n "s/^.*server_addr=\([a-zA-Z0-9\.]*\).*$/\1/p")
|
||||||
if [ -z "$SERVER_ADDR_ORIG" ]; then
|
if [ -z "$SERVER_ADDR_ORIG" ]; then
|
||||||
echo " * No server address specified - exit"
|
echo " * No server address specified - exit"
|
||||||
exit 1
|
exit 1
|
||||||
@ -86,7 +84,7 @@ if [ $VERBOSE -gt 0 ]; then
|
|||||||
echo " * Proxy ID: $TPXY_PID"
|
echo " * Proxy ID: $TPXY_PID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SERVER_PARAMS_NEW=$(echo $SERVER_PARAMS | sed -n -r "s/^(.*server_port=)[0-9]+(.*)$/\1$SERVER_PORT\2/p")
|
SERVER_PARAMS_NEW=$(echo "$SERVER_PARAMS" | sed -n "s/^\(.*server_port=\)[0-9]*\(.*\)$/\1$SERVER_PORT\2/p")
|
||||||
SRV_CMD="$SRV_BIN $SERVER_PARAMS_NEW"
|
SRV_CMD="$SRV_BIN $SERVER_PARAMS_NEW"
|
||||||
|
|
||||||
echo " * Starting server ..."
|
echo " * Starting server ..."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user