Commit 32d0067b authored by Rohan's avatar Rohan

dockerfile updated

parent 250ce616
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_helper
# brief
# author Laurent Thomas, Lionel GAUTHIER, Rohan KHARADE
#
#######################################
SUPPORTED_DISTRO="Ubuntu 18.04, Ubuntu 20.04, CentOS 7, RHEL 7"
#SUPPORTED_DISTRO="Ubuntu 18.04, Ubuntu 20.04, CentOS 7, RHEL 7"
#SUPPORTED_DISTRO="Ubuntu 18.04"
if [ ! -f /etc/os-release ]; then
echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro."
fi
OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g")
OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g")
case "$OS_DISTRO" in
fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;;
rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
esac
IS_CONTAINER=`egrep -c "docker|kubepods" /proc/self/cgroup`
if [ $IS_CONTAINER -eq 0 ]
then
SUDO='sudo -S -E'
else
SUDO=''
fi
###############################
## echo and family
###############################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[1;34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
reset_color='\E[00m'
COLORIZE=1
#-------------------------------------------------------------------------------
cecho() {
# Color-echo
# arg1 = message
# arg2 = color
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$green}
[ "$COLORIZE" = "1" ] && message="$color$message$reset_color"
echo -e "$message"
return
}
echo_error() { cecho "$*" $red ;}
echo_fatal() { cecho "$*" $red; exit -1 ;}
echo_warning() { cecho "$*" $yellow ;}
echo_success() { cecho "$*" $green ;}
echo_info() { cecho "$*" $blue ;}
#-------------------------------------------------------------------------------
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
# arg1 is a dotted (or not) version number (ex 4.10.6.56-ubunutu)
# arg2 is a dotted (or not) version number (ex 4.10.6.56-ubunutu)
# return 0 if $1 lower or equal $2, else 1
version_le() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
version_lt() {
[ "$1" = "$2" ] && return 1 || version_le $1 $2
}
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
version_ge() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | tail -n1`" ]
}
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
version_gt() {
[ "$1" = "$2" ] && return 1 || version_ge $1 $2
}
########################
# distribution helpers #
########################
#-------------------------------------------------------------------------------
# This function return a string to identify the distribution we are running
# If we can't check the distribution, it returns "Unknown"
# This function return always true as exit code by design
# Examples:
# ubuntu18.04
# debian8.5
get_distribution_release() {
if [[ ! -z "$OS_DISTRO$OS_RELEASE" ]]; then
echo -n "$OS_DISTRO$OS_RELEASE"
else
echo -n Unknown
fi
}
check_supported_distribution() {
echo_info "Detected OS release - $OS_DISTRO $OS_RELEASE"
local distribution=$(get_distribution_release)
case "$distribution" in
"ubuntu18.04") return 0 ;;
"ubuntu20.04") return 0 ;;
#"rhel7") return 0 ;;
#"centos7") return 0 ;;
esac
return 1
}
###########################
# Cleaners
###########################
#-------------------------------------------------------------------------------
clean_kernel() {
$SUDO modprobe ip_tables
$SUDO modprobe x_tables
$SUDO iptables -P INPUT ACCEPT
$SUDO iptables -F INPUT
$SUDO iptables -P OUTPUT ACCEPT
$SUDO iptables -F OUTPUT
$SUDO iptables -P FORWARD ACCEPT
$SUDO iptables -F FORWARD
$SUDO iptables -t nat -F
$SUDO iptables -t mangle -F
$SUDO iptables -t filter -F
$SUDO iptables -t raw -F
echo_info "Flushed iptables"
}
#-------------------------------------------------------------------------------
disable_ipv6() {
$SUDO sysctl -w net.ipv6.conf.all.disable_ipv6=1
}
#-------------------------------------------------------------------------------
# Compare two versions of software. Returns true if $version is greater than $req_version
# arg1 = version
# arg2 = req_version
#
function version_gt() {
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
}
###################################
# Compilers
###################################
# From https://stackoverflow.com/a/20473191
# test if a list include item
# arg1 is list, ex "item1 item2 ..."
# arg2 is item
function list_include_item {
local list="$1"
local item="$2"
if [[ $list =~ (^|[[:space:]])"$item"($|[[:space:]]) ]] ; then
# yes, list include item
result=0
else
result=1
fi
return $result
}
# arg 1 Build directory OPENAIR_DIR/build/?/build
# arg 2 Executable target name
# arg 3 Executable name (no path)
# arg 4 Verbose (1 or 0)
compilations() {
echo_info "Compilation log for $1 is here: $dlog/$2.txt"
cd $OPENAIRCN_DIR/$1/
if [ "a$4" == "a1" ]; then
set -o pipefail
{
rm -f $1
make $make_args build $4
} | tee $dlog/$2.txt
else
{
rm -f $1
make $make_args build $4
} > $dlog/$2.txt 2>&1
fi
if [ $? == 0 -a -s $1 ] ; then
echo_success "$2 compiled"
return 0
else
echo_error "$2 compilation failed"
return 1
fi
}
###################################
# make test
###################################
# arg 1 Build directory OPENAIRCN_DIR/build/?/build
# arg 2 Executable target name
# arg 3 Executable name (no path)
# arg 4 Verbose (1 or 0)
make_test() {
echo_success "unit tests start"
cd $OPENAIRCN_DIR/build/$1/build
if [ "a$4" == "a1" ]; then
{
make test ARGS="-V"
} | tee $dlog/$2_test.txt
else
{
make test
} > $dlog/$2_test.txt 2>&1
fi
echo_success "unit tests end"
}
#-------------------------------------------------------------------------------
# arg1 is package name
test_install_package() {
# usage: test_install_package package_name
if [ $# -eq 1 ]; then
dpkg -s "$1" > /dev/null 2>&1 && {
echo "$1 is installed."
} || {
echo "$1 is not installed."
$SUDO apt-get install --force-yes $1
}
fi
}
#-------------------------------------------------------------------------------
update_package_db() {
if [ ! -f /tmp/no_more_update_package_db ]; then
$SUDO $INSTALLER update
[[ $? -ne 0 ]] && return $?
touch /tmp/no_more_update_package_db
[[ $? -ne 0 ]] && return $?
else
let elapsed_time=$(expr `date +%s` - `stat -c %Y /tmp/no_more_update_package_db`)
if [ $elapsed_time -gt 3600 ]; then
$SUDO $INSTALLER update
[[ $? -ne 0 ]] && return $?
touch /tmp/no_more_update_package_db
[[ $? -ne 0 ]] && return $?
fi
fi
return 0
}
#-------------------------------------------------------------------------------
check_enable_epel_repos() {
# on Enterprise Linuxes, ensure EPEL repos are installed
# (provides: libidn2-devel, vconfig, iperf, phpMyAdmin, dkms, ...)
if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then
if rpm -q epel-release > /dev/null; then
echo "EPEL repos already present. Good."
else
echo "EPEL repos not present. Installing them."
$SUDO $INSTALLER install $OPTION https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
fi
fi
}
################################
# set_openair_env
###############################
#-------------------------------------------------------------------------------
set_openair_env(){
fullpath=`readlink -f $BASH_SOURCE`
[ -f "/.$fullpath" ] || fullpath=`readlink -f $PWD/$fullpath`
openair_path=${fullpath%/build/*}
openair_path=${openair_path%/scripts/*}
openair_path=${openair_path%/docker*}
export OPENAIRCN_DIR=$openair_path
}
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_helper.upf
# brief
# author Rohan Kharade
#
#######################################
################################
# include helper functions
################################
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
check_install_vpp_upf_deps() {
if [ $1 -gt 0 ]; then
OPTION="-y"
else
OPTION=""
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
echo "Check supported distribution"
check_supported_distribution
[[ $? -ne 0 ]] && return $?
# prevent lock on /var/lib/dpkg/lock
if [[ $OS_DISTRO == "ubuntu" ]]; then
#$SUDO systemctl mask apt-daily.service
#$SUDO systemctl mask apt-daily.timer
#$SUDO systemctl mask apt-daily-upgrade.service
#$SUDO systemctl mask apt-daily-upgrade.timer
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
fi
# Compilers, generators, ...
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
libhyperscan-dev \
wget \
make \
build-essential \
sudo \
gdb \
git"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\ # To Do this section
libhyperscan-dev \
wget \
make \
build-essential \
sudo \
gdb \
git"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install build tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
check_install_vpp_upf_source_deps
return 0
}
#-------------------------------------------------------------------------------
check_install_vpp_upf_deps() {
echo_info "Cloning fdio VPP $OPENAIRCN_DIR/"
if [ -d "$OPENAIRCN_DIR/vpp" ]; then
echo_error "clone failed : - vpp source is already present at $OPENAIRCN_DIR/... use option -w to wipe out vpp source"
fi
install_dep
}
#-------------------------------------------------------------------------------
install_dep(){
GIT_URL=https://github.com/fdio/vpp.git
GIT_BRANCH=stable/2101
pushd $OPENAIRCN_DIR/
git clone -b $GIT_BRANCH $GIT_URL
echo "APT::Get::Assume-Yes "true";" >> /etc/apt/apt.conf.d/90forceyes
echo "APT::Get::force-yes "true";" >> /etc/apt/apt.conf.d/90forceyes
cd vpp && git checkout -b downstream && make install-ext-dep
return 0
}
remove_vpp_source(){
rm -rf $OPENAIRCN_DIR/vpp/
echo_fatal "Removed vpp source $OPENAIRCN_DIR/vpp"
}
#-------------------------------------------------------------------------------
add_Travelping_upf_plugin(){
GIT_URL=https://github.com/travelping/upg-vpp.git
GIT_BRANCH=master
echo_info "Cloning Travelping UPG plugin"
pushd $OPENAIRCN_DIR/
git clone -b $GIT_BRANCH $GIT_URL
mkdir -p -- $OPENAIRCN_DIR/vpp/patches
cp -rf $OPENAIRCN_DIR/upg-vpp/upf/ $OPENAIRCN_DIR/vpp/src/plugins/
cp -rf $OPENAIRCN_DIR/upg-vpp/vpp-patches/* $OPENAIRCN_DIR/vpp/patches
rm -rf $OPENAIRCN_DIR/upg-vpp
apply_patches
}
#-------------------------------------------------------------------------------
apply_patches(){
echo_info "Applying patches to VPP UPG"
cp -r $OPENAIRCN_DIR/docker/patches/* $OPENAIRCN_DIR/vpp/patches
cd $OPENAIRCN_DIR/vpp/patches
find . -iname '*.patch' -execdir sh -c 'patch -p1 -N -d $OPENAIRCN_DIR/vpp/ < $0' {} \;
}
#-------------------------------------------------------------------------------
vpp_upf_init(){
echo_info "VPP UPG initializing"
cp $OPENAIRCN_DIR/docker/configs/startup_debug.conf $OPENAIRCN_DIR/vpp
cp $OPENAIRCN_DIR/docker/configs/run.sh $OPENAIRCN_DIR/vpp
cp $OPENAIRCN_DIR/vpp/build-root/install-vpp_debug-native/vpp/lib/ /usr/lib/x86_64-linux-gnu/vpp_plugins/
}
#!/bin/bash
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_vpp_upf
# brief
# author Rohan Kharade
# company Eurecom
# email: rohan.kaharde@openairinterface.org
#
set -o pipefail
INSTALL_DIR=/usr/local/bin
################################
# include helper functions
################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source $THIS_SCRIPT_PATH/build_helper.upf
function help()
{
echo_error " "
echo_error "Usage: build_vpp_upf [OPTION]..."
echo_error "Build the VPP executable with Travelping upf plugin."
echo_error " "
echo_error "Options:"
echo_error "Mandatory arguments to long options are mandatory for short options too."
echo_error " -b, --build-type Build type as defined in Makefile, allowed values are: Debug Release RelWithDebInfo MinSizeRel"
echo_error " -c, --clean Clean the build generated files: config, object, executable files (build from scratch)"
echo_error " -f, --force No interactive script for installation of software packages."
echo_error " -h, --help Print this help."
echo_error " -I, --install-deps Check installed software necessary to build and run VPP UPF (support $SUPPORTED_DISTRO)."
echo_error " -V, --verbose Build process verbose."
echo_error " -w, --wipe Wipe out vpp source directory."
echo_error " "
}
function main()
{
local -i clean=0
local -i force=0
local -i debug=0
local -i verbose=0
local -i wipe=0
local -i var_check_install_min_deps=0
local -i var_check_install_deps=0
local cmake_args=" "
export make_args=" "
until [ -z "$1" ]
do
case "$1" in
-a | --auto-test)
cmake_args="$cmake_args -DSGW_AUTOTEST=1"
shift;
;;
-b | --build-type)
list_include_item "Debug Release" $2
[[ $? -ne 0 ]] && echo_error "Build type $2 not recognized" && return $?
cmake_args="$cmake_args -DCMAKE_BUILD_TYPE=$2"
list_include_item "Debug" $2
[[ $? -ne 0 ]] && debug=1
shift 2;
;;
-c | --clean)
clean=1
echo "Clean the build generated files (build from scratch)"
shift;
;;
-f | --force)
force=1
echo "Force set (no interactive)"
shift;
;;
-h | --help)
help
shift;
return 0
;;
-I | --install-deps)
echo "Check installed software necessary to build and run VPP UPF (support $SUPPORTED_DISTRO):"
set_openair_env
var_check_install_deps=1
shift;
;;
-v | --verbose)
echo "Make build process verbose"
cmake_args="$cmake_args -DCMAKE_VERBOSE_MAKEFILE=ON"
make_args="VERBOSE=1 $make_args"
verbose=1
shift;
;;
-V | --Verbose)
echo "CMake build process verbose"
verbose=1
shift;
;;
-w | --wipe)
echo "Wipe out vpp source"
wipe=1
shift;
;;
*)
echo "Unknown option $1"
help
return 1
;;
esac
done
if [ ! -d /usr/local/etc/oai ]; then
$SUDO mkdir -m 777 -p /usr/local/etc/oai
fi
set_openair_env
local dlog=$OPENAIRCN_DIR/build/log
local dext=$OPENAIRCN_DIR/build/ext
mkdir -m 777 -p $dlog
mkdir -m 777 -p $dext
if [ $var_check_install_deps -gt 0 ];then
disable_ipv6
check_install_vpp_upf_deps $force $debug
if [[ $? -ne 0 ]]; then
echo_error "Error: VPP UPF deps installation failed"
return 1
else
echo_success "VPP UPF deps installation successful"
echo_warning "VPP UPF not compiled, to compile it, re-run ./build_vpp_upf without -I option"
return 0
fi
fi
cmake_args="$cmake_args -DBUILD_SHARED_LIBS=OFF"
##############################################################################
# Wipe
##############################################################################
cd $OPENAIRCN_DIR/
if [ $wipe -ne 0 ]; then
remove_vpp_source
fi
##############################################################################
# Clean
##############################################################################
cd $OPENAIRCN_DIR/
if [ $clean -ne 0 ]; then
if [[ $verbose -eq 1 ]]; then
echo_warning "Cleaning VPP_UPF: generated configuration files, obj files, executable"
fi
make wipe -C $OPENAIRCN_DIR/vpp 2>&1
fi
##############################################################################
# Compile VPP_UPF
##############################################################################
cd $OPENAIRCN_DIR/
if [ ! -d ./build ]; then
mkdir -m 777 -p -v build
fi
cd ./vpp
add_Travelping_upf_plugin
vpp_upf_init
compilations vpp vpp $OPENAIRCN_DIR/vpp $verbose
vpp_upf_init
ret=$?;[[ $ret -ne 0 ]] && return $ret
return 0
}
main "$@"
#!/bin/bash
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
function usage {
echo "OAI Coding / Formatting Guideline Check script"
echo " Original Author: Raphael Defosseux"
echo ""
echo " Requirement: clang-format / git shall be installed"
echo ""
echo " By default (no options) the complete repository will be checked"
echo " In case of merge/pull request, provided source and target branch,"
echo " the script will check only the modified files"
echo ""
echo "Usage:"
echo "------"
echo " checkCodingFormattingRules.sh [OPTIONS]"
echo ""
echo "Options:"
echo "--------"
echo " --src-branch #### OR -sb ####"
echo " Specify the source branch of the merge request."
echo ""
echo " --target-branch #### OR -tb ####"
echo " Specify the target branch of the merge request (usually develop)."
echo ""
echo " --help OR -h"
echo " Print this help message."
echo ""
}
if [ $# -ne 4 ] && [ $# -ne 1 ] && [ $# -ne 0 ]
then
echo "Syntax Error: not the correct number of arguments"
echo ""
usage
exit 1
fi
cd src
if [ $# -eq 0 ]
then
echo " ---- Checking the whole repository ----"
echo ""
if [ -f oai_rules_result.txt ]
then
rm -f oai_rules_result.txt
fi
if [ -f oai_rules_result_list.txt ]
then
rm -f oai_rules_result_list.txt
fi
EXTENSION_LIST=("h" "hpp" "c" "cpp")
NB_TO_FORMAT=0
NB_TOTAL=0
for EXTENSION in ${EXTENSION_LIST[@]}
do
echo "Checking for all files with .${EXTENSION} extension"
FILE_LIST=`tree -n --noreport -i -f -P *.${EXTENSION} | sed -e 's#^\./##' | grep "\.${EXTENSION}"`
for FILE_TO_CHECK in ${FILE_LIST[@]}
do
TO_FORMAT=`clang-format -output-replacements-xml ${FILE_TO_CHECK} 2>&1 | grep -v replacements | grep -c replacement`
NB_TOTAL=$((NB_TOTAL + 1))
if [ $TO_FORMAT -ne 0 ]
then
NB_TO_FORMAT=$((NB_TO_FORMAT + 1))
# In case of full repo, being silent
#echo "src/$FILE_TO_CHECK"
echo "src/$FILE_TO_CHECK" >> ./oai_rules_result_list.txt
fi
done
done
echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT over $NB_TOTAL checked!"
echo "NB_FILES_FAILING_CHECK=$NB_TO_FORMAT" > ./oai_rules_result.txt
echo "NB_FILES_CHECKED=$NB_TOTAL" >> ./oai_rules_result.txt
exit 0
fi
checker=0
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift
usage
exit 0
;;
-sb|--src-branch)
SOURCE_BRANCH="$2"
let "checker|=0x1"
shift
shift
;;
-tb|--target-branch)
TARGET_BRANCH="$2"
let "checker|=0x2"
shift
shift
;;
*)
echo "Syntax Error: unknown option: $key"
echo ""
usage
exit 1
esac
done
if [ $checker -ne 3 ]
then
echo "Source Branch is : $SOURCE_BRANCH"
echo "Target Branch is : $TARGET_BRANCH"
echo ""
echo "Syntax Error: missing option"
echo ""
usage
exit 1
fi
# Merge request scenario
MERGE_COMMMIT=`git log -n1 --pretty=format:%H`
if [ -f .git/refs/remotes/origin/$TARGET_BRANCH ]
then
TARGET_INIT_COMMIT=`cat .git/refs/remotes/origin/$TARGET_BRANCH`
else
TARGET_INIT_COMMIT=`git log -n1 --pretty=format:%H origin/$TARGET_BRANCH`
fi
echo " ---- Checking the modified files by the merge request ----"
echo ""
echo "Source Branch is : $SOURCE_BRANCH"
echo "Target Branch is : $TARGET_BRANCH"
echo "Merged Commit is : $MERGE_COMMMIT"
echo "Target Init is : $TARGET_INIT_COMMIT"
echo ""
echo " ----------------------------------------------------------"
echo ""
# Retrieve the list of modified files since the latest develop commit
MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-status | egrep "^M|^A" | sed -e "s@^M\t*@@" -e "s@^A\t*@@" | sort | uniq`
NB_TO_FORMAT=0
NB_TOTAL=0
if [ -f oai_rules_result.txt ]
then
rm -f oai_rules_result.txt
fi
if [ -f oai_rules_result_list.txt ]
then
rm -f oai_rules_result_list.txt
fi
for FULLFILE in $MODIFIED_FILES
do
filename=$(basename -- "$FULLFILE")
EXT="${filename##*.}"
if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ]
then
SRC_FILE=`echo $FULLFILE | sed -e "s#src/##"`
TO_FORMAT=`clang-format -output-replacements-xml ${SRC_FILE} 2>&1 | grep -v replacements | grep -c replacement`
NB_TOTAL=$((NB_TOTAL + 1))
if [ $TO_FORMAT -ne 0 ]
then
NB_TO_FORMAT=$((NB_TO_FORMAT + 1))
echo $FULLFILE
echo $FULLFILE >> ./oai_rules_result_list.txt
fi
fi
done
echo ""
echo " ----------------------------------------------------------"
echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT over $NB_TOTAL checked!"
echo "NB_FILES_FAILING_CHECK=$NB_TO_FORMAT" > ./oai_rules_result.txt
echo "NB_FILES_CHECKED=$NB_TOTAL" >> ./oai_rules_result.txt
exit 0
#!/bin/bash
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
exit -1
......@@ -9,11 +9,10 @@
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface AMF service
# Dockerfile for the Open-Air-Interface UPF service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
......@@ -22,68 +21,68 @@ FROM ubuntu:18.04 AS vpp-upf-builder
ARG NEEDED_GIT_PROXY
LABEL name="upf" \
version="u18" \
description="Image for travelping upf based on VPP"
# Installing hyperscan library for upf plugin
RUN apt update && apt install git sudo wget make build-essential -y
RUN wget http://archive.ubuntu.com/ubuntu/pool/universe/h/hyperscan/libhyperscan4_4.7.0-1_amd64.deb \
http://archive.ubuntu.com/ubuntu/pool/universe/h/hyperscan/libhyperscan-dev_4.7.0-1_amd64.deb
RUN dpkg -i *.deb
RUN apt update && apt install git sudo wget make build-essential libhyperscan-dev -y
# Some GIT configuration commands quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# Installing and configuring vpp
RUN git clone -b downstream https://github.com/travelping/vpp.git upf
COPY docker/patches patches/
RUN patch -p1 -d upf < patches/werror_disable.patch
RUN git clone https://github.com/travelping/upg-vpp.git
RUN mv upg-vpp/upf/ upf/src/plugins/
RUN patch -p1 -d upf < patches/0008-Follow-symlinks-while-checking-timestamps-during-bui.patch
RUN patch -p1 -d upf < patches/0008-vlib-decrement-counters.patch
RUN patch -p1 -d upf < patches/0009-sparse-vector-fix-leak.patch
WORKDIR /vpp-upf
COPY scripts/ /vpp-upf/scripts
RUN rm *.deb -r upg-vpp/
# Applying vpp patches
RUN git clone -b stable/2101 https://github.com/fdio/vpp.git && cd vpp/ && git checkout -b downstream
RUN git clone https://github.com/travelping/upg-vpp.git
RUN mv upg-vpp/upf/ vpp/src/plugins/
RUN mv upg-vpp/vpp-patches/* scripts/patches/
RUN mv upg-vpp/vpp.spec /
RUN ./scripts/apply_vpp_patches
RUN touch /etc/apt/apt.conf.d/90forceyes
RUN echo "APT::Get::Assume-Yes "true";" >> /etc/apt/apt.conf.d/90forceyes
RUN echo "APT::Get::force-yes "true";" >> /etc/apt/apt.conf.d/90forceyes
RUN make install-dep build -C upf/
RUN make install-ext-dep build -C upf/
# To Do - remove unnecessary pulgin build to optimise build time e.g. ipsec, dpdk etc.
# Build vpp with travelping upf plugin
RUN make install-dep build-release -C vpp
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as vpp_upg
FROM ubuntu:bionic as vpp-upg
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV TZ=Europe/Paris
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
net-tools \
tshark \
tzdata\
openssl \
libhyperscan-dev \
iproute2 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /openair-upf/bin/
COPY --from=vpp-upf-builder /upf/build-root/install-vpp_debug-native/vpp/bin/vpp .
COPY --from=vpp-upf-builder /upf/build-root/install-vpp_debug-native/vpp/bin/vppctl .
COPY docker/configs .
COPY --from=vpp-upf-builder /vpp-upf/scripts/entrypoint.sh /openair-upf/bin/entrypoint.sh
COPY --from=vpp-upf-builder /vpp-upf/scripts/run.sh /openair-upf/run.sh
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vpp vpp
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/bin/vppctl vppctl
WORKDIR /openair-upf/scripts
COPY docker/scripts .
WORKDIR /openair-upf/etc
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/init.conf /openair-upf/etc/init.conf
COPY --from=vpp-upf-builder /vpp-upf/scripts/upf_conf/startup_debug.conf /openair-upf/etc/startup_debug.conf
COPY --from=vpp-upf-builder /vpp-upf/scripts/add_route.sh /openair-upf/etc/add_route.sh
WORKDIR /usr/lib/x86_64-linux-gnu/
COPY --from=vpp-upf-builder /upf/build-root/install-vpp_debug-native/vpp/lib/ .
COPY --from=vpp-upf-builder /vpp-upf/vpp/build-root/install-vpp-native/vpp/lib/ .
RUN ldconfig
RUN groupadd vpp
WORKDIR /openair-upf/bin
#expose
#EXPOSE <write the port numbers>
WORKDIR /openair-upf/
ENTRYPOINT ["/openair-upf/bin/entrypoint.sh"]
CMD ["/openair-upf/run.sh"]
ip table add 1
ip table add 2
create host-interface name sgi
set interface mac address host-sgi 00:0c:29:46:1f:53
set interface mtu 1500 host-sgi
set interface ip table host-sgi 1
set interface ip address host-sgi 192.168.64.201/26
set interface state host-sgi up
create host-interface name core
set interface mac address host-core 00:0c:29:46:1f:54
set interface mtu 1500 host-core
set interface ip table host-core 0
set interface ip address host-core 192.168.63.201/26
set interface state host-core up
create host-interface name access
set interface mac address host-access 00:0c:29:46:1f:55
set interface mtu 1500 host-access
set interface ip table host-access 2
set interface ip address host-access 192.168.62.201/26
set interface state host-access up
ip route add 0.0.0.0/0 table 2 via 192.168.62.210 host-access
ip route add 0.0.0.0/0 table 0 via 192.168.63.196 host-core
ip route add 0.0.0.0/0 table 1 via 192.168.64.194 host-sgi
upf pfcp endpoint ip 192.168.63.201 vrf 0
upf nwi name core vrf 0
upf nwi name access vrf 2
upf nwi name sgi vrf 1
upf node-id ip4 192.168.63.201
upf specification release 16
trace add af-packet-input 100
upf gtpu endpoint ip 192.168.62.201 nwi access teid 0x000004d2/2
unix {
nodaemon
log /tmp/vpp.log
full-coredump
gid vpp
interactive
cli-listen localhost:5002
exec init.conf
}
api-trace {
on
}
api-segment {
gid vpp
}
plugins {
path /usr/lib/x86_64-linux-gnu/vpp_plugins/
plugin dpdk_plugin.so { disable }
plugin gtpu_plugin.so { disable }
plugin upf_plugin.so { enable }
}
From d9fa03eb175bde1066f8c14249d8bb487d8800e4 Mon Sep 17 00:00:00 2001
From: Andreas Schultz <andreas.schultz@travelping.com>
Date: Mon, 16 Mar 2020 17:00:29 +0100
Subject: [PATCH 1/7] CI and build infrastructure adjustments
---
Makefile | 5 +++++
build/external/Makefile | 2 +-
build/external/packages/dpdk.mk | 4 ++--
src/pkg/debian/control.in | 6 ++++--
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index cf4cfadec..a2eab953a 100644
--- a/Makefile
+++ b/Makefile
@@ -67,9 +67,12 @@ DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
DEB_DEPENDS += lcov chrpath autoconf indent clang-format libnuma-dev
DEB_DEPENDS += python3-all python3-setuptools check
DEB_DEPENDS += libboost-all-dev libffi-dev python3-ply libmbedtls-dev
+DEB_DEPENDS += liburcu-dev
DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
+DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml yamllint
DEB_DEPENDS += python3-venv # ensurepip
DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil
+DEB_DEPENDS += libhyperscan-dev
# python3.6 on 16.04 requires python36-dev
LIBFFI=libffi6 # works on all but 20.04
@@ -141,6 +144,7 @@ endif
# +ganglia-devel if building the ganglia plugin
+RPM_DEPENDS += hyperscan-devel
RPM_DEPENDS += chrpath libffi-devel rpm-build
RPM_DEPENDS_DEBUG = glibc-debuginfo e2fsprogs-debuginfo
@@ -155,6 +159,7 @@ RPM_SUSE_BUILDTOOLS_DEPS += clang cmake indent libtool make ninja python3-ply
RPM_SUSE_DEVEL_DEPS = glibc-devel-static libnuma-devel
RPM_SUSE_DEVEL_DEPS += libopenssl-devel openssl-devel mbedtls-devel libuuid-devel
+RPM_SUSE_DEVEL_DEPS += hyperscan-devel
RPM_SUSE_PYTHON_DEPS = python-devel python3-devel python-pip python3-pip
RPM_SUSE_PYTHON_DEPS += python-rpm-macros python3-rpm-macros
diff --git a/build/external/Makefile b/build/external/Makefile
index b0e3cee4f..c2d94e5bd 100644
--- a/build/external/Makefile
+++ b/build/external/Makefile
@@ -20,7 +20,7 @@ MAKE_ARGS ?= -j
BUILD_DIR ?= $(CURDIR)/_build
INSTALL_DIR ?= $(CURDIR)/_install
PKG_VERSION ?= $(shell git describe --abbrev=0 | cut -d- -f1 | cut -dv -f2 | cut -d. -f1,2)
-PKG_SUFFIX ?= $(shell git log --oneline v$(PKG_VERSION)-rc0.. . | wc -l)
+PKG_SUFFIX ?= $(shell git log --oneline v$(PKG_VERSION)-rc0.. -- . | wc -l)
JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
$(shell grep -c ^processor /proc/cpuinfo), 2)
diff --git a/build/external/packages/dpdk.mk b/build/external/packages/dpdk.mk
index beabf48e9..99a5d9f14 100644
--- a/build/external/packages/dpdk.mk
+++ b/build/external/packages/dpdk.mk
@@ -202,11 +202,12 @@ $(B)/custom-config: $(B)/.dpdk-patch.ok Makefile
$(call set,RTE_LIBRTE_PMD_TAP,$(DPDK_TAP_PMD))
$(call set,RTE_LIBRTE_GSO,$(DPDK_TAP_PMD))
$(call set,RTE_LIBRTE_PMD_FAILSAFE,$(DPDK_FAILSAFE_PMD))
+ @# required for UPF
+ $(call set,RTE_LIBRTE_ACL,y)
@# not needed
$(call set,RTE_ETHDEV_RXTX_CALLBACKS,n)
$(call set,RTE_LIBRTE_CFGFILE,n)
$(call set,RTE_LIBRTE_LPM,n)
- $(call set,RTE_LIBRTE_ACL,n)
$(call set,RTE_LIBRTE_JOBSTATS,n)
$(call set,RTE_LIBRTE_EFD,n)
$(call set,RTE_LIBRTE_MEMBER,n)
@@ -219,7 +220,6 @@ $(B)/custom-config: $(B)/.dpdk-patch.ok Makefile
$(call set,RTE_LIBRTE_PIPELINE,n)
$(call set,RTE_LIBRTE_PMD_SOFTNIC,n)
$(call set,RTE_LIBRTE_FLOW_CLASSIFY,n)
- $(call set,RTE_LIBRTE_ACL,n)
$(call set,RTE_LIBRTE_GRO,n)
$(call set,RTE_LIBRTE_KNI,n)
$(call set,RTE_LIBRTE_BPF,n)
diff --git a/src/pkg/debian/control.in b/src/pkg/debian/control.in
index 0b0c621e5..2addf900e 100644
--- a/src/pkg/debian/control.in
+++ b/src/pkg/debian/control.in
@@ -51,7 +51,8 @@ Description: Vector Packet Processing--runtime libraries
Package: vpp-plugin-core
Architecture: any
Depends: vpp (= ${source:Version}),
- ${shlibs:Depends}
+ ${shlibs:Depends},
+ ${misc:Depends}
Description: Vector Packet Processing--runtime core plugins
This package contains VPP core plugins
.
@@ -59,7 +60,8 @@ Description: Vector Packet Processing--runtime core plugins
Package: vpp-plugin-dpdk
Architecture: any
Depends: vpp (= ${source:Version}),
- ${shlibs:Depends}
+ ${shlibs:Depends},
+ ${misc:Depends}
Description: Vector Packet Processing--runtime dpdk plugin
This package contains the VPP dpdk plugin
.
--
2.28.0
--- a/src/plugins/upf/upf_pfcp_api.c 2020-12-18 15:41:33.250549473 +0000
+++ b/src/plugins/upf/upf_pfcp_api.c 2020-12-18 15:49:12.653515878 +0000
@@ -286,8 +286,11 @@
SET_BIT (resp.grp.fields, ASSOCIATION_SETUP_RESPONSE_RECOVERY_TIME_STAMP);
resp.recovery_time_stamp = psm->start_time;
- SET_BIT (resp.grp.fields, ASSOCIATION_SETUP_RESPONSE_TP_BUILD_ID);
- vec_add (resp.tp_build_id, vpe_version_string, strlen (vpe_version_string));
+ // SET_BIT (resp.grp.fields, ASSOCIATION_SETUP_RESPONSE_TP_BUILD_ID);
+ // vec_add (resp.tp_build_id, vpe_version_string, strlen (vpe_version_string));
+
+ SET_BIT (resp.grp.fields, ASSOCIATION_SETUP_RESPONSE_NODE_ID);
+ resp.response.node_id.ip = req->lcl.address;
n = pfcp_get_association (&msg->request.node_id);
if (n)
@@ -571,15 +574,52 @@
#define OPT(MSG,FIELD,VALUE,DEFAULT) \
((ISSET_BIT((MSG)->grp.fields, (FIELD))) ? MSG->VALUE : (DEFAULT))
+/**
+ * Translate "foo.com" into "0x3 f o o 0x3 c o m 0x0"
+ * A historical / hysterical micro-TLV scheme. DGMS.
+ */
+static u8 *
+upf_nwi_name_to_labels (u8 * name)
+{
+ int i;
+ int last_label_index;
+ u8 *rv;
+
+ rv = vec_dup (name);
+
+ /* punch in space for the first length */
+ vec_insert (rv, 1, 0);
+ last_label_index = 0;
+ i = 1;
+
+ while (i < vec_len (rv))
+ {
+ if (rv[i] == '.')
+ {
+ rv[last_label_index] = (i - last_label_index) - 1;
+ if ((i - last_label_index) > 63)
+ clib_warning ("stupid name, label length %d",
+ i - last_label_index);
+ last_label_index = i;
+ rv[i] = 0;
+ }
+ i++;
+ }
+ /* Set the last real label length */
+ rv[last_label_index] = (i - last_label_index) - 1;
+
+ return rv;
+}
static upf_nwi_t *
lookup_nwi (u8 * name)
{
upf_main_t *gtm = &upf_main;
uword *p;
-
+
assert (name);
+ name = upf_nwi_name_to_labels(name);
if (pool_elts (gtm->nwis) == 0)
From 3daf9fc66400b566f60626ac8aa1c0f0a8f3d35a Mon Sep 17 00:00:00 2001
From: Andreas Schultz <andreas.schultz@travelping.com>
Date: Mon, 20 Apr 2020 09:45:24 +0200
Subject: [PATCH 2/7] Only install hyperscan on amd64
Hyperscan is only supported on Intel. Keep it simple and
test only for x86_64 (who is still using 32bit anyway?)
Change-Id: I73707d33860820e4cee0b95575c11756236466a4
---
Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Makefile b/Makefile
index a2eab953a..841eb3bdf 100644
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,9 @@ DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml yamllint
DEB_DEPENDS += python3-venv # ensurepip
DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil
+ifeq ($(MACHINE),x86_64)
DEB_DEPENDS += libhyperscan-dev
+endif
# python3.6 on 16.04 requires python36-dev
LIBFFI=libffi6 # works on all but 20.04
@@ -144,7 +146,9 @@ endif
# +ganglia-devel if building the ganglia plugin
+ifeq ($(MACHINE),x86_64)
RPM_DEPENDS += hyperscan-devel
+endif
RPM_DEPENDS += chrpath libffi-devel rpm-build
RPM_DEPENDS_DEBUG = glibc-debuginfo e2fsprogs-debuginfo
@@ -159,7 +163,9 @@ RPM_SUSE_BUILDTOOLS_DEPS += clang cmake indent libtool make ninja python3-ply
RPM_SUSE_DEVEL_DEPS = glibc-devel-static libnuma-devel
RPM_SUSE_DEVEL_DEPS += libopenssl-devel openssl-devel mbedtls-devel libuuid-devel
+ifeq ($(MACHINE),x86_64)
RPM_SUSE_DEVEL_DEPS += hyperscan-devel
+endif
RPM_SUSE_PYTHON_DEPS = python-devel python3-devel python-pip python3-pip
RPM_SUSE_PYTHON_DEPS += python-rpm-macros python3-rpm-macros
--
2.28.0
From 24692e761d7ac74b4ef7d370b374b982740ad072 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Fri, 5 Jun 2020 01:41:55 +0300
Subject: [PATCH 3/7] Fix bad format_time_float usage
Was causing crashes with CLIB_DEBUG > 1
---
src/vlib/log.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/vlib/log.c b/src/vlib/log.c
index 342c0d25c..0cfdd2020 100644
--- a/src/vlib/log.c
+++ b/src/vlib/log.c
@@ -252,7 +252,7 @@ vlib_log_init (vlib_main_t * vm)
vec_validate (lm->entries, lm->size);
lm->log_class = vlib_log_register_class ("log", 0);
- u8 *tmp = format (NULL, "%U %-10U %-10U ", format_time_float, 0, (f64) 0,
+ u8 *tmp = format (NULL, "%U %-10U %-10U ", format_time_float, NULL, (f64) 0,
format_white_space, 255, format_white_space, 255);
log_main.indent = vec_len (tmp);
vec_free (tmp);
@@ -280,7 +280,7 @@ show_log (vlib_main_t * vm,
{
e = vec_elt_at_index (lm->entries, i);
vlib_cli_output (vm, "%U %-10U %-14U %v",
- format_time_float, 0, e->timestamp + time_offset,
+ format_time_float, NULL, e->timestamp + time_offset,
format_vlib_log_level, e->level,
format_vlib_log_class, e->class, e->string);
i = (i + 1) % lm->size;
--
2.28.0
From 03aa160f4e60bcf6e08fa2e00ed828d1a3ec5806 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Wed, 5 Aug 2020 16:44:28 +0300
Subject: [PATCH 4/7] [TEMP] Increase reassembly limit
This is an interim solution till we implement a proper CLI command
---
src/vnet/ip/reass/ip4_full_reass.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vnet/ip/reass/ip4_full_reass.c b/src/vnet/ip/reass/ip4_full_reass.c
index 4d578c5ce..713e95629 100644
--- a/src/vnet/ip/reass/ip4_full_reass.c
+++ b/src/vnet/ip/reass/ip4_full_reass.c
@@ -32,7 +32,7 @@
#define IP4_REASS_TIMEOUT_DEFAULT_MS 100
#define IP4_REASS_EXPIRE_WALK_INTERVAL_DEFAULT_MS 10000 // 10 seconds default
#define IP4_REASS_MAX_REASSEMBLIES_DEFAULT 1024
-#define IP4_REASS_MAX_REASSEMBLY_LENGTH_DEFAULT 3
+#define IP4_REASS_MAX_REASSEMBLY_LENGTH_DEFAULT 8
#define IP4_REASS_HT_LOAD_FACTOR (0.75)
#define IP4_REASS_DEBUG_BUFFERS 0
--
2.28.0
From 1c1e42525ae28dfa7d8a145f6f78d10c3c4e6fa4 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Mon, 21 Sep 2020 19:13:15 +0300
Subject: [PATCH 5/7] Bump scapy to v2.4.4
---
test/requirements-2.txt | 4 ++--
test/requirements-3.txt | 4 ++--
test/requirements.txt | 2 +-
test/test_span.py | 3 ++-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/test/requirements-2.txt b/test/requirements-2.txt
index 1f8b2bc3b..5c64bfc2a 100644
--- a/test/requirements-2.txt
+++ b/test/requirements-2.txt
@@ -265,8 +265,8 @@ scandir==1.10.0 \
--hash=sha256:b24086f2375c4a094a6b51e78b4cf7ca16c721dcee2eddd7aa6494b42d6d519d \
--hash=sha256:cb925555f43060a1745d0a321cca94bcea927c50114b623d73179189a4e100ac \
# via pathlib2
-scapy==2.4.3 ; python_version >= "2.7" or python_version >= "3.4" \
- --hash=sha256:e2f8d11f6a941c14a789ae8b236b27bd634681f1b29b5e893861e284d234f6b0 \
+scapy==2.4.4 ; python_version >= "2.7" or python_version >= "3.4" \
+ --hash=sha256:ecfd7a14cd9c3ef0eb08d28d5bb71d97219edff1454ccbdff229f676b27900ee \
# via -r requirements.txt
six==1.15.0 \
--hash=sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259 \
diff --git a/test/requirements-3.txt b/test/requirements-3.txt
index f955f37c4..9bc56a570 100644
--- a/test/requirements-3.txt
+++ b/test/requirements-3.txt
@@ -220,8 +220,8 @@ requests==2.23.0 \
--hash=sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee \
--hash=sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6 \
# via sphinx
-scapy==2.4.3 ; python_version >= "2.7" or python_version >= "3.4" \
- --hash=sha256:e2f8d11f6a941c14a789ae8b236b27bd634681f1b29b5e893861e284d234f6b0 \
+scapy==2.4.4 ; python_version >= "2.7" or python_version >= "3.4" \
+ --hash=sha256:ecfd7a14cd9c3ef0eb08d28d5bb71d97219edff1454ccbdff229f676b27900ee \
# via -r requirements.txt
six==1.15.0 \
--hash=sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259 \
diff --git a/test/requirements.txt b/test/requirements.txt
index e934bc042..23a7827d0 100644
--- a/test/requirements.txt
+++ b/test/requirements.txt
@@ -11,7 +11,7 @@ parameterized>=0.6.1 # BSD
pexpect # ISC
psutil # BSD
pycodestyle # MIT (Expat license) https://pypi.org/project/pycodestyle/
-scapy==2.4.3; python_version >= '2.7' or python_version >= '3.4' # GPL2 https://github.com/secdev/scapy/blob/master/LICENSE
+scapy==2.4.4; python_version >= '2.7' or python_version >= '3.4' # GPL2 https://github.com/secdev/scapy/blob/master/LICENSE
six # MIT
subprocess32 # PSF
syslog_rfc5424_parser>=0.3.1 # ISC
diff --git a/test/test_span.py b/test/test_span.py
index ecefe1537..d4918c21a 100644
--- a/test/test_span.py
+++ b/test/test_span.py
@@ -3,9 +3,10 @@
import unittest
from scapy.packet import Raw
-from scapy.layers.l2 import Ether, Dot1Q, GRE, ERSPAN
+from scapy.layers.l2 import Ether, Dot1Q, GRE
from scapy.layers.inet import IP, UDP
from scapy.layers.vxlan import VXLAN
+from scapy.contrib.erspan import ERSPAN
from framework import VppTestCase, VppTestRunner
from util import Host, ppp
--
2.28.0
From 7ff117b5df1f520e2d1d2d2a3dc3734c1b5c6d81 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Tue, 22 Sep 2020 01:28:37 +0300
Subject: [PATCH 6/7] Add downstream marker
---
.downstream-marker | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 .downstream-marker
diff --git a/.downstream-marker b/.downstream-marker
new file mode 100644
index 000000000..e69de29bb
--
2.28.0
From b9fc3c3bd35a6fa9f1c122c8a7a8aa56a1efdb35 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Thu, 15 Oct 2020 13:19:35 +0300
Subject: [PATCH 7/7] ethernet: fix Ethernet DMAC checks
Type: fix
Due to confusion between ethernet flags and hw interface flags, DMAC
filtering was not happening, most of the time.
Signed-off-by: Ivan Shvedunov <ivan4th@gmail.com>
Change-Id: I95209e1ea0f95f9be0b1a82ec9fcbc80955428d2
---
src/vnet/ethernet/node.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c
index 551754dca..73e9eec71 100644
--- a/src/vnet/ethernet/node.c
+++ b/src/vnet/ethernet/node.c
@@ -204,7 +204,8 @@ ethernet_input_inline_dmac_check (vnet_hw_interface_t * hi,
// vlan table lookups and vlan header parsing. Check the most specific
// matches first.
static_always_inline void
-identify_subint (vnet_hw_interface_t * hi,
+identify_subint (ethernet_main_t * em,
+ vnet_hw_interface_t * hi,
vlib_buffer_t * b0,
u32 match_flags,
main_intf_t * main_intf,
@@ -213,6 +214,7 @@ identify_subint (vnet_hw_interface_t * hi,
u32 * new_sw_if_index, u8 * error0, u32 * is_l2)
{
u32 matched;
+ ethernet_interface_t *ei = ethernet_get_interface (em, hi->hw_if_index);
matched = eth_identify_subint (hi, match_flags, main_intf, vlan_intf,
qinq_intf, new_sw_if_index, error0, is_l2);
@@ -223,7 +225,7 @@ identify_subint (vnet_hw_interface_t * hi,
// A unicast packet arriving on an L3 interface must have a dmac
// matching the interface mac. If interface has STATUS_L3 bit set
// mac filter is already done.
- if (!(*is_l2 || (hi->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)))
+ if (!(*is_l2 || (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)))
{
u64 dmacs[2];
u8 dmacs_bad[2];
@@ -1331,7 +1333,7 @@ ethernet_input_inline (vlib_main_t * vm,
}
else
{
- if (hi->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
+ if (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
goto skip_dmac_check01;
dmacs[0] = *(u64 *) e0;
@@ -1399,14 +1401,16 @@ ethernet_input_inline (vlib_main_t * vm,
&hi1,
&main_intf1, &vlan_intf1, &qinq_intf1);
- identify_subint (hi0,
+ identify_subint (em,
+ hi0,
b0,
match_flags0,
main_intf0,
vlan_intf0,
qinq_intf0, &new_sw_if_index0, &error0, &is_l20);
- identify_subint (hi1,
+ identify_subint (em,
+ hi1,
b1,
match_flags1,
main_intf1,
@@ -1573,7 +1577,7 @@ ethernet_input_inline (vlib_main_t * vm,
}
else
{
- if (hi->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
+ if (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
goto skip_dmac_check0;
dmacs[0] = *(u64 *) e0;
@@ -1619,7 +1623,8 @@ ethernet_input_inline (vlib_main_t * vm,
&hi0,
&main_intf0, &vlan_intf0, &qinq_intf0);
- identify_subint (hi0,
+ identify_subint (em,
+ hi0,
b0,
match_flags0,
main_intf0,
--
2.28.0
From e04f4cd4790a9a3ae09e54ad0ac2bee1346cf26c Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan.shvedunov@travelping.com>
Date: Thu, 19 Nov 2020 12:27:37 +0300
Subject: [PATCH] Follow symlinks while checking timestamps during builds
---
build-root/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build-root/Makefile b/build-root/Makefile
index e5db8b8fe..dba405f96 100644
--- a/build-root/Makefile
+++ b/build-root/Makefile
@@ -416,7 +416,7 @@ find_filter += -and -not -path '*/.mu_build_*'
find_newer_filtered_fn = \
(! -f $(1) \
|| -n $(call find_newer_files_fn,$(1),$(3)) \
- || -n "`find -H $(2) \
+ || -n "`find -L $(2) \
-type f \
-and -newer $(1) \
-and \( $(4) \) \
--
2.28.0
From 34262d4d56295b0872ad4e9a4a4791953f3fa444 Mon Sep 17 00:00:00 2001
From: Sergey Matov <sergey.matov@travelping.com>
Date: Tue, 15 Sep 2020 13:40:55 +0400
Subject: [PATCH] vlib: add decrement counter method
Currently there is no way to decrease simple counter. To extend
counters API new method allows to decrement counter by given value.
This might be useful in implementation of statistics stored in stats
segment.
Type: improvement
Change-Id: I7c08c62bffa6a2d50e9e2cf884f7b2d48538f34b
Signed-off-by: Sergey Matov <sergey.matov@travelping.com>
Signed-off-by: Dave Barach <dave@barachs.net>
---
diff --git a/src/vlib/counter.h b/src/vlib/counter.h
index 8a5aed4..04ab837 100644
--- a/src/vlib/counter.h
+++ b/src/vlib/counter.h
@@ -84,6 +84,25 @@
my_counters[index] += increment;
}
+/** Decrement a simple counter
+ @param cm - (vlib_simple_counter_main_t *) simple counter main pointer
+ @param thread_index - (u32) the current cpu index
+ @param index - (u32) index of the counter to increment
+ @param increment - (u64) quantitiy remove from the counter value
+*/
+always_inline void
+vlib_decrement_simple_counter (vlib_simple_counter_main_t * cm,
+ u32 thread_index, u32 index, u64 decrement)
+{
+ counter_t *my_counters;
+
+ my_counters = cm->counters[thread_index];
+
+ ASSERT (my_counters[index] >= decrement);
+
+ my_counters[index] -= decrement;
+}
+
/** Set a simple counter
@param cm - (vlib_simple_counter_main_t *) simple counter main pointer
@param thread_index - (u32) the current cpu index
From aa44336575dcf97bb9ce8277b045b96cafd67c3d Mon Sep 17 00:00:00 2001
From: Sergey Matov <sergey.matov@travelping.com>
Date: Mon, 23 Nov 2020 21:35:28 +0400
Subject: [PATCH] vppinfra: Refactor sparse_vec_free
Freeing of sparse vector does not flush header's specific
entities. This may result to a leak.
This commit improves vec_free logic for sparsed
vector cleanup.
Type: improvement
Change-Id: Ied161a4408447d57cade5266cad4e1660e967a88
Signed-off-by: Sergey Matov <sergey.matov@travelping.com>
---
diff --git a/src/vppinfra/sparse_vec.h b/src/vppinfra/sparse_vec.h
index 54a92ce..7fd1aff 100644
--- a/src/vppinfra/sparse_vec.h
+++ b/src/vppinfra/sparse_vec.h
@@ -223,7 +223,18 @@
*i1_return = is_member1 + d1;
}
-#define sparse_vec_free(v) vec_free(v)
+always_inline void
+sparse_vec_free (void *v) {
+ sparse_vec_header_t *h;
+
+ if (!v)
+ return;
+
+ h = sparse_vec_header (v);
+ vec_free (h->is_member_bitmap);
+ vec_free (h->member_counts);
+ vec_free_h (v, sizeof (h[0]));
+}
#define sparse_vec_elt_at_index(v,i) \
vec_elt_at_index ((v), sparse_vec_index ((v), (i)))
--- a/startup_debug.conf 2020-04-12 19:33:54.390008000 +0000
+++ b/startup_debug.conf 2020-04-12 19:45:16.742809000 +0000
@@ -17,7 +17,7 @@
}
plugins {
- path /usr/src/vpp/build-root/install-vpp_debug-native/vpp/lib/vpp_plugins/
+ path /upf/build-root/install-vpp_debug-native/vpp/lib/vpp_plugins/
plugin dpdk_plugin.so { disable }
plugin gtpu_plugin.so { disable }
plugin upf_plugin.so { enable }
From d9fa03eb175bde1066f8c14249d8bb487d8800e4 Mon Sep 17 00:00:00 2001
From: Andreas Schultz <andreas.schultz@travelping.com>
Date: Mon, 16 Mar 2020 17:00:29 +0100
Subject: [PATCH 1/7] CI and build infrastructure adjustments
---
Makefile | 5 +++++
build/external/Makefile | 2 +-
build/external/packages/dpdk.mk | 4 ++--
src/pkg/debian/control.in | 6 ++++--
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index cf4cfadec..a2eab953a 100644
--- a/Makefile
+++ b/Makefile
@@ -67,9 +67,12 @@ DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
DEB_DEPENDS += lcov chrpath autoconf indent clang-format libnuma-dev
DEB_DEPENDS += python3-all python3-setuptools check
DEB_DEPENDS += libboost-all-dev libffi-dev python3-ply libmbedtls-dev
+DEB_DEPENDS += liburcu-dev
DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
+DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml yamllint
DEB_DEPENDS += python3-venv # ensurepip
DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil
+DEB_DEPENDS += libhyperscan-dev
# python3.6 on 16.04 requires python36-dev
LIBFFI=libffi6 # works on all but 20.04
@@ -141,6 +144,7 @@ endif
# +ganglia-devel if building the ganglia plugin
+RPM_DEPENDS += hyperscan-devel
RPM_DEPENDS += chrpath libffi-devel rpm-build
RPM_DEPENDS_DEBUG = glibc-debuginfo e2fsprogs-debuginfo
@@ -155,6 +159,7 @@ RPM_SUSE_BUILDTOOLS_DEPS += clang cmake indent libtool make ninja python3-ply
RPM_SUSE_DEVEL_DEPS = glibc-devel-static libnuma-devel
RPM_SUSE_DEVEL_DEPS += libopenssl-devel openssl-devel mbedtls-devel libuuid-devel
+RPM_SUSE_DEVEL_DEPS += hyperscan-devel
RPM_SUSE_PYTHON_DEPS = python-devel python3-devel python-pip python3-pip
RPM_SUSE_PYTHON_DEPS += python-rpm-macros python3-rpm-macros
diff --git a/build/external/Makefile b/build/external/Makefile
index b0e3cee4f..c2d94e5bd 100644
--- a/build/external/Makefile
+++ b/build/external/Makefile
@@ -20,7 +20,7 @@ MAKE_ARGS ?= -j
BUILD_DIR ?= $(CURDIR)/_build
INSTALL_DIR ?= $(CURDIR)/_install
PKG_VERSION ?= $(shell git describe --abbrev=0 | cut -d- -f1 | cut -dv -f2 | cut -d. -f1,2)
-PKG_SUFFIX ?= $(shell git log --oneline v$(PKG_VERSION)-rc0.. . | wc -l)
+PKG_SUFFIX ?= $(shell git log --oneline v$(PKG_VERSION)-rc0.. -- . | wc -l)
JOBS := $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo),\
$(shell grep -c ^processor /proc/cpuinfo), 2)
diff --git a/build/external/packages/dpdk.mk b/build/external/packages/dpdk.mk
index beabf48e9..99a5d9f14 100644
--- a/build/external/packages/dpdk.mk
+++ b/build/external/packages/dpdk.mk
@@ -202,11 +202,12 @@ $(B)/custom-config: $(B)/.dpdk-patch.ok Makefile
$(call set,RTE_LIBRTE_PMD_TAP,$(DPDK_TAP_PMD))
$(call set,RTE_LIBRTE_GSO,$(DPDK_TAP_PMD))
$(call set,RTE_LIBRTE_PMD_FAILSAFE,$(DPDK_FAILSAFE_PMD))
+ @# required for UPF
+ $(call set,RTE_LIBRTE_ACL,y)
@# not needed
$(call set,RTE_ETHDEV_RXTX_CALLBACKS,n)
$(call set,RTE_LIBRTE_CFGFILE,n)
$(call set,RTE_LIBRTE_LPM,n)
- $(call set,RTE_LIBRTE_ACL,n)
$(call set,RTE_LIBRTE_JOBSTATS,n)
$(call set,RTE_LIBRTE_EFD,n)
$(call set,RTE_LIBRTE_MEMBER,n)
@@ -219,7 +220,6 @@ $(B)/custom-config: $(B)/.dpdk-patch.ok Makefile
$(call set,RTE_LIBRTE_PIPELINE,n)
$(call set,RTE_LIBRTE_PMD_SOFTNIC,n)
$(call set,RTE_LIBRTE_FLOW_CLASSIFY,n)
- $(call set,RTE_LIBRTE_ACL,n)
$(call set,RTE_LIBRTE_GRO,n)
$(call set,RTE_LIBRTE_KNI,n)
$(call set,RTE_LIBRTE_BPF,n)
diff --git a/src/pkg/debian/control.in b/src/pkg/debian/control.in
index 0b0c621e5..2addf900e 100644
--- a/src/pkg/debian/control.in
+++ b/src/pkg/debian/control.in
@@ -51,7 +51,8 @@ Description: Vector Packet Processing--runtime libraries
Package: vpp-plugin-core
Architecture: any
Depends: vpp (= ${source:Version}),
- ${shlibs:Depends}
+ ${shlibs:Depends},
+ ${misc:Depends}
Description: Vector Packet Processing--runtime core plugins
This package contains VPP core plugins
.
@@ -59,7 +60,8 @@ Description: Vector Packet Processing--runtime core plugins
Package: vpp-plugin-dpdk
Architecture: any
Depends: vpp (= ${source:Version}),
- ${shlibs:Depends}
+ ${shlibs:Depends},
+ ${misc:Depends}
Description: Vector Packet Processing--runtime dpdk plugin
This package contains the VPP dpdk plugin
.
--
2.28.0
From 3daf9fc66400b566f60626ac8aa1c0f0a8f3d35a Mon Sep 17 00:00:00 2001
From: Andreas Schultz <andreas.schultz@travelping.com>
Date: Mon, 20 Apr 2020 09:45:24 +0200
Subject: [PATCH 2/7] Only install hyperscan on amd64
Hyperscan is only supported on Intel. Keep it simple and
test only for x86_64 (who is still using 32bit anyway?)
Change-Id: I73707d33860820e4cee0b95575c11756236466a4
---
Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Makefile b/Makefile
index a2eab953a..841eb3bdf 100644
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,9 @@ DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml yamllint
DEB_DEPENDS += python3-venv # ensurepip
DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil
+ifeq ($(MACHINE),x86_64)
DEB_DEPENDS += libhyperscan-dev
+endif
# python3.6 on 16.04 requires python36-dev
LIBFFI=libffi6 # works on all but 20.04
@@ -144,7 +146,9 @@ endif
# +ganglia-devel if building the ganglia plugin
+ifeq ($(MACHINE),x86_64)
RPM_DEPENDS += hyperscan-devel
+endif
RPM_DEPENDS += chrpath libffi-devel rpm-build
RPM_DEPENDS_DEBUG = glibc-debuginfo e2fsprogs-debuginfo
@@ -159,7 +163,9 @@ RPM_SUSE_BUILDTOOLS_DEPS += clang cmake indent libtool make ninja python3-ply
RPM_SUSE_DEVEL_DEPS = glibc-devel-static libnuma-devel
RPM_SUSE_DEVEL_DEPS += libopenssl-devel openssl-devel mbedtls-devel libuuid-devel
+ifeq ($(MACHINE),x86_64)
RPM_SUSE_DEVEL_DEPS += hyperscan-devel
+endif
RPM_SUSE_PYTHON_DEPS = python-devel python3-devel python-pip python3-pip
RPM_SUSE_PYTHON_DEPS += python-rpm-macros python3-rpm-macros
--
2.28.0
From 24692e761d7ac74b4ef7d370b374b982740ad072 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Fri, 5 Jun 2020 01:41:55 +0300
Subject: [PATCH 3/7] Fix bad format_time_float usage
Was causing crashes with CLIB_DEBUG > 1
---
src/vlib/log.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/vlib/log.c b/src/vlib/log.c
index 342c0d25c..0cfdd2020 100644
--- a/src/vlib/log.c
+++ b/src/vlib/log.c
@@ -252,7 +252,7 @@ vlib_log_init (vlib_main_t * vm)
vec_validate (lm->entries, lm->size);
lm->log_class = vlib_log_register_class ("log", 0);
- u8 *tmp = format (NULL, "%U %-10U %-10U ", format_time_float, 0, (f64) 0,
+ u8 *tmp = format (NULL, "%U %-10U %-10U ", format_time_float, NULL, (f64) 0,
format_white_space, 255, format_white_space, 255);
log_main.indent = vec_len (tmp);
vec_free (tmp);
@@ -280,7 +280,7 @@ show_log (vlib_main_t * vm,
{
e = vec_elt_at_index (lm->entries, i);
vlib_cli_output (vm, "%U %-10U %-14U %v",
- format_time_float, 0, e->timestamp + time_offset,
+ format_time_float, NULL, e->timestamp + time_offset,
format_vlib_log_level, e->level,
format_vlib_log_class, e->class, e->string);
i = (i + 1) % lm->size;
--
2.28.0
From 03aa160f4e60bcf6e08fa2e00ed828d1a3ec5806 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Wed, 5 Aug 2020 16:44:28 +0300
Subject: [PATCH 4/7] [TEMP] Increase reassembly limit
This is an interim solution till we implement a proper CLI command
---
src/vnet/ip/reass/ip4_full_reass.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vnet/ip/reass/ip4_full_reass.c b/src/vnet/ip/reass/ip4_full_reass.c
index 4d578c5ce..713e95629 100644
--- a/src/vnet/ip/reass/ip4_full_reass.c
+++ b/src/vnet/ip/reass/ip4_full_reass.c
@@ -32,7 +32,7 @@
#define IP4_REASS_TIMEOUT_DEFAULT_MS 100
#define IP4_REASS_EXPIRE_WALK_INTERVAL_DEFAULT_MS 10000 // 10 seconds default
#define IP4_REASS_MAX_REASSEMBLIES_DEFAULT 1024
-#define IP4_REASS_MAX_REASSEMBLY_LENGTH_DEFAULT 3
+#define IP4_REASS_MAX_REASSEMBLY_LENGTH_DEFAULT 8
#define IP4_REASS_HT_LOAD_FACTOR (0.75)
#define IP4_REASS_DEBUG_BUFFERS 0
--
2.28.0
From 1c1e42525ae28dfa7d8a145f6f78d10c3c4e6fa4 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Mon, 21 Sep 2020 19:13:15 +0300
Subject: [PATCH 5/7] Bump scapy to v2.4.4
---
test/requirements-2.txt | 4 ++--
test/requirements-3.txt | 4 ++--
test/requirements.txt | 2 +-
test/test_span.py | 3 ++-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/test/requirements-2.txt b/test/requirements-2.txt
index 1f8b2bc3b..5c64bfc2a 100644
--- a/test/requirements-2.txt
+++ b/test/requirements-2.txt
@@ -265,8 +265,8 @@ scandir==1.10.0 \
--hash=sha256:b24086f2375c4a094a6b51e78b4cf7ca16c721dcee2eddd7aa6494b42d6d519d \
--hash=sha256:cb925555f43060a1745d0a321cca94bcea927c50114b623d73179189a4e100ac \
# via pathlib2
-scapy==2.4.3 ; python_version >= "2.7" or python_version >= "3.4" \
- --hash=sha256:e2f8d11f6a941c14a789ae8b236b27bd634681f1b29b5e893861e284d234f6b0 \
+scapy==2.4.4 ; python_version >= "2.7" or python_version >= "3.4" \
+ --hash=sha256:ecfd7a14cd9c3ef0eb08d28d5bb71d97219edff1454ccbdff229f676b27900ee \
# via -r requirements.txt
six==1.15.0 \
--hash=sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259 \
diff --git a/test/requirements-3.txt b/test/requirements-3.txt
index f955f37c4..9bc56a570 100644
--- a/test/requirements-3.txt
+++ b/test/requirements-3.txt
@@ -220,8 +220,8 @@ requests==2.23.0 \
--hash=sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee \
--hash=sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6 \
# via sphinx
-scapy==2.4.3 ; python_version >= "2.7" or python_version >= "3.4" \
- --hash=sha256:e2f8d11f6a941c14a789ae8b236b27bd634681f1b29b5e893861e284d234f6b0 \
+scapy==2.4.4 ; python_version >= "2.7" or python_version >= "3.4" \
+ --hash=sha256:ecfd7a14cd9c3ef0eb08d28d5bb71d97219edff1454ccbdff229f676b27900ee \
# via -r requirements.txt
six==1.15.0 \
--hash=sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259 \
diff --git a/test/requirements.txt b/test/requirements.txt
index e934bc042..23a7827d0 100644
--- a/test/requirements.txt
+++ b/test/requirements.txt
@@ -11,7 +11,7 @@ parameterized>=0.6.1 # BSD
pexpect # ISC
psutil # BSD
pycodestyle # MIT (Expat license) https://pypi.org/project/pycodestyle/
-scapy==2.4.3; python_version >= '2.7' or python_version >= '3.4' # GPL2 https://github.com/secdev/scapy/blob/master/LICENSE
+scapy==2.4.4; python_version >= '2.7' or python_version >= '3.4' # GPL2 https://github.com/secdev/scapy/blob/master/LICENSE
six # MIT
subprocess32 # PSF
syslog_rfc5424_parser>=0.3.1 # ISC
diff --git a/test/test_span.py b/test/test_span.py
index ecefe1537..d4918c21a 100644
--- a/test/test_span.py
+++ b/test/test_span.py
@@ -3,9 +3,10 @@
import unittest
from scapy.packet import Raw
-from scapy.layers.l2 import Ether, Dot1Q, GRE, ERSPAN
+from scapy.layers.l2 import Ether, Dot1Q, GRE
from scapy.layers.inet import IP, UDP
from scapy.layers.vxlan import VXLAN
+from scapy.contrib.erspan import ERSPAN
from framework import VppTestCase, VppTestRunner
from util import Host, ppp
--
2.28.0
From 7ff117b5df1f520e2d1d2d2a3dc3734c1b5c6d81 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Tue, 22 Sep 2020 01:28:37 +0300
Subject: [PATCH 6/7] Add downstream marker
---
.downstream-marker | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 .downstream-marker
diff --git a/.downstream-marker b/.downstream-marker
new file mode 100644
index 000000000..e69de29bb
--
2.28.0
From b9fc3c3bd35a6fa9f1c122c8a7a8aa56a1efdb35 Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan4th@gmail.com>
Date: Thu, 15 Oct 2020 13:19:35 +0300
Subject: [PATCH 7/7] ethernet: fix Ethernet DMAC checks
Type: fix
Due to confusion between ethernet flags and hw interface flags, DMAC
filtering was not happening, most of the time.
Signed-off-by: Ivan Shvedunov <ivan4th@gmail.com>
Change-Id: I95209e1ea0f95f9be0b1a82ec9fcbc80955428d2
---
src/vnet/ethernet/node.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c
index 551754dca..73e9eec71 100644
--- a/src/vnet/ethernet/node.c
+++ b/src/vnet/ethernet/node.c
@@ -204,7 +204,8 @@ ethernet_input_inline_dmac_check (vnet_hw_interface_t * hi,
// vlan table lookups and vlan header parsing. Check the most specific
// matches first.
static_always_inline void
-identify_subint (vnet_hw_interface_t * hi,
+identify_subint (ethernet_main_t * em,
+ vnet_hw_interface_t * hi,
vlib_buffer_t * b0,
u32 match_flags,
main_intf_t * main_intf,
@@ -213,6 +214,7 @@ identify_subint (vnet_hw_interface_t * hi,
u32 * new_sw_if_index, u8 * error0, u32 * is_l2)
{
u32 matched;
+ ethernet_interface_t *ei = ethernet_get_interface (em, hi->hw_if_index);
matched = eth_identify_subint (hi, match_flags, main_intf, vlan_intf,
qinq_intf, new_sw_if_index, error0, is_l2);
@@ -223,7 +225,7 @@ identify_subint (vnet_hw_interface_t * hi,
// A unicast packet arriving on an L3 interface must have a dmac
// matching the interface mac. If interface has STATUS_L3 bit set
// mac filter is already done.
- if (!(*is_l2 || (hi->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)))
+ if (!(*is_l2 || (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)))
{
u64 dmacs[2];
u8 dmacs_bad[2];
@@ -1331,7 +1333,7 @@ ethernet_input_inline (vlib_main_t * vm,
}
else
{
- if (hi->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
+ if (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
goto skip_dmac_check01;
dmacs[0] = *(u64 *) e0;
@@ -1399,14 +1401,16 @@ ethernet_input_inline (vlib_main_t * vm,
&hi1,
&main_intf1, &vlan_intf1, &qinq_intf1);
- identify_subint (hi0,
+ identify_subint (em,
+ hi0,
b0,
match_flags0,
main_intf0,
vlan_intf0,
qinq_intf0, &new_sw_if_index0, &error0, &is_l20);
- identify_subint (hi1,
+ identify_subint (em,
+ hi1,
b1,
match_flags1,
main_intf1,
@@ -1573,7 +1577,7 @@ ethernet_input_inline (vlib_main_t * vm,
}
else
{
- if (hi->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
+ if (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
goto skip_dmac_check0;
dmacs[0] = *(u64 *) e0;
@@ -1619,7 +1623,8 @@ ethernet_input_inline (vlib_main_t * vm,
&hi0,
&main_intf0, &vlan_intf0, &qinq_intf0);
- identify_subint (hi0,
+ identify_subint (em,
+ hi0,
b0,
match_flags0,
main_intf0,
--
2.28.0
From e04f4cd4790a9a3ae09e54ad0ac2bee1346cf26c Mon Sep 17 00:00:00 2001
From: Ivan Shvedunov <ivan.shvedunov@travelping.com>
Date: Thu, 19 Nov 2020 12:27:37 +0300
Subject: [PATCH] Follow symlinks while checking timestamps during builds
---
build-root/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build-root/Makefile b/build-root/Makefile
index e5db8b8fe..dba405f96 100644
--- a/build-root/Makefile
+++ b/build-root/Makefile
@@ -416,7 +416,7 @@ find_filter += -and -not -path '*/.mu_build_*'
find_newer_filtered_fn = \
(! -f $(1) \
|| -n $(call find_newer_files_fn,$(1),$(3)) \
- || -n "`find -H $(2) \
+ || -n "`find -L $(2) \
-type f \
-and -newer $(1) \
-and \( $(4) \) \
--
2.28.0
From 34262d4d56295b0872ad4e9a4a4791953f3fa444 Mon Sep 17 00:00:00 2001
From: Sergey Matov <sergey.matov@travelping.com>
Date: Tue, 15 Sep 2020 13:40:55 +0400
Subject: [PATCH] vlib: add decrement counter method
Currently there is no way to decrease simple counter. To extend
counters API new method allows to decrement counter by given value.
This might be useful in implementation of statistics stored in stats
segment.
Type: improvement
Change-Id: I7c08c62bffa6a2d50e9e2cf884f7b2d48538f34b
Signed-off-by: Sergey Matov <sergey.matov@travelping.com>
Signed-off-by: Dave Barach <dave@barachs.net>
---
diff --git a/src/vlib/counter.h b/src/vlib/counter.h
index 8a5aed4..04ab837 100644
--- a/src/vlib/counter.h
+++ b/src/vlib/counter.h
@@ -84,6 +84,25 @@
my_counters[index] += increment;
}
+/** Decrement a simple counter
+ @param cm - (vlib_simple_counter_main_t *) simple counter main pointer
+ @param thread_index - (u32) the current cpu index
+ @param index - (u32) index of the counter to increment
+ @param increment - (u64) quantitiy remove from the counter value
+*/
+always_inline void
+vlib_decrement_simple_counter (vlib_simple_counter_main_t * cm,
+ u32 thread_index, u32 index, u64 decrement)
+{
+ counter_t *my_counters;
+
+ my_counters = cm->counters[thread_index];
+
+ ASSERT (my_counters[index] >= decrement);
+
+ my_counters[index] -= decrement;
+}
+
/** Set a simple counter
@param cm - (vlib_simple_counter_main_t *) simple counter main pointer
@param thread_index - (u32) the current cpu index
From aa44336575dcf97bb9ce8277b045b96cafd67c3d Mon Sep 17 00:00:00 2001
From: Sergey Matov <sergey.matov@travelping.com>
Date: Mon, 23 Nov 2020 21:35:28 +0400
Subject: [PATCH] vppinfra: Refactor sparse_vec_free
Freeing of sparse vector does not flush header's specific
entities. This may result to a leak.
This commit improves vec_free logic for sparsed
vector cleanup.
Type: improvement
Change-Id: Ied161a4408447d57cade5266cad4e1660e967a88
Signed-off-by: Sergey Matov <sergey.matov@travelping.com>
---
diff --git a/src/vppinfra/sparse_vec.h b/src/vppinfra/sparse_vec.h
index 54a92ce..7fd1aff 100644
--- a/src/vppinfra/sparse_vec.h
+++ b/src/vppinfra/sparse_vec.h
@@ -223,7 +223,18 @@
*i1_return = is_member1 + d1;
}
-#define sparse_vec_free(v) vec_free(v)
+always_inline void
+sparse_vec_free (void *v) {
+ sparse_vec_header_t *h;
+
+ if (!v)
+ return;
+
+ h = sparse_vec_header (v);
+ vec_free (h->is_member_bitmap);
+ vec_free (h->member_counts);
+ vec_free_h (v, sizeof (h[0]));
+}
#define sparse_vec_elt_at_index(v,i) \
vec_elt_at_index ((v), sparse_vec_index ((v), (i)))
from scapy.all import *
from scapy.contrib.gtp import GTP_U_Header
data= "OpenairInterface Software Alliance - downlink"
sendp(Ether(src="02:42:c0:a8:40:c6",dst="00:0c:29:46:1f:53")/
IP(src="192.168.64.198",dst="20.20.20.20",version=4)/
UDP()/data, iface="sgi")
from scapy.all import *
from scapy.contrib.gtp import GTP_U_Header
data= "OpenairInterface Software Alliance"
sendp(Ether(src="02:42:c0:a8:3e:c6",dst="00:0c:29:46:1f:55")/
IP(src="192.168.62.198",dst="192.168.62.201")/
UDP(dport=2152)/GTP_U_Header(teid=9689)/
IP(src="10.10.10.10",dst="192.168.64.198",version=4)/
UDP()/data, iface="access")
## 1. Build vpp-upf
# 1. Retrieve the proper code version #
```git clone -b vpp-upf https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf-vpp.git```
```bash
$ git clone https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf-vpp.git
```cd oai-cn5g-upf-vpp```
$ cd oai-cn5g-upf-vpp
```docker build --tag vpp-upg:latest --file docker/Dockerfile .
$ git checkout vpp-upf
```
# 2. Generic Parameters #
Here in our network configuration, we need to pass the "GIT PROXY" configuration.
* If you do not need, remove the `--build-arg EURECOM_PROXY=".."` option.
* If you do need it, change with your proxy value.
# 3. Build vpp-upf image #
## 3.1 On a Ubuntu 18.04 Host ##
```bash
$ docker build --target vpp-upg --tag vpp-upg:latest \
--file docker/Dockerfile.ubuntu.18.04 \
--build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" .
```
## 3.2 On a CentOS 8 Host ##
```
To Do
```
......@@ -14,5 +14,9 @@
**Table of Contents**
1. [Pre-requisites](./DEPLOY_PRE_REQUESITES.md)
2. [Building the Docker Images](./BUILD_IMAGE.md)
1. [Pre-requisites](https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed/-/blob/master/docs/DEPLOY_PRE_REQUESITES.md)
2. [Installing VPP-UPF on host](./INSTALL_ON_HOST.md)
3. [Building the Docker Image](./BUILD_IMAGE.md)
4. [About network configuration](./VPP_NETWORKING.md)
5. [About VPP-UPF configuration](./VPP_UPF_CONFIG.md)
6. [Development guidelines for VPP-UPF](./DEVELOPMENT_GUIDELINE.md)
# 1. Retrieve the proper code version #
```bash
$ git clone https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf-vpp.git
$ cd oai-cn5g-upf-vpp
$ git checkout vpp-upf
```
# 2. Generic Parameters #
Here in our network configuration, we need to pass the "GIT PROXY" configuration.
* If you do not need, remove the `--build-arg EURECOM_PROXY=".."` option.
* If you do need it, change with your proxy value.
# 3. Build vpp-upf source #
## 3.1 On a Docker Ubuntu 18.04 Host ##
```bash
$ docker build --tag vpp-upg:dev \
--file docker/Dockerfile.ubuntu.18.04.dev \
--build-arg EURECOM_PROXY="http://proxy.eurecom.fr:8080" .
```
or
## 3.1 On a Ubuntu 18.04 Native ##
### Install VPP-UPF software dependencies
```bash
ubuntu@test-upf:~$ cd oai-cn5g-upf-vpp/
ubuntu@test-upf:~/oai-cn5g-upf-vpp$ cd ./build/scripts
ubuntu@test-upf:~/oai-cn5g-upf-vpp/build/scripts$ ./build_vpp_upf -I -f
```
### Build VPP-UPF
//TO DO
```bash
ubuntu@test-upf:~/oai-cn5g-upf-vpp/build/scripts$ ./build_vpp_upf -c -V -b Debug -j
```
# VPP-UPF Installation
Tested and validated on Ubuntu Bionic arch amd64.
## Download OAI UPF (VPP-UPF) source code
```bash
$ git clone https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf-vpp.git
$ cd oai-cn5g-upf-vpp
$ git checkout vpp-upf
```
## Install VPP-UPF
### Install VPP-UPF software dependencies
```bash
ubuntu@test-upf:~$ cd oai-cn5g-upf-vpp/
ubuntu@test-upf:~/oai-cn5g-upf-vpp$ cd ./build/scripts
ubuntu@test-upf:~/oai-cn5g-upf-vpp/build/scripts$ ./build_vpp_upf -I -f
```
### Build VPP-UPF
```bash
ubuntu@test-upf:~/oai-cn5g-upf-vpp/build/scripts$ ./build_vpp_upf -c -V -b Debug
```
### Configure VPP-UPF
Refer this page for [VPP-UPF configuration](./VPP_UPF_CONFIG.md)
### Launch VPP-UPF
```bash
ubuntu@test-upf:~$ cd oai-cn5g-upf-vpp/vpp
ubuntu@test-upf:~/oai-cn5g-upf-vpp/vpp$ ./run.sh
```
<br/>
<br/>
<br/>
// Describe VPP usage with veth pair and requirement of three veth pair/linux interfaces.<br/>
<br/>
UPF sould have at least three interfaces viz. access, core and sgi (or N3, N4 and N6/N9 respectively).<br/>
Here I have three interfaces to docker container. We rename them just for sec of simplicity. There is <br/>
additional route added for UE traffic 10.10.10.0/24 network <br/>
```bash
ip link set eth0 down
ip link set eth0 name access
ip link set access up
ip link set eth1 down
ip link set eth1 name core
ip link set core up
ip link set eth2 down
ip link set eth2 name sgi
ip link set sgi up
ip route add 10.10.10.0/24 via 192.168.63.198 dev sgi
ip route add 192.168.62.0/24 dev access
ip route add 192.168.61/24 dev core
ip route add 192.168.63.0/24 dev sgi
```
<br/>
<br/>
<br/>
Below is sample vpp-upf configuration. We use at lease three veth-pairs as UPF interfaces (e.g. N3, N4, N6/N9 etc). <br/>
```bash
ip table add 1
ip table add 2
create host-interface name sgi
set interface mac address host-sgi 00:0c:29:46:1f:53
set interface mtu 1500 host-sgi
set interface ip table host-sgi 1
set interface ip address host-sgi 192.168.64.201/26
set interface state host-sgi up
create host-interface name core
set interface mac address host-core 00:0c:29:46:1f:54
set interface mtu 1500 host-core
set interface ip table host-core 0
set interface ip address host-core 192.168.63.201/26
set interface ip address host-core 192.168.61.201/26
set interface state host-core up
create host-interface name access
set interface mac address host-access 00:0c:29:46:1f:55
set interface mtu 1500 host-access
set interface ip table host-access 2
set interface ip table host-access 1
set interface ip address host-access 192.168.62.201/26
set interface state host-access up
ip route add 0.0.0.0/0 table 2 via 192.168.62.210 host-access
ip route add 0.0.0.0/0 table 0 via 192.168.63.196 host-core
ip route add 0.0.0.0/0 table 1 via 192.168.64.194 host-sgi
create host-interface name sgi
set interface mac address host-sgi 00:0c:29:46:1f:53
set interface mtu 1500 host-sgi
set interface ip table host-sgi 2
set interface ip address host-sgi 192.168.63.201/26
set interface state host-sgi up
ip route add 0.0.0.0/0 table 0 via 192.168.61.196 host-core
ip route add 0.0.0.0/0 table 1 via 192.168.62.210 host-access
ip route add 0.0.0.0/0 table 2 via 192.168.63.194 host-sgi
upf pfcp endpoint ip 192.168.63.201 vrf 0
upf pfcp endpoint ip 192.168.61.201 vrf 0
upf nwi name core vrf 0
upf nwi name access vrf 2
upf nwi name sgi vrf 1
upf node-id ip4 192.168.63.201
upf nwi name access vrf 1
upf nwi name sgi vrf 2
upf node-id fqdn gwu1.vpp.upg.node.epc.mnc095.mcc208.3gppnetwork.org
upf specification release 16
trace add af-packet-input 100
upf gtpu endpoint ip 192.168.62.201 nwi access teid 0x000004d2/2
upf gtpu endpoint ip 192.168.62.201 nwi access teid 0x000004d2/2
```
#!/usr/bin/env bash
ip link set eth0 down
ip link set eth0 name access
ip link set access up
......@@ -10,7 +12,9 @@ ip link set eth2 down
ip link set eth2 name sgi
ip link set sgi up
ip route add 10.10.10.0/24 via 192.168.63.198 dev sgi
ip route add 192.168.62.0/24 dev access
ip route add 192.168.61/24 dev core
ip route add 192.168.63.0/24 dev sgi
ip route add @NETWORK_UE_IP@ via @UE_DL_Gw@ dev sgi
ip route add @SUBNET_ACCESS@ dev access
ip route add @SUBNET_CORE@ dev core
ip route add @SUBNET_SGI@ dev sgi
cd scripts/patches/
find . -iname '*.patch' -execdir sh -c 'patch -p1 -N -d ../../vpp < $0' {} \;
#!/usr/bin/env bash
# @Raphael -> first 3 files are common to docker and native installation
#____________
# init.conf => upf config
# startup_debug.conf => vpp config (To Do -> sed location of init.conf file)
# run_sh => run vpp
# add_route.sh => container routes
#____________
CONFIG_DIR="/openair-upf/etc"
###############################
# UPF Config
###############################
for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
# create sed expressions for substituting each occurrence of ${VAR}
# with the value of the environment variable "VAR"
EXPRESSIONS=""
for v in ${VARS}; do
NEW_VAR=`echo $v | sed -e "s#@##g"`
if [[ "${!NEW_VAR}x" == "x" ]]; then
echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done
###############################
# VPP Routes
###############################
# @Raphael
# Assumption ->
# UPF has only three interfaces viz. n3 (access) eth0, n4 (core) eth1, n6 (sgi) eth2
# Near future we will have multiple interfaces (e.g. two n6 interface for edge computing case)
# We define in this order in docker-compose -> it is alphabetical order
ACCESS_IPV4=$(ifconfig eth0 | grep "inet " | awk '{print $2}')
CORE_IPV4=$(ifconfig eth1 | grep "inet " | awk '{print $2}')
SGI_IPV4=$(ifconfig eth2 | grep "inet " | awk '{print $2}')
# Dirty extraction -> we assume /24 subnet
export UE_DL_Gw=$SGI_IPV4
export SUBNET_ACCESS=`echo $ACCESS_IPV4 | sed -e 's/\.[^.]*\$//'`'.0/24';
export SUBNET_CORE=`echo $CORE_IPV4 | sed -e 's/\.[^.]*\$//'`'.0/24';
export SUBNET_SGI=`echo $SGI_IPV4 | sed -e 's/\.[^.]*\$//'`'.0/24';
for c in ${CONFIG_DIR}/add_route.sh; do
# grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
# create sed expressions for substituting each occurrence of ${VAR}
# with the value of the environment variable "VAR"
EXPRESSIONS=""
for v in ${VARS}; do
NEW_VAR=`echo $v | sed -e "s#@##g"`
if [[ "${!NEW_VAR}x" == "x" ]]; then
echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done
exec "$@"
sleep 1
exec /openair-upf/etc/add_route.sh
#____________________________________________________________________________
--- a/src/plugins/upf/upf_gtpu_encap.c 2021-03-07 13:19:40.937167871 +0000
+++ b/src/plugins/upf/upf_gtpu_encap.c 2021-03-07 15:27:03.082328061 +0000
@@ -604,6 +604,7 @@
ip6_header_t *ip6_0;
udp_header_t *udp0;
gtpu_header_t *gtpu0;
+ gtpu_ext_header_t *gtpu0_ext;
u64 *copy_src0, *copy_dst0;
u32 *copy_src_last0, *copy_dst_last0;
u16 new_l0;
@@ -636,6 +637,9 @@
next0 = peer0->next_dpo.dpoi_next_node;
vnet_buffer (b0)->ip.adj_index[VLIB_TX] =
peer0->next_dpo.dpoi_index;
+
+ upf_buffer_opaque (b0)->gtpu.ext_hdr_len = 0x08;
+ vlib_buffer_advance (b0, -upf_buffer_opaque (b0)->gtpu.ext_hdr_len);
if (PREDICT_FALSE ((upf_buffer_opaque (b0)->gtpu.hdr_flags & GTPU_E_S_PN_BIT) != 0))
vlib_buffer_advance (b0, -upf_buffer_opaque (b0)->gtpu.ext_hdr_len);
@@ -681,9 +685,19 @@
new_l0 =
clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0) -
sizeof (*ip4_0) - sizeof (*udp0) -
- GTPU_V1_HDR_LEN);
+// GTPU_V1_HDR_LEN);
+ GTPU_V1_HDR_LEN + GTPU_V1_EXT_HDR_LEN);
gtpu0->length = new_l0;
- gtpu0->ver_flags |= (upf_buffer_opaque (b0)->gtpu.hdr_flags & GTPU_E_S_PN_BIT);
+// gtpu0->ver_flags |= (upf_buffer_opaque (b0)->gtpu.hdr_flags & GTPU_E_S_PN_BIT);
+ gtpu0->ver_flags = GTPU_EXT_HDR_PRESENT;
+ gtpu0->pdu_number = 0x00;
+ gtpu0->sequence = 0x00;
+ gtpu0->next_ext_type = GTPU_EXT_HDR_PDU_SESSION_CONTAINER;
+
+ gtpu0_ext = (gtpu_ext_header_t *) (gtpu0 + 1);
+ gtpu0_ext->type = 0x01;
+ gtpu0_ext->len = 0x00;
+ gtpu0_ext->pad = GTPU_QFI;
}
else /* ip6 path */
--- a/src/plugins/upf/upf.h 2021-03-07 13:19:40.937167871 +0000
+++ b/src/plugins/upf/upf.h 2021-03-07 12:51:36.726939875 +0000
@@ -167,7 +167,8 @@
}) gtpu_ie_recovery_t;
/* *INDENT-ON* */
-#define GTPU_V1_HDR_LEN 8
+#define GTPU_V1_HDR_LEN 8
+#define GTPU_V1_EXT_HDR_LEN 8
#define GTPU_VER_MASK (7<<5)
#define GTPU_PT_BIT (1<<4)
@@ -187,6 +188,11 @@
#define GTPU_IE_RECOVERY 14
+#define GTPU_EXT_HDR_PRESENT 52
+#define GTPU_EXT_HDR_PDU_SESSION_CONTAINER 133
+#define GTPU_NO_MORE_EXT_HDR 0
+#define GTPU_QFI 6
+
/* *INDENT-OFF* */
typedef CLIB_PACKED(struct
{
......@@ -6,8 +6,8 @@ fi
base=$(dirname $0)
APP="/openair-upf/bin/vpp"
ARGS="-c /openair-upf/bin/startup_debug.conf"
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup_debug.conf"
USAGE="Usage: run.sh [-r] [ debug ]
debug: executes vpp under gdb"
......@@ -15,8 +15,8 @@ USAGE="Usage: run.sh [-r] [ debug ]
while getopts ":r" opt; do
case $opt in
r)
APP="/openair-upf/bin/vpp"
ARGS="-c $base/startup.conf"
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup.conf"
;;
\?)
echo "Invalid option: -$OPTARG\n" >&2
......
<?xml version="1.0" encoding="UTF-8"?>
<dst:devsol xmlns:dst="http://www.developingsolutions.com/schema/dsTest" test_name="Local Library/upf_test_multiple_ue.dsx">
<!-- XML generated by dsClientv5.5.20201109 on 02/24/2021 11:11:24 using dsTest schema v5.5.20210117 -->
<config>
<nodes>
<spr name="spr_gnb">
<auto_start>true</auto_start>
<subscriber_database count="2" name="gnb_subs">
<subscriber_profiles>
<access_profile name="access_profile">
<new_radio_128_nea0_encryption>true</new_radio_128_nea0_encryption>
<new_radio_128_nia1_integrity>true</new_radio_128_nia1_integrity>
<requested_nssai>
<s_nssai>
<sst>222</sst>
<sd>123</sd>
</s_nssai>
<s_nssai>
<sst>75</sst>
<sd>2</sd>
</s_nssai>
</requested_nssai>
<ssc_mode>1</ssc_mode>
</access_profile>
<subscription_profile name="subscription_profile">
<pdu_config>
<context_id>34</context_id>
<type>IPv4</type>
<dnn>default</dnn>
<s_nssai>
<sst>222</sst>
<sd>123</sd>
</s_nssai>
<up_transport_address>172.10.5.1</up_transport_address>
</pdu_config>
</subscription_profile>
<user_data_profile name="user_data_profile_1">
<delay>500</delay>
<basic_data name="basic_data">
<dest_ip>8.8.8.8</dest_ip>
<protocol>UDP</protocol>
<dport>5001</dport>
<sport>5001</sport>
<size>1024</size>
<rate>10</rate>
<auto_start>true</auto_start>
<auto_stop>5000</auto_stop>
</basic_data>
</user_data_profile>
<SmartProfile name="SmartProfile">
<SmartEvents>
<states>
<state start_point="133.6,81.6" width="100.0" height="60.0">idle</state>
<state start_point="366.1,81.6" width="100.0" height="60.0">pdu_setup</state>
<state start_point="510.1,193.6" width="100.0" height="60.0">pdu_delete</state>
<state start_point="381.6,337.6" width="100.0" height="60.0">detach</state>
<state start_point="157.6,341.6" width="100.0" height="60.0">ending</state>
</states>
<event_handlers>
<event_handler start_point="144.1,82.1" end_point="224.1,82.1" height="-68">
<current_state>idle</current_state>
<transaction_start/>
<action>
<app>n2</app>
<event>registration</event>
<node>gnb_1</node>
</action>
</event_handler>
<event_handler start_point="234.1,112.1" end_point="366.6,112.1" height="-92">
<current_state>idle</current_state>
<event_received app="n2" event="registration"/>
<next_state>pdu_setup</next_state>
<timer>2000</timer>
</event_handler>
<event_handler start_point="376.6,82.1" end_point="456.6,82.1" height="-92">
<current_state>pdu_setup</current_state>
<timeout/>
<action>
<app>n2</app>
<event>pdu_session_establish</event>
<node>gnb_1</node>
<dnn>carrier.com</dnn>
</action>
</event_handler>
<event_handler start_point="466.6,112.1" end_point="560.6,194.1" height="-72">
<current_state>pdu_setup</current_state>
<event_received app="n2" event="pdu_session_establish"/>
<next_state>pdu_delete</next_state>
<timer>500000000</timer>
</event_handler>
<event_handler start_point="610.6,204.1" end_point="610.6,244.1" height="68">
<current_state>pdu_delete</current_state>
<timeout/>
<action>
<app>n2</app>
<event>pdu_session_release</event>
<node>gnb_1</node>
<dnn>default</dnn>
</action>
</event_handler>
<event_handler start_point="560.6,254.1" end_point="482.1,368.1" height="-92">
<current_state>pdu_delete</current_state>
<event_received app="n2" event="pdu_session_release"/>
<next_state>detach</next_state>
<timer>2000</timer>
</event_handler>
<event_handler start_point="382.1,368.1" end_point="258.1,372.1" height="-68">
<current_state>detach</current_state>
<timeout/>
<action>
<app>n2</app>
<event>deregistration</event>
<node>gnb_1</node>
</action>
<next_state>ending</next_state>
</event_handler>
<event_handler start_point="208.1,342.1" end_point="184.1,142.1" height="-52">
<current_state>ending</current_state>
<event_received app="n2" event="deregistration"/>
<transaction_complete/>
</event_handler>
<event_handler start_point="109.4,279.0" end_point="134.1,132.1" height="-72">
<current_state>ANY</current_state>
<error/>
<transaction_failed/>
</event_handler>
</event_handlers>
</SmartEvents>
</SmartProfile>
</subscriber_profiles>
<subscriber_group start="1" end="2" name="subscriber_group">
<group_profiles>
<access_profile>access_profile</access_profile>
<subscription_profile>subscription_profile</subscription_profile>
<user_data_profile>user_data_profile_1</user_data_profile>
<SmartProfile>SmartProfile</SmartProfile>
</group_profiles>
<identities>
<imsi>208950000000031</imsi>
<imei>55000000000001</imei>
<key>0x0C0A34601D4F07677303652C0462535B</key>
<opc>0x63bfa50ee6523365ff14c1f45f88737d</opc>
</identities>
<dynamic_information>
<sqn>0x40</sqn>
<vplmn>431-265</vplmn>
<cell_id>1485</cell_id>
</dynamic_information>
</subscriber_group>
</subscriber_database>
</spr>
<gnb name="gnb_1">
<auto_start>true</auto_start>
<n2>
<interface name="interface_1" native="true">
<sctp>
<ip_address>192.168.61.193</ip_address>
<dest_ip_address>192.168.61.195</dest_ip_address>
</sctp>
<user_socket>
<ip_address>192.168.61.193</ip_address>
</user_socket>
</interface>
<user_data>
<basic_data name="basic_data"/>
</user_data>
</n2>
<mcc>208</mcc>
<mnc>95</mnc>
<node_name>gnb-1</node_name>
<global_gnb_id>1048575</global_gnb_id>
<default_paging_drx>v32</default_paging_drx>
<supported_ta>
<tac>0xa000</tac>
<bplmn>
<mcc>208</mcc>
<mnc>95</mnc>
<slice_support_item>
<nssai_sst>222</nssai_sst>
<nssai_sd>123</nssai_sd>
</slice_support_item>
<slice_support_item>
<nssai_sst>0x27</nssai_sst>
<nssai_sd>0x385382</nssai_sd>
</slice_support_item>
</bplmn>
<bplmn>
<mcc>207</mcc>
<mnc>54</mnc>
<slice_support_item>
<nssai_sst>0x10</nssai_sst>
<nssai_sd>0x583922</nssai_sd>
</slice_support_item>
</bplmn>
</supported_ta>
<supported_ta>
<tac>0xa001</tac>
<bplmn>
<mcc>202</mcc>
<mnc>100</mnc>
<slice_support_item>
<nssai_sst>0x23</nssai_sst>
<nssai_sd>0x321236</nssai_sd>
</slice_support_item>
</bplmn>
<bplmn>
<mcc>203</mcc>
<mnc>001</mnc>
<slice_support_item>
<nssai_sst>0xFF</nssai_sst>
<nssai_sd>0x123483</nssai_sd>
</slice_support_item>
</bplmn>
</supported_ta>
<subscriber_database name="gnb_subs"/>
</gnb>
</nodes>
</config>
<command>
<wait>1000</wait>
</command>
<command>
<spr name="spr_gnb">
<action>
<rate>1</rate>
<cycle>1</cycle>
<start>1</start>
<end>2</end>
<ready>gnb_1</ready>
<app>SmartEvents</app>
<event>start</event>
</action>
</spr>
</command>
</dst:devsol>
......@@ -12,8 +12,8 @@ services:
volumes:
- ./oai_db.sql:/oai_db.sql
oai_smf:
image: oai-smf:latest
oai-smf:
image: oai-smf:vpp-upf
container_name: oai-smf
privileged: true
networks:
......@@ -29,13 +29,14 @@ services:
SMF_API_VERSION: v1
DEFAULT_DNS_IPV4_ADDRESS: 8.8.8.8
DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4
UE_IP_ADDRESS_POOL: '10.1.1.2 - 10.1.1.200'
AMF_IPV4_ADDRESS: 192.168.61.195
AMF_PORT: 80
AMF_API_VERSION: v1
UDM_IPV4_ADDRESS: 192.168.61.194
UDM_PORT: 80
UDM_API_VERSION: v1
UPF_IPV4_ADDRESS: '192.168.61.201'
UPF_IPV4_ADDRESS: 192.168.61.201
entrypoint: /bin/bash -c \
"./bin/entrypoint.sh; ./bin/oai_smf -o -c etc/smf.conf; sleep infinity"
healthcheck:
......@@ -43,9 +44,11 @@ services:
interval: 10s
timeout: 5s
retries: 5
extra_hosts:
- "gw1.vppupf.node.epc.mnc95.mcc208.3gppnetwork.org:192.168.61.201"
oai_amf:
image: oai-amf:latest
oai-amf:
image: oai-amf:develop
container_name: oai-amf
privileged: true
networks:
......@@ -94,6 +97,8 @@ services:
OPERATOR_KEY: '63bfa50ee6523365ff14c1f45f88737d'
entrypoint: /bin/bash -c \
"./bin/entrypoint.sh; ./bin/oai_amf -o -c etc/amf.conf; sleep infinity"
volumes:
- ./entrypoint.sh:/openair-amf/bin/entrypoint.sh
healthcheck:
test: /bin/bash -c "pgrep oai_smf"
interval: 10s
......@@ -103,7 +108,7 @@ services:
oai-vpp:
image: vpp-upg:latest
privileged: true
container_name: oai-spgwu
container_name: oai-vpp-upf
networks:
public_net_access:
ipv4_address: 192.168.62.197
......@@ -111,40 +116,87 @@ services:
ipv4_address: 192.168.61.197
public_net_sgi_lan:
ipv4_address: 192.168.63.197
volumes:
- ./upf_conf/init.conf:/openair-upf/bin/init.conf
- ./upf_conf/rc.local:/openair-upf/bin/rc.local
- ./upf_conf/startup_debug.conf:/openair-upf/bin/startup_debug.conf
entrypoint: /bin/bash -c \
"./rc.local; ./run.sh; sleep infinity"
environment:
NWI_CORE : "core.oai"
NWI_ACCESS : "access.oai"
NWI_SGI : "sgi.oai"
# NWI_SGI_SEC: "sgi.secondary.oai" # To Do - Traffic sterring or traffic redirection or I-UPF (N9)
GW_ID: "1"
MNC03: "95"
MCC : "208"
REALM: "3gppnetwork.org"
NETWORK_UE_IP: "12.1.1.0/24"
N3_IPV4_ADDRESS_REMOTE: "192.168.62.198"
N3_IPV4_ADDRESS_LOCAL : "192.168.62.201"
N4_IPV4_ADDRESS_REMOTE: "192.168.61.196"
N4_IPV4_ADDRESS_LOCAL : "192.168.61.201"
N6_IPV4_ADDRESS_REMOTE: "192.168.63.205"
N6_IPV4_ADDRESS_LOCAL : "192.168.63.201"
VPP_MAIN_CORE : 0
VPP_CORE_WORKER: 1
# entrypoint: /bin/bash -c "/openair-upf/bin/entrypoint.sh;./run.sh; sleep infinity"
oai_nat:
oai-spgwu:
image: oai-spgwu-tiny:gtp_ext_header
privileged: true
container_name: oai-spgwu
networks:
public_net:
ipv4_address: 192.168.61.199
environment:
INSTANCE: 1
PID_DIRECTORY: /var/run
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: "eth0"
SGW_INTERFACE_NAME_FOR_SX: "eth0"
PGW_INTERFACE_NAME_FOR_SGI: "eth0"
SPGWC0_IP_ADDRESS: "192.168.61.196"
NETWORK_UE_IP: "10.1.1.0/24"
NETWORK_UE_NAT_OPTION: "yes"
NRF_IPV4_ADDRESS: "192.168.1.23"
NRF_PORT: "8080"
NRF_API_VERSION: "v1"
GW_ID: "1"
MNC03: "95"
MCC: "208"
REALM: "3gppnetwork.org"
THREAD_S1U_PRIO: "64"
S1U_THREADS: "16"
THREAD_SX_PRIO: "64"
SX_THREADS: "1"
THREAD_SGI_PRIO: "64"
SGI_THREADS: "16"
GTP_EXTENSION_HEADER_PRESENT: "no"
BYPASS_UL_PFCP_RULES: "no"
oai-nat:
image: ubuntu:bionic
privileged: true
container_name: oai-nat
networks:
public_net:
ipv4_address: 192.168.61.205
public_net_sgi_lan:
ipv4_address: 192.168.63.194
ipv4_address: 192.168.63.205
entrypoint: /bin/bash -c \
"apt update; apt install -y iptables iproute2;"\
"apt update; apt install -y iptables iproute2 iputils-ping net-tools python iperf3;"\
"iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\
"ip route add 12.1.1.0/24 via 192.168.63.197 dev eth0; sleep infinity"
"ip route add 10.1.1.0/24 via 192.168.61.199 dev eth0;"\
"ip route add 12.1.1.0/24 via 192.168.63.201 dev eth1; sleep infinity"
networks:
public_net:
name: oai-public-net
ipam:
config:
- subnet: 192.168.61.192/26
- subnet: 192.168.61.192/24
public_net_access:
name: oai-public-access
ipam:
config:
- subnet: 192.168.62.192/26
- subnet: 192.168.62.192/24
public_net_sgi_lan:
name: oai-public-sgi-lan
ipam:
config:
- subnet: 192.168.63.192/26
- subnet: 192.168.63.192/24
......@@ -2,37 +2,34 @@ ip table add 1
ip table add 2
create host-interface name sgi
set interface mac address host-sgi 00:0c:29:46:1f:53
set interface mtu 1500 host-sgi
set interface ip table host-sgi 1
set interface ip address host-sgi 192.168.63.201/26
set interface ip address host-sgi @N6_IPV4_ADDRESS_LOCAL@/24
set interface state host-sgi up
create host-interface name core
set interface mac address host-core 00:0c:29:46:1f:54
set interface mtu 1500 host-core
set interface ip table host-core 0
set interface ip address host-core 192.168.61.201/26
set interface ip address host-core @N4_IPV4_ADDRESS_LOCAL@/24
set interface state host-core up
create host-interface name access
set interface mac address host-access 00:0c:29:46:1f:55
set interface mtu 1500 host-access
set interface ip table host-access 2
set interface ip address host-access 192.168.62.201/26
set interface ip address host-access @N3_IPV4_ADDRESS_LOCAL@/24
set interface state host-access up
ip route add 0.0.0.0/0 table 2 via 192.168.62.210 host-access
ip route add 0.0.0.0/0 table 0 via 192.168.61.196 host-core
ip route add 0.0.0.0/0 table 1 via 192.168.63.194 host-sgi
ip route add 0.0.0.0/0 table 2 via @N3_IPV4_ADDRESS_REMOTE@ host-access
ip route add 0.0.0.0/0 table 0 via @N4_IPV4_ADDRESS_REMOTE@ host-core
ip route add 0.0.0.0/0 table 1 via @N6_IPV4_ADDRESS_REMOTE@ host-sgi
upf pfcp endpoint ip 192.168.61.201 vrf 0
upf pfcp endpoint ip @N4_IPV4_ADDRESS_LOCAL@ vrf 0
upf node-id fqdn gw@GW_ID@.vppupf.node.epc.mnc@MNC03@.mcc@MCC@.@REALM@
upf nwi name core vrf 0
upf nwi name access vrf 2
upf nwi name sgi vrf 1
upf nwi name @NWI_CORE@ vrf 0
upf nwi name @NWI_ACCESS@ vrf 2
upf nwi name @NWI_SGI@ vrf 1
upf specification release 16
trace add af-packet-input 100
upf gtpu endpoint ip 192.168.62.201 nwi access teid 0x000004d2/2
upf gtpu endpoint ip @N3_IPV4_ADDRESS_LOCAL@ nwi @NWI_ACCESS@ teid 0x000004d2/2
......@@ -5,13 +5,18 @@ unix {
gid vpp
interactive
cli-listen /run/vpp/cli.sock
exec init.conf
exec /openair-upf/etc/init.conf
}
api-trace {
on
}
#cpu {
# main-core 0
# corelist-workers 1
#}
api-segment {
gid vpp
}
......@@ -22,3 +27,4 @@ plugins {
plugin gtpu_plugin.so { disable }
plugin upf_plugin.so { enable }
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment