Files
ocserv/tests/connect-script
Nikos Mavrogiannopoulos d852195e64 tests: reproduce #231
This modifies test-pass-script to force a DPD timeout to
verify whether ${IP_REMOTE} is set on the disconnect script.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
2020-02-19 22:17:31 +01:00

35 lines
962 B
Bash
Executable File

#!/bin/sh
#echo $USERNAME : $REASON : $DEVICE
env >/tmp/out.$REASON.tmp
if test -z "${IP_REMOTE}";then
echo "Remote IP environment variable was not set"
exit 1
fi
case "$REASON" in
connect)
test "${OCSERV_DNS}" = "192.168.1.1 192.168.5.1 " && \
test "${OCSERV_DNS4}" = "192.168.1.1 192.168.5.1 " && \
test "${OCSERV_ROUTES}" = "192.168.1.0/255.255.255.0 192.168.5.0/255.255.255.0 " && \
test "${OCSERV_ROUTES4}" = "192.168.1.0/255.255.255.0 192.168.5.0/255.255.255.0 " && \
echo "${IP_REMOTE}" > connect.ok
;;
disconnect)
if ! test -z "$DEVICE";then
test "${OCSERV_DNS}" = "192.168.1.1 192.168.5.1 " && \
test "${OCSERV_DNS4}" = "192.168.1.1 192.168.5.1 " && \
test "${OCSERV_ROUTES}" = "192.168.1.0/255.255.255.0 192.168.5.0/255.255.255.0 " && \
test "${OCSERV_ROUTES4}" = "192.168.1.0/255.255.255.0 192.168.5.0/255.255.255.0 " && \
echo "${IP_REMOTE}" > disconnect.ok
fi
;;
"host-update")
echo > host-update.ok
;;
esac
exit 0