From 3673592851d570e2f4c23dcd36cb42bce4fb9387 Mon Sep 17 00:00:00 2001 From: Ratnadeep Bhattacharya Date: Tue, 12 Feb 2019 12:34:05 -0500 Subject: [PATCH 01/13] Update Install.md --- Install.md | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Install.md b/Install.md index 13752e9..b2f4cb3 100644 --- a/Install.md +++ b/Install.md @@ -93,7 +93,8 @@ This guide helps you build and install Snort. ./configure --enable-sourcefire ``` -3. Create Patch of Makefille +3. Create Patch of Makefille + This part is critical for the next steps. The defaults are blank. Please type in the answers manually. ```sh cd ../ ./patching-Makefile.sh @@ -121,19 +122,36 @@ This guide helps you build and install Snort. sudo cp -r snort-2.9.8.3/simple-etc /etc/snort sudo mkdir /usr/local/lib/snort_dynamicrules ``` +2. Add snort to path (change /opt/snort if the install path is different) + ``` + export PATH=$PATH:/opt/snort/bin" + ``` +3. Set up huge pages + ```export ONVM_NUM_HUGEPAGES=1024 + hp_size=$(cat /proc/meminfo | grep Hugepagesize | awk '{print $2}') + hp_count="${ONVM_NUM_HUGEPAGES:-1024}" + sudo mkdir -p /mnt/huge + sudo sh -c "echo \"huge /mnt/huge hugetlbfs defaults 0 0\" >> /etc/fstab" + sudo mount -t hugetlbfs nodev /mnt/huge + ``` -2. Run openNetVM manager. To install openNetVM, refer to this [guide][onvm-install]. +4. Run openNetVM manager. To install openNetVM, refer to this [guide][onvm-install]. ```sh cd openNetVM-dev/onvm ./go.sh 0,1,2,3,4 3 -v 0x7f000000000 ``` -3. Run Snort. +5. Run Snort. ```sh sudo snort -A console -Q -c /etc/snort/snort.conf -i dpdk0:dpdk1 -N --alert-before-pass --daq-var netvm_args="-l 5 -n 3 --proc-type=secondary -- -r 1 -- -d 4" ``` + If the above does not work then try: + ``` + which snort + sudo `which snort` -A console -Q -c /etc/snort/snort.conf -i dpdk0:dpdk1 -N --alert-before-pass --daq-var netvm_args="-l 5 -n 3 --proc-type=secondary -- -r 1 -- -d 4" + ``` ![snort init][snort-init] -3. Run Bridge. +6. Run Bridge. ```sh cd openNetVM-dev/examples/bridge/ ./go.sh 6 4 From f18fcaa95e494f30f63e2d95726cb3851cda1561 Mon Sep 17 00:00:00 2001 From: Ratnadeep Bhattacharya Date: Tue, 12 Feb 2019 12:35:42 -0500 Subject: [PATCH 02/13] Update Install.md --- Install.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Install.md b/Install.md index b2f4cb3..53d83f9 100644 --- a/Install.md +++ b/Install.md @@ -93,8 +93,7 @@ This guide helps you build and install Snort. ./configure --enable-sourcefire ``` -3. Create Patch of Makefille - This part is critical for the next steps. The defaults are blank. Please type in the answers manually. +3. Create Patch of Makefille. This part is critical for the next steps. The defaults are blank. Please type in the answers manually. ```sh cd ../ ./patching-Makefile.sh From 7d0704b0d2e10a86f937214618590e30c80b760b Mon Sep 17 00:00:00 2001 From: Ratnadeep Bhattacharya Date: Sat, 16 Feb 2019 18:51:22 -0500 Subject: [PATCH 03/13] Update Install.md --- Install.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Install.md b/Install.md index 53d83f9..06f7f02 100644 --- a/Install.md +++ b/Install.md @@ -133,6 +133,8 @@ This guide helps you build and install Snort. sudo sh -c "echo \"huge /mnt/huge hugetlbfs defaults 0 0\" >> /etc/fstab" sudo mount -t hugetlbfs nodev /mnt/huge ``` + Further troubleshooting: + ```sudo sysctl vm.nr_hugepages=$hp_count``` 4. Run openNetVM manager. To install openNetVM, refer to this [guide][onvm-install]. ```sh From 571c76e72b4d0c36aa5d58843d2b91b8cef645ba Mon Sep 17 00:00:00 2001 From: Ratnadeep Bhattacharya Date: Fri, 22 Feb 2019 07:25:40 -0500 Subject: [PATCH 04/13] Added two simple CPU timing counters to daq_netvm.c The snort NF will now print out processing time for every batch of packets and the related packets per second rate --- daq-2.0.6/os-daq-modules/daq_netvm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/daq-2.0.6/os-daq-modules/daq_netvm.c b/daq-2.0.6/os-daq-modules/daq_netvm.c index 70b25e6..922a18e 100644 --- a/daq-2.0.6/os-daq-modules/daq_netvm.c +++ b/daq-2.0.6/os-daq-modules/daq_netvm.c @@ -49,6 +49,9 @@ #include #include +/* timing header */ +#include + #define NF_TAG "snort" #define _NF_MEMPOOL_NAME "NF_INFO_MEMPOOL" @@ -301,6 +304,8 @@ static int netvm_daq_acquire(void *handle, int cnt, DAQ_Analysis_Func_t callback uint16_t nb_pkts; uint16_t i, j; int tx_batch_size; + double cpu_time; + int pps; // packets per second //printf("->netvm_daq_acquire(%d - %d)\n", cnt, max_pkts); //if (once) { @@ -318,6 +323,8 @@ static int netvm_daq_acquire(void *handle, int cnt, DAQ_Analysis_Func_t callback netvmc->break_loop = 0; return 0; } + + start = clock(); /* timing function */ /* Dequeue all packets in ring up to max possible. */ nb_pkts = rte_ring_dequeue_burst(netvmc->rx_ring, pktsRX, max_pkts); @@ -401,6 +408,11 @@ static int netvm_daq_acquire(void *handle, int cnt, DAQ_Analysis_Func_t callback /* Enqueue on return to NetVM */ pktsTX[tx_batch_size++] = pktsRX[i]; } + + /* timing function */ + end = clock(); + cpu_time = ((double) (end - start)) / CLOCKS_PER_SEC; + pps = (int) (nb_pkts / cpu_time); /* Give returned burst of packets back to NetVM manager. */ if (unlikely(tx_batch_size > 0 && rte_ring_enqueue_bulk(netvmc->tx_ring, pktsTX, tx_batch_size) == -ENOBUFS)) { From db9e4b113814738e0de70f10c52fd4025a782977 Mon Sep 17 00:00:00 2001 From: ratnadeepb Date: Thu, 28 Feb 2019 19:22:32 -0600 Subject: [PATCH 05/13] instrumenting snort adding code to count cpu cycles and avg pps --- daq-2.0.6/os-daq-modules/daq_netvm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/daq-2.0.6/os-daq-modules/daq_netvm.c b/daq-2.0.6/os-daq-modules/daq_netvm.c index 922a18e..c96100e 100644 --- a/daq-2.0.6/os-daq-modules/daq_netvm.c +++ b/daq-2.0.6/os-daq-modules/daq_netvm.c @@ -42,6 +42,7 @@ #include #include #include +#include //----- NetVM header files and tags ---- #include @@ -49,9 +50,6 @@ #include #include -/* timing header */ -#include - #define NF_TAG "snort" #define _NF_MEMPOOL_NAME "NF_INFO_MEMPOOL" @@ -304,8 +302,9 @@ static int netvm_daq_acquire(void *handle, int cnt, DAQ_Analysis_Func_t callback uint16_t nb_pkts; uint16_t i, j; int tx_batch_size; + uint64_t start; double cpu_time; - int pps; // packets per second + double pps; //printf("->netvm_daq_acquire(%d - %d)\n", cnt, max_pkts); //if (once) { @@ -324,8 +323,8 @@ static int netvm_daq_acquire(void *handle, int cnt, DAQ_Analysis_Func_t callback return 0; } - start = clock(); /* timing function */ - + start = rte_get_tsc_cycles(); + /* Dequeue all packets in ring up to max possible. */ nb_pkts = rte_ring_dequeue_burst(netvmc->rx_ring, pktsRX, max_pkts); @@ -409,10 +408,11 @@ static int netvm_daq_acquire(void *handle, int cnt, DAQ_Analysis_Func_t callback pktsTX[tx_batch_size++] = pktsRX[i]; } - /* timing function */ - end = clock(); - cpu_time = ((double) (end - start)) / CLOCKS_PER_SEC; - pps = (int) (nb_pkts / cpu_time); + cpu_time = (double)(rte_get_tsc_cycles() - start) / rte_get_tsc_hz(); + pps = (double) (nb_pkts / cpu_time); + + printf("CPU Time: %f\n", cpu_time); + printf("PPS: %f\n", pps); /* Give returned burst of packets back to NetVM manager. */ if (unlikely(tx_batch_size > 0 && rte_ring_enqueue_bulk(netvmc->tx_ring, pktsTX, tx_batch_size) == -ENOBUFS)) { From 10a3ce375383c78ae757263a292d38805d53346e Mon Sep 17 00:00:00 2001 From: ratnadeepb Date: Fri, 1 Mar 2019 11:09:57 -0600 Subject: [PATCH 06/13] Automating compile and install patching-Makefile.sh has been modified to accept default values. This file is now called from inside setenv.sh. setenv.sh sets up all initial enviornment variables assuming defaults. The variables in this file can be changed if defaults are not used. The setenv.sh script is run from inside install.sh. This script essentially, sets up all environment variables, installs all packages and builds all the tools. --- install.sh | 55 ++++++++++++++++++++++++++++ patching-Makefile.sh | 14 ++++++++ setenv.sh | 86 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100755 install.sh create mode 100755 setenv.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..4c6d2ce --- /dev/null +++ b/install.sh @@ -0,0 +1,55 @@ +ls | grep setenv.sh +ANS=`echo $?` +if [ $ANS == 1 ] +then + echo please run this script in situ + exit +fi + +./setenv.sh + +# Base directory +BASE_DIR=$(pwd) + +# update +sudo apt-get update + +make -j7 T=$RTE_TARGET O=$RTE_TARGET +sudo make install T=x86_64-native-linuxapp-gcc + +cd onvm && make + +# Compile DAQ +sudo apt-get install -y libpcap-dev libpcre3-dev libdumbnet-dev zlib1g-dev liblzma-dev libssl-dev autoconf + +cd $BASE_DIR/daq* + +make clean +aclocal +autoconf +autoheader +automake -a + +./configure --with-dpdk-includes=$RTE_SDK/$RTE_TARGET/include --with-dpdk-libraries=$RTE_SDK/$RTE_TARGET/lib --with-netvm-includes=$ONVM_HOME/onvm --with-netvm-libraries=$ONVM_HOME/onvm + +make -j7 +sudo make install + +# Compile snort +cd $BASE_DIR/snort* +./configure --enable-sourcefire + +cd snort*/src +make clean +make -j7 +sudo make install + +sudo ldconfig + +sudo cp -r snort*/simple-etc /etc/snort +sudo mkdir /usr/local/lib/snort_dynamicrules + +cd $ONVM_HOME +scripts/install.sh + +cd $BASE_DIR diff --git a/patching-Makefile.sh b/patching-Makefile.sh index f452e8b..de32028 100755 --- a/patching-Makefile.sh +++ b/patching-Makefile.sh @@ -10,10 +10,24 @@ if [ ! -e $_MAIN_FILE_TO_PATCH ];then fi # Insert Directory of Cloned Repo read -p "onvm-snort cloned at [$(realpath `pwd`/..)] (example: /home/user): " _DIR || exit 10 +if [ -z "_DIR" ] +then + _DIR=$HOME +fi _DIR=${_DIR:-$(realpath `pwd`/..)}/onvm-snort/ + read -p "Snort will install to [/usr/local/] (example: /opt/snort): " _SNORT_INSTALL || exit 10 +if [ -z "$_SNORT_INSTALL" ] +then + _SNORT_INSTALL=/opt/snort +fi _SNORT_INSTALL=${_SNORT_INSTALL:-/usr/local/} + read -p "DAQ Install PATH [Using System as Default] (example: /opt/daq): " _DAQ_INSTALL || exit 10 +if [ -z "$_DAQ_INSTALL" ] +then + _DAQ_INSTALL=/opt/daq +fi _DAQ_INSTALL=${_DAQ_INSTALL:- } # Create patched file diff --git a/setenv.sh b/setenv.sh new file mode 100755 index 0000000..72ad949 --- /dev/null +++ b/setenv.sh @@ -0,0 +1,86 @@ +ls | grep setenv.sh +ANS=`echo $?` +if [ $ANS == 1 ] +then + echo please run this script in situ + exit +fi + +sudo apt-get install realpath + +# Base directory +BASE_DIR=$(pwd) + +grep RTE_TARGET ~/.bashrc +ANS=`echo $?` +if [ $ANS == 1 ] +then + echo export RTE_TARGET=x86_64-native-linuxapp-gcc >> ~/.bashrc +fi + +grep DPDK_TARGET ~/.bashrc +ANS=`echo $?` +if [ $ANS == 1 ] +then + echo export DPDK_TARGET=x86_64-native-linuxapp-gcc >> ~/.bashrc +fi + +cd $BASE_DIR/dpdk* +grep RTE_SDK ~/.bashrc +ANS=`echo $?` +if [ $ANS == 1 ] +then + echo export RTE_SDK=$(pwd) >> ~/.bashrc +fi + +cd $BASE_DIR/openNetVM* +grep ONVM_HOME ~/.bashrc +ANS=`echo $?` +if [ $ANS == 1 ] +then + echo export ONVM_HOME=$(pwd) >> ~/.bashrc +fi + +cd $BASE_DIR +ls | grep Makefile.patched +ANS=`echo $?` +if [ $ANS == 0 ] +then + read -p "Do you want to create the snort Makefile again? (y/N): " ANS +else + ANS='y' +fi + +if [ "$ANS" == "y" ] +then + ./patching-Makefile.sh + cp ./Makefile.patched $BASE_DIR/snort*/src/ +fi + +grep "/opt/snort" ~/.bashrc +ANS=`echo $?` +if [ $ANS == 0 ] +then + echo export PATH=$PATH:/opt/snort/bin >> ~/.bashrc +fi + +grep ONVM_NUM_HUGEPAGES ~/.bashrc +ANS=`echo $?` +if [ $ANS == 1 ] +then + echo export ONVM_NUM_HUGEPAGES=1024 >> ~/.bashrc +fi + +echo using nics 06:00.0 and 06:00.1 +grep ONVM_NIC_PCI ~/.bashrc +ANS=`echo $?` +if [ $ANS == 1 ] +then + echo 'export ONVM_NIC_PCI=" 06:00.0 06:00.1 "' >> ~/.bashrc +fi + +source ~/.bashrc + +sudo sh -c "echo 0 > /proc/sys/kernel/randomize_va_space" + +cd $BASE_DIR From 6348eba13dc8dc42735c982241661475c89127f9 Mon Sep 17 00:00:00 2001 From: ratnadeepb Date: Fri, 1 Mar 2019 11:37:32 -0600 Subject: [PATCH 07/13] automating snort install patching-Makefile.sh has been modified to accept default values. This file is now called from inside setenv.sh. setenv.sh sets up all initial enviornment variables assuming defaults. The variables in this file can be changed if defaults are not used. The setenv.sh script is run from inside install.sh. This script essentially, sets up all environment variables, installs all packages and builds all the tools. --- install.sh | 38 ++++++++++++++++++++++++++++++++++++++ patching-Makefile.sh | 38 +++++++++++++++++++++++++++++++++++++- setenv.sh | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 4c6d2ce..b35cdba 100755 --- a/install.sh +++ b/install.sh @@ -1,3 +1,41 @@ +#! /bin/bash + +# openNetVM +# https://sdnfv.github.io +# +# OpenNetVM is distributed under the following BSD LICENSE: +# +# Copyright(c) +# 2015-2016 George Washington University +# 2015-2016 University of California Riverside +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ls | grep setenv.sh ANS=`echo $?` if [ $ANS == 1 ] diff --git a/patching-Makefile.sh b/patching-Makefile.sh index de32028..740ba31 100755 --- a/patching-Makefile.sh +++ b/patching-Makefile.sh @@ -1,4 +1,40 @@ -#!/bin/bash +#! /bin/bash + +# openNetVM +# https://sdnfv.github.io +# +# OpenNetVM is distributed under the following BSD LICENSE: +# +# Copyright(c) +# 2015-2016 George Washington University +# 2015-2016 University of California Riverside +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. _PATCH_FILE_NAME=Makefile.patched _MAIN_FILE_TO_PATCH=Makefile.dpdk diff --git a/setenv.sh b/setenv.sh index 72ad949..32f9881 100755 --- a/setenv.sh +++ b/setenv.sh @@ -1,3 +1,41 @@ +#! /bin/bash + +# openNetVM +# https://sdnfv.github.io +# +# OpenNetVM is distributed under the following BSD LICENSE: +# +# Copyright(c) +# 2015-2016 George Washington University +# 2015-2016 University of California Riverside +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ls | grep setenv.sh ANS=`echo $?` if [ $ANS == 1 ] From 8592ee6683322302822c5ee009ef8b49809706ce Mon Sep 17 00:00:00 2001 From: ratnadeepb Date: Fri, 1 Mar 2019 12:41:44 -0600 Subject: [PATCH 08/13] Corrections to automation --- install.sh | 6 ++++-- openNetVM-dev/scripts/install.sh | 12 ++++++------ setenv.sh | 8 ++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index b35cdba..6e8a267 100755 --- a/install.sh +++ b/install.sh @@ -52,11 +52,11 @@ BASE_DIR=$(pwd) # update sudo apt-get update +cd $RTE_SDK +make config T=x86_64-native-linuxapp-gcc O=x86_64-native-linuxapp-gcc make -j7 T=$RTE_TARGET O=$RTE_TARGET sudo make install T=x86_64-native-linuxapp-gcc -cd onvm && make - # Compile DAQ sudo apt-get install -y libpcap-dev libpcre3-dev libdumbnet-dev zlib1g-dev liblzma-dev libssl-dev autoconf @@ -79,6 +79,7 @@ cd $BASE_DIR/snort* cd snort*/src make clean +cp ../../Makefile.patched Makefile make -j7 sudo make install @@ -89,5 +90,6 @@ sudo mkdir /usr/local/lib/snort_dynamicrules cd $ONVM_HOME scripts/install.sh +cd onvm && make cd $BASE_DIR diff --git a/openNetVM-dev/scripts/install.sh b/openNetVM-dev/scripts/install.sh index 9bf3bc4..122ed1d 100755 --- a/openNetVM-dev/scripts/install.sh +++ b/openNetVM-dev/scripts/install.sh @@ -78,12 +78,12 @@ fi start_dir=$(pwd) # Compile dpdk -cd $RTE_SDK -echo "Compiling and installing dpdk in $RTE_SDK" -sleep 1 -make config T=$RTE_TARGET -make T=$RTE_TARGET -j 8 -make install T=$RTE_TARGET -j 8 +#cd $RTE_SDK +#echo "Compiling and installing dpdk in $RTE_SDK" +#sleep 1 +#make config T=$RTE_TARGET +#make T=$RTE_TARGET -j 8 +#make install T=$RTE_TARGET -j 8 # Refresh sudo sudo -v diff --git a/setenv.sh b/setenv.sh index 32f9881..2a8d8ad 100755 --- a/setenv.sh +++ b/setenv.sh @@ -109,6 +109,14 @@ then echo export ONVM_NUM_HUGEPAGES=1024 >> ~/.bashrc fi +# don't add to fstan if already added +grep "/mnt/fstab" /etc/fstab +ANS=`echo $?` +if [ $ANS == 0 ] +then + export ONVM_SKIP_FSTAB=1 +fi + echo using nics 06:00.0 and 06:00.1 grep ONVM_NIC_PCI ~/.bashrc ANS=`echo $?` From f38785f5e9a1236b8be667958e46e9c46e4e3a2b Mon Sep 17 00:00:00 2001 From: ratnadeepb Date: Sat, 2 Mar 2019 16:44:29 -0600 Subject: [PATCH 09/13] updating install scripts --- install.sh | 1 + setenv.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 6e8a267..b5fac6c 100755 --- a/install.sh +++ b/install.sh @@ -45,6 +45,7 @@ then fi ./setenv.sh +source ~/.bashrc # Base directory BASE_DIR=$(pwd) diff --git a/setenv.sh b/setenv.sh index 2a8d8ad..71496d7 100755 --- a/setenv.sh +++ b/setenv.sh @@ -110,7 +110,7 @@ then fi # don't add to fstan if already added -grep "/mnt/fstab" /etc/fstab +grep "/mnt/huge" /etc/fstab ANS=`echo $?` if [ $ANS == 0 ] then From 862200b5a65c6c8457ae1ca8c25c7680d7c15caf Mon Sep 17 00:00:00 2001 From: ratnadeepb Date: Sat, 2 Mar 2019 18:30:58 -0600 Subject: [PATCH 10/13] update setenv --- setenv.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setenv.sh b/setenv.sh index 71496d7..2133a85 100755 --- a/setenv.sh +++ b/setenv.sh @@ -63,7 +63,7 @@ then echo export DPDK_TARGET=x86_64-native-linuxapp-gcc >> ~/.bashrc fi -cd $BASE_DIR/dpdk* +cd $BASE_DIR/dpdk*/config grep RTE_SDK ~/.bashrc ANS=`echo $?` if [ $ANS == 1 ] From 703316fb870739ef607b39bab2b494d4b0266c5e Mon Sep 17 00:00:00 2001 From: ratnadeepb Date: Sun, 3 Mar 2019 15:51:29 -0600 Subject: [PATCH 11/13] reverting a few things --- patching-Makefile.sh | 24 ++++++++++++------------ setenv.sh | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/patching-Makefile.sh b/patching-Makefile.sh index 740ba31..3e6e46a 100755 --- a/patching-Makefile.sh +++ b/patching-Makefile.sh @@ -46,24 +46,24 @@ if [ ! -e $_MAIN_FILE_TO_PATCH ];then fi # Insert Directory of Cloned Repo read -p "onvm-snort cloned at [$(realpath `pwd`/..)] (example: /home/user): " _DIR || exit 10 -if [ -z "_DIR" ] -then - _DIR=$HOME -fi +#if [ -z "_DIR" ] +#then +# _DIR=$HOME +#fi _DIR=${_DIR:-$(realpath `pwd`/..)}/onvm-snort/ read -p "Snort will install to [/usr/local/] (example: /opt/snort): " _SNORT_INSTALL || exit 10 -if [ -z "$_SNORT_INSTALL" ] -then - _SNORT_INSTALL=/opt/snort -fi +#if [ -z "$_SNORT_INSTALL" ] +#then +# _SNORT_INSTALL=/opt/snort +#fi _SNORT_INSTALL=${_SNORT_INSTALL:-/usr/local/} read -p "DAQ Install PATH [Using System as Default] (example: /opt/daq): " _DAQ_INSTALL || exit 10 -if [ -z "$_DAQ_INSTALL" ] -then - _DAQ_INSTALL=/opt/daq -fi +#if [ -z "$_DAQ_INSTALL" ] +#then +# _DAQ_INSTALL=/opt/daq +#fi _DAQ_INSTALL=${_DAQ_INSTALL:- } # Create patched file diff --git a/setenv.sh b/setenv.sh index 2133a85..71496d7 100755 --- a/setenv.sh +++ b/setenv.sh @@ -63,7 +63,7 @@ then echo export DPDK_TARGET=x86_64-native-linuxapp-gcc >> ~/.bashrc fi -cd $BASE_DIR/dpdk*/config +cd $BASE_DIR/dpdk* grep RTE_SDK ~/.bashrc ANS=`echo $?` if [ $ANS == 1 ] From 7b711883c0fab46b7d2ef9aa283bce186c7a34f7 Mon Sep 17 00:00:00 2001 From: deep83 Date: Sun, 3 Mar 2019 17:50:35 -0600 Subject: [PATCH 12/13] changing hardcoded locations --- daq-2.0.6/Makefile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/daq-2.0.6/Makefile b/daq-2.0.6/Makefile index eb3db68..0d6d17e 100644 --- a/daq-2.0.6/Makefile +++ b/daq-2.0.6/Makefile @@ -195,19 +195,19 @@ distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print -ACLOCAL = ${SHELL} /users/graceliu/git/onvm-snort/daq-2.0.6/missing aclocal-1.14 +ACLOCAL = ${SHELL} ${HOME}/onvm-snort/daq-2.0.6/missing aclocal-1.14 AMTAR = $${TAR-tar} AM_DEFAULT_VERBOSITY = 1 AR = ar -AUTOCONF = ${SHELL} /users/graceliu/git/onvm-snort/daq-2.0.6/missing autoconf -AUTOHEADER = ${SHELL} /users/graceliu/git/onvm-snort/daq-2.0.6/missing autoheader -AUTOMAKE = ${SHELL} /users/graceliu/git/onvm-snort/daq-2.0.6/missing automake-1.14 +AUTOCONF = ${SHELL} ${HOME}/onvm-snort/daq-2.0.6/missing autoconf +AUTOHEADER = ${SHELL} ${HOME}/onvm-snort/daq-2.0.6/missing autoheader +AUTOMAKE = ${SHELL} ${HOME}/onvm-snort/daq-2.0.6/missing automake-1.14 AWK = mawk CC = gcc CCDEPMODE = depmode=gcc3 CFLAGS = -g -O2 -fvisibility=hidden -Wall -Wwrite-strings -Wsign-compare -Wcast-align -Wextra -Wformat -Wformat-security -Wno-unused-parameter -fno-strict-aliasing -fdiagnostics-show-option -pedantic -std=c99 -D_GNU_SOURCE -std=gnu99 -Wno-pedantic -std=gnu99 -Wno-pedantic CPP = gcc -E -CPPFLAGS = -I/usr/include -I/users/graceliu/dpdk-stable-16.11.1/x86_64-native-linuxapp-gcc/include -I/users/graceliu/openNetVM-dev/onvm/onvm_nflib -I/users/graceliu/openNetVM-dev/onvm/shared +CPPFLAGS = -I/usr/include -I${HOME}/onvm-snort/dpdk-stable-16.11.1/x86_64-native-linuxapp-gcc/include -I${HOME}/onvm-snort/openNetVM-dev/onvm/onvm_nflib -I${HOME}/onvm-snort/openNetVM-dev/onvm/shared CYGPATH_W = echo DEFS = -DHAVE_CONFIG_H DEPDIR = .deps @@ -237,7 +237,7 @@ LIPO = LN_S = ln -s LTLIBOBJS = LT_SYS_LIBRARY_PATH = -MAKEINFO = ${SHELL} /users/graceliu/git/onvm-snort/daq-2.0.6/missing makeinfo +MAKEINFO = ${SHELL} ${HOME}/onvm-snort/daq-2.0.6/missing makeinfo MANIFEST_TOOL = : MKDIR_P = /bin/mkdir -p NM = /usr/bin/nm -B @@ -258,16 +258,16 @@ RANLIB = ranlib SED = /bin/sed SET_MAKE = SHELL = /bin/bash -STATIC_LIBS = -lsfbpf -lsfbpf -L/users/graceliu/dpdk-stable-16.11.1/x86_64-native-linuxapp-gcc/lib -ldpdk -lpthread -lsfbpf -L/users/graceliu/openNetVM-dev/onvm/onvm_nflib/onvm_nflib/x86_64-native-linuxapp-gcc/ -lonvm -L/users/graceliu/dpdk-stable-16.11.1/x86_64-native-linuxapp-gcc/lib -ldpdk -lpthread -lpcap -lsfbpf -lpcap +STATIC_LIBS = -lsfbpf -lsfbpf -L${HOME}/onvm-snort/dpdk-stable-16.11.1/x86_64-native-linuxapp-gcc/lib -ldpdk -lpthread -lsfbpf -L${HOME}/onvm-snort/openNetVM-dev/onvm/onvm_nflib/onvm_nflib/x86_64-native-linuxapp-gcc/ -lonvm -L${HOME}/onvm-snort/dpdk-stable-16.11.1/x86_64-native-linuxapp-gcc/lib -ldpdk -lpthread -lpcap -lsfbpf -lpcap STRIP = strip VERSION = 2.0.6 V_LEX = flex -Psfbpf_ V_YACC = bison -y -p sfbpf_ XCCFLAGS = -abs_builddir = /users/graceliu/git/onvm-snort/daq-2.0.6 -abs_srcdir = /users/graceliu/git/onvm-snort/daq-2.0.6 -abs_top_builddir = /users/graceliu/git/onvm-snort/daq-2.0.6 -abs_top_srcdir = /users/graceliu/git/onvm-snort/daq-2.0.6 +abs_builddir = ${HOME}/onvm-snort/daq-2.0.6 +abs_srcdir = ${HOME}/onvm-snort/daq-2.0.6 +abs_top_builddir = ${HOME}/onvm-snort/daq-2.0.6 +abs_top_srcdir = ${HOME}/onvm-snort/daq-2.0.6 ac_ct_AR = ar ac_ct_CC = gcc ac_ct_DUMPBIN = @@ -296,7 +296,7 @@ host_vendor = unknown htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info -install_sh = ${SHELL} /users/graceliu/git/onvm-snort/daq-2.0.6/install-sh +install_sh = ${SHELL} ${HOME}/onvm-snort/daq-2.0.6/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localedir = ${datarootdir}/locale From c90d1f8ba85021d78c727ccfc57bb678152b44c0 Mon Sep 17 00:00:00 2001 From: deep83 Date: Sat, 9 Mar 2019 10:53:31 -0600 Subject: [PATCH 13/13] print number of packets --- daq-2.0.6/os-daq-modules/daq_netvm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/daq-2.0.6/os-daq-modules/daq_netvm.c b/daq-2.0.6/os-daq-modules/daq_netvm.c index c96100e..4d9235b 100644 --- a/daq-2.0.6/os-daq-modules/daq_netvm.c +++ b/daq-2.0.6/os-daq-modules/daq_netvm.c @@ -413,6 +413,7 @@ static int netvm_daq_acquire(void *handle, int cnt, DAQ_Analysis_Func_t callback printf("CPU Time: %f\n", cpu_time); printf("PPS: %f\n", pps); + printf("nb_pkts: %" PRIu16 "\n"); /* Give returned burst of packets back to NetVM manager. */ if (unlikely(tx_batch_size > 0 && rte_ring_enqueue_bulk(netvmc->tx_ring, pktsTX, tx_batch_size) == -ENOBUFS)) {