Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
robbietu authored Sep 16, 2021
2 parents 1935c45 + 4638e95 commit 058da54
Show file tree
Hide file tree
Showing 101 changed files with 7,686 additions and 127 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CMake

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

16 changes: 16 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Greetings

on: [pull_request, issues]

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Message that will be displayed on users first issue'
pr-message: 'Message that will be displayed on users first pull request'
76 changes: 71 additions & 5 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ yum groupinstall "Development Tools"
yum -y install cmake
# install more required libraries
yum -y install libpcap-devel boost-devel boost-static

# build and install libzmq
wget https://github.com/zeromq/libzmq/archive/v4.3.2.zip
unzip v4.3.2.zip
cd /path/to/unziped/dir
mkdir build && cd build
cmake ..
sudo make -j4 install

# build and install cppzmq
wget https://github.com/zeromq/cppzmq/archive/v4.6.0.zip
unzip v4.6.0.zip
cd /path/to/unziped/dir
mkdir build && cd build
cmake -DCPPZMQ_BUILD_TESTS=OFF ..
sudo make -j4 install
```

2. Clone or download the project.
Expand Down Expand Up @@ -63,6 +79,22 @@ apt-get -y install build-essential
apt-get -y install cmake
# install more required libraries
apt-get -y install libpcap-dev libboost-all-dev

# build and install libzmq
wget https://github.com/zeromq/libzmq/archive/v4.3.2.zip
unzip v4.3.2.zip
cd /path/to/unziped/dir
mkdir build && cd build
cmake ..
sudo make -j4 install

# build and install cppzmq
wget https://github.com/zeromq/cppzmq/archive/v4.6.0.zip
unzip v4.6.0.zip
cd /path/to/unziped/dir
mkdir build && cd build
cmake -DCPPZMQ_BUILD_TESTS=OFF ..
sudo make -j4 install
```

2. Clone or download the project.
Expand Down Expand Up @@ -98,6 +130,22 @@ tar --bzip2 -xf boost_1_54_0.tar.bz2
cd boost_1_54_0/
./bootstrap.sh
./b2 install stage

# build and install libzmq
wget https://github.com/zeromq/libzmq/archive/v4.3.2.zip
unzip v4.3.2.zip
cd /path/to/unziped/dir
mkdir build && cd build
cmake ..
sudo make -j4 install

# build and install cppzmq
wget https://github.com/zeromq/cppzmq/archive/v4.6.0.zip
unzip v4.6.0.zip
cd /path/to/unziped/dir
mkdir build && cd build
cmake -DCPPZMQ_BUILD_TESTS=OFF ..
sudo make -j4 install
```

2. Clone or download the project.
Expand Down Expand Up @@ -129,23 +177,41 @@ make install
ls /usr/local/lib/libpcap*
```

