From 0fb1e1c52487f5228e1a815368512f5ed56bd9f0 Mon Sep 17 00:00:00 2001 From: Paul Luse Date: Sat, 18 Aug 2018 09:25:41 -0700 Subject: [PATCH] ipsec: updates to require ipsec installation Although a pre-req to crypto only, the latest ipsec library now requires root to install. This patch takes 2 approaches to making sure the ipsec module is installed properly. First, in configure, if crypto is enabled it will check to see if ipsec is already installed and if so do nothing. If it is not it will exit and instruct the user to manually install and re-run the configure script. Secondly, to be proactive, this patch adds the installation, if not already installed, to the pkg dependency script because it is already executed as root. It also does the same for nasm, checking the required versions in both places. Change-Id: I037629f21be474b88c12451733ac12ff0b1651f5 Signed-off-by: Paul Luse Reviewed-on: https://review.gerrithub.io/422746 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Chandler-Test-Pool: SPDK Automated Test System --- configure | 17 ++++++++++++++++- scripts/pkgdep.sh | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/configure b/configure index c2cc8f617..3ffce7a94 100755 --- a/configure +++ b/configure @@ -338,7 +338,22 @@ than or equal to 4.14 will see significantly reduced performance. fi fi - +if [[ "$CONFIG_CRYPTO" = "y" ]]; then + set +e + nasm_ver=$(nasm -v | sed 's/[^0-9]*//g' | awk '{print substr ($0, 0, 5)}') + ipsec="$(find /usr -name intel-ipsec-mb.h 2>/dev/null)" + set -e + if [[ $nasm_ver -lt "21202" ]]; then + echo Crypto requires NASM version 2.12.02 or newer. Please install + echo or upgrade then re-run this scrip. + else + if [[ "$ipsec" == "" ]]; then + echo "To enable crypto you must first go to the intel-ipsec-mb directory and " + echo "run 'make' then 'sudo make install' then re-run this script." + exit 1 + fi + fi +fi echo -n "Creating CONFIG.local..." diff --git a/scripts/pkgdep.sh b/scripts/pkgdep.sh index 5700335f5..956e0db23 100755 --- a/scripts/pkgdep.sh +++ b/scripts/pkgdep.sh @@ -3,6 +3,9 @@ SYSTEM=`uname -s` +scriptsdir=$(readlink -f $(dirname $0)) +rootdir=$(readlink -f $scriptsdir/..) + if [ -s /etc/redhat-release ]; then # Includes Fedora, CentOS if [ -f /etc/centos-release ]; then @@ -62,3 +65,24 @@ else echo "pkgdep: unknown system type." exit 1 fi + +# Only crypto needs nasm and this lib but because the lib requires root to +# install we do it here. +nasm_ver=$(nasm -v | sed 's/[^0-9]*//g' | awk '{print substr ($0, 0, 5)}') +if [[ $nasm_ver -lt "21202" ]]; then + echo Crypto requires NASM version 2.12.02 or newer. Please install + echo or upgrade and re-run this script if you are going to use Crypto. +else + ipsec="$(find /usr -name intel-ipsec-mb.h 2>/dev/null)" + if [[ "$ipsec" == "" ]]; then + if [[ -d "$rootdir/intel-ipsec-mb" ]]; then + cd $rootdir/intel-ipsec-mb + make + make install + cd - + else + echo "The intel-ipsec-mb submodule has not been cloned and will not be installed." + echo "To enable crypto, run 'git submodule update --init' and then run this script again." + fi + fi +fi