image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$CENTOS7_BUILD
before_script:
- yum install -y ocserv openconnect which
+ net-tools
script:
+ # Test with iproute2
- make -C tests check RESOLVCONF=1
+ # Test with route/ifconfig/netstat (approximation of *BSD/macOS)
+ - make -C tests check RESOLVCONF=1 NO_IPROUTE2=1 TRACE_VPNC_SCRIPT=1
tags:
- shared
- linux
expire_in: 1 week
untracked: true
when: on_failure
-
eval "${GETPORT}"
-if test -z "${IP}";then
+if test "$TRACE_VPNC_SCRIPT" = 1;then
+ echo "Enabling detailed tracing in vpnc-script (env; set -x)."
+ sed -i.trace -e 's|^#TRACE#||' ${srcdir}/../vpnc-script || exit 1
+fi
+
+if test "$NO_IPROUTE2" = 1;then
+ echo "Disabling iproute2 support in vpnc-script."
+ sed -i.iproute2 -e 's|IPROUTE=....*|IPROUTE="" # disable|g' ${srcdir}/../vpnc-script || exit 1
+elif test -z "${IP}";then
echo "no IP tool is present"
exit 1
fi
cp ${RESOLVCONFBAK} /etc/resolv.conf
fi
rm -f ${OUTFILE} ${ALLFILE} ${RESOLVCONFBAK} 2>&1
+ if test "${NO_IPROUTE2}" = 1;then
+ mv -f ${srcdir}/../vpnc-script.iproute2 ${srcdir}/../vpnc-script 2>&1
+ fi
+ if test "${TRACE_VPNC_SCRIPT}" = 1;then
+ mv -f ${srcdir}/../vpnc-script.trace ${srcdir}/../vpnc-script 2>&1
+ fi
}
trap finish EXIT
eval "${GETPORT}"
-if test -z "${IP}";then
+if test "$TRACE_VPNC_SCRIPT" = 1;then
+ echo "Enabling detailed tracing in vpnc-script (env; set -x)."
+ sed -i.trace -e 's|^#TRACE#||' ${srcdir}/../vpnc-script || exit 1
+fi
+
+if test "$NO_IPROUTE2" = 1;then
+ echo "Disabling iproute2 support in vpnc-script."
+ sed -i.iproute2 -e 's|IPROUTE=....*|IPROUTE="" # disable|' ${srcdir}/../vpnc-script || exit 1
+elif test -z "${IP}";then
echo "no IP tool is present"
exit 1
fi
cp ${RESOLVCONFBAK} /etc/resolv.conf
fi
rm -f ${OUTFILE} ${RESOLVCONFBAK} 2>&1
+ if test "${NO_IPROUTE2}" = 1;then
+ mv -f ${srcdir}/../vpnc-script.iproute2 ${srcdir}/../vpnc-script 2>&1
+ fi
+ if test "${TRACE_VPNC_SCRIPT}" = 1;then
+ mv -f ${srcdir}/../vpnc-script.trace ${srcdir}/../vpnc-script 2>&1
+ fi
}
trap finish EXIT
# 1) Maybe dnsmasq can do something like that
# 2) Parse dns packets going out via tunnel and redirect them to original dns-server
-#env | sort
-#set -x
+# ======== For test logging (CI/CD will uncomment automatically) =========
+
+#TRACE# echo "------------------"
+#TRACE# echo "vpnc-script environment:"
+#TRACE# env | egrep '^(CISCO_|INTERNAL_IP|VPNGATEWAY|TUNDEV|reason)' | sort
+#TRACE# echo "------------------"
+#TRACE# set -x
# =========== script (variable) setup ====================================