2. *Recommended*: install [brew](https://brew.sh/) for easier package management.

3. *Recommended*: install [brew](https://brew.sh/) for easier package management.
```shell
# install boost
brew install boost
```

2. Clone or download the project.
3. Build the project.
4. build and install libzmq and cppzmq
```shell
# build and install libzmq
wget https://github.com/zeromq/libzmq/archive/v4.3.2.zip
unzip v4.3.2.zip
cd /path/to/unziped/dir
mkdir build && cd build
cmake ..
sudo make -j4 install

# build and install cppzmq
wget https://github.com/zeromq/cppzmq/archive/v4.6.0.zip
unzip v4.6.0.zip
cd /path/to/unziped/dir
mkdir build && cd build
cmake -DCPPZMQ_BUILD_TESTS=OFF ..
sudo make -j4 install
```
5. Clone or download the project.

6. Build the project.

```shell
cd /path/to/packet-agent
mkdir build && cd build
cmake .. && make
```

4. Ensure the build is successful. The *bin* folder should contain four binary files.
7. Ensure the build is successful. The *bin* folder should contain four binary files.

```shell
ls ../bin
Expand Down
27 changes: 27 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@

The list of the most significant changes made in Netis Packet Agent over time.

## Netis Packet Agent 0.5.2
### Features
* Supprot vlan packets

## Netis Packet Agent 0.5.1
### Features
* Supprot packet forword by vxlan

## Netis Packet Agent 0.5.0

### Features
* Support GRE direction in key.


## Netis Packet Agent 0.3.6

### Features
* Support agent control plane for agent daemon over zeromq.


## Netis Packet Agent 0.3.5

### Features
* Support option check for '--nofilter' option invalid usage. In version 0.3.5 or later, pktminerg will exit directly in the following cases:
- if you enable '--nofilter' option without specifying gre bind device(-B) in online mode.
- if you enable '--nofilter' option and gre bind device(-B) is same as packet captured interface(-i) in online mode.

## Netis Packet Agent 0.3.4

### Features
Expand Down
63 changes: 48 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ option(PROJECT_WITH_PROF "Enable profiling and coverage report analysis" OFF)
message("\${PROJECT_WITH_PROF}: ${PROJECT_WITH_PROF}")
# cmake cxx flags
if (${PROJECT_WITH_PROF})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pthread -lrt -fprofile-arcs -ftest-coverage")
set(LINK_FLAGS "${LINK_FLAGS} -fprofile-arcs")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pthread -lrt")
endif ()

# set PKTMINERG_MAJOR_VERSION, PKTMINERG_MINOR_VERSION, etc.
set(PKTMINERG_MAJOR_VERSION "0")
set(PKTMINERG_MINOR_VERSION "3")
set(PKTMINERG_PATCH_VERSION "4")
set(PKTMINERG_MINOR_VERSION "5")
set(PKTMINERG_PATCH_VERSION "1")
set(PKTMINERG_VERSION_STRING "${PKTMINERG_MAJOR_VERSION}.${PKTMINERG_MINOR_VERSION}.${PKTMINERG_PATCH_VERSION}")

if(WIN32)
Expand Down Expand Up @@ -89,6 +89,8 @@ if(UNIX)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.41.0 REQUIRED COMPONENTS program_options system filesystem)

find_package(cppzmq)

message("Boost_INCLUDE_DIRS: " ${Boost_INCLUDE_DIRS})
message("Boost_LIBRARY_DIRS: " ${Boost_LIBRARY_DIRS})
# include dir
Expand Down Expand Up @@ -201,17 +203,37 @@ set(SOURCE_FILES_GREDUMP
${SOURCE_FILES_PCAP}
)

set(SOURCE_FILES_VXLANDUMP
${PROJECT_SOURCE_DIR}/tools/vxlandump.cpp
${SOURCE_FILES_PCAP}
)

set(SOURCE_FILES_PCAPCOMPARE
${PROJECT_SOURCE_DIR}/tools/pcapcompare.cpp
)

set(SOURCE_FILES_PKTMINERG_BASE
${SOURCE_FILES_SYSHELP}
${SOURCE_FILES_PCAP}
${PROJECT_SOURCE_DIR}/src/socketgre.cpp
${PROJECT_SOURCE_DIR}/src/pcaphandler.cpp
${PROJECT_SOURCE_DIR}/src/statislog.cpp
)
if(WIN32)
set(SOURCE_FILES_PKTMINERG_BASE
${SOURCE_FILES_SYSHELP}
${SOURCE_FILES_PCAP}
${PROJECT_SOURCE_DIR}/src/socketgre.cpp
${PROJECT_SOURCE_DIR}/src/socketvxlan.cpp
${PROJECT_SOURCE_DIR}/src/pcaphandler.cpp
${PROJECT_SOURCE_DIR}/src/statislog.cpp
)
else()
set(SOURCE_FILES_PKTMINERG_BASE
${SOURCE_FILES_SYSHELP}
${SOURCE_FILES_PCAP}
${PROJECT_SOURCE_DIR}/src/socketgre.cpp
${PROJECT_SOURCE_DIR}/src/socketvxlan.cpp
${PROJECT_SOURCE_DIR}/src/socketzmq.cpp
${PROJECT_SOURCE_DIR}/src/pcaphandler.cpp
${PROJECT_SOURCE_DIR}/src/statislog.cpp
${PROJECT_SOURCE_DIR}/src/agent_status.cpp
${PROJECT_SOURCE_DIR}/src/agent_control_plane.cpp
)
endif()

set(SOURCE_FILES_PKTMINERG
${SOURCE_FILES_PKTMINERG_BASE}
Expand All @@ -229,9 +251,11 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
if(UNIX)
set(PCAP_LIB pcap)
set(BOOST_LIB boost_program_options.a boost_system.a boost_filesystem.a)
set(ZMQ_LIB zmq)
else()
set(PCAP_LIB wpcap Packet)
set(SOCKET_LIB ws2_32)
set(SOCKET_LIB zmq)
set(ZMQ_LIB )
endif()

# bin -- gredemo
Expand All @@ -248,6 +272,13 @@ if(WIN32)
endif()
target_link_libraries(gredump ${BOOST_LIB} ${PCAP_LIB} ${SOCKET_LIB})

# bin --vxlandump
add_executable(vxlandump ${SOURCE_FILES_VXLANDUMP})
if (WIN32)
set_target_properties(vxlandump PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"")
endif ()
target_link_libraries(vxlandump ${BOOST_LIB} ${PCAP_LIB} ${SOCKET_LIB})

# bin -- pcapcompare
add_executable(pcapcompare ${SOURCE_FILES_PCAPCOMPARE})
target_link_libraries(pcapcompare ${BOOST_LIB} ${PCAP_LIB} ${SOCKET_LIB})
Expand All @@ -257,7 +288,7 @@ add_executable(pktminerg ${SOURCE_FILES_PKTMINERG})
if(WIN32)
set_target_properties(pktminerg PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"")
endif()
target_link_libraries(pktminerg ${BOOST_LIB} ${PCAP_LIB} ${SOCKET_LIB})
target_link_libraries(pktminerg ${BOOST_LIB} ${PCAP_LIB} ${SOCKET_LIB} ${ZMQ_LIB})

if(UNIX AND NOT APPLE)
# test
Expand All @@ -275,7 +306,7 @@ if(UNIX AND NOT APPLE)
${TEST_DIR}/src/gtest-test-part.cc
${TEST_DIR}/src/gtest-typed-test.cc)
add_executable(unittest ${SOURCE_FILES_UNITTEST} ${SOURCE_FILES_PKTMINERG_BASE})
target_link_libraries(unittest ${BOOST_LIB} pcap pthread)
target_link_libraries(unittest ${BOOST_LIB} pcap pthread ${ZMQ_LIB})
set_target_properties(unittest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/test/bin")
endif()

Expand Down Expand Up @@ -317,10 +348,12 @@ else()
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_amd64)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_SOURCE_DIR}/scripts/postinst")
else ()
set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.el6.${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.el6.${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/scripts/postinst_rpm.sh")
endif()
#set(CPACK_COMPONENTS_ALL pktminerg)
endif()
Expand Down
Loading

0 comments on commit 058da54

Please sign in to comment.