[UPF] Tested all platforms on open5gs (#1022)
This commit is contained in:
parent
8dab1852cc
commit
5d460b0577
|
@ -20,6 +20,7 @@ Build-Depends: debhelper (>= 11),
|
||||||
libmicrohttpd-dev,
|
libmicrohttpd-dev,
|
||||||
libcurl4-gnutls-dev,
|
libcurl4-gnutls-dev,
|
||||||
libnghttp2-dev,
|
libnghttp2-dev,
|
||||||
|
libtins-dev,
|
||||||
Standards-Version: 4.3.0
|
Standards-Version: 4.3.0
|
||||||
Rules-Requires-Root: no
|
Rules-Requires-Root: no
|
||||||
Homepage: https://open5gs.org
|
Homepage: https://open5gs.org
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
ARG dist=centos
|
|
||||||
ARG tag=latest
|
|
||||||
FROM ${dist}:${tag}
|
|
||||||
|
|
||||||
MAINTAINER Sukchan Lee <acetcom@gmail.com>
|
|
||||||
|
|
||||||
RUN yum -y install epel-release
|
|
||||||
#RUN yum -y install https://centos7.iuscommunity.org/ius-release.rpm
|
|
||||||
RUN yum -y update
|
|
||||||
|
|
||||||
RUN yum -y install \
|
|
||||||
python3 \
|
|
||||||
ninja-build \
|
|
||||||
gcc \
|
|
||||||
flex \
|
|
||||||
bison \
|
|
||||||
git \
|
|
||||||
meson \
|
|
||||||
lksctp-tools-devel \
|
|
||||||
libidn-devel \
|
|
||||||
gnutls-devel \
|
|
||||||
libgcrypt-devel \
|
|
||||||
openssl-devel \
|
|
||||||
cyrus-sasl-devel \
|
|
||||||
libyaml-devel \
|
|
||||||
mongo-c-driver-devel \
|
|
||||||
libmicrohttpd-devel \
|
|
||||||
libcurl-devel \
|
|
||||||
libnghttp2-devel \
|
|
||||||
iproute
|
|
|
@ -1 +0,0 @@
|
||||||
../8/dev
|
|
|
@ -1 +0,0 @@
|
||||||
latest
|
|
|
@ -1,37 +0,0 @@
|
||||||
ARG dist=centos
|
|
||||||
ARG tag=latest
|
|
||||||
FROM ${dist}:${tag}
|
|
||||||
|
|
||||||
MAINTAINER Sukchan Lee <acetcom@gmail.com>
|
|
||||||
|
|
||||||
RUN dnf -y install epel-release && \
|
|
||||||
dnf -y install 'dnf-command(config-manager)' && \
|
|
||||||
dnf config-manager --set-enabled PowerTools && \
|
|
||||||
dnf -y update
|
|
||||||
|
|
||||||
RUN dnf -y install \
|
|
||||||
https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm && \
|
|
||||||
dnf config-manager --set-enabled elrepo-testing && \
|
|
||||||
dnf -y update
|
|
||||||
|
|
||||||
RUN dnf -y install \
|
|
||||||
python3 \
|
|
||||||
ninja-build \
|
|
||||||
gcc \
|
|
||||||
flex \
|
|
||||||
bison \
|
|
||||||
git \
|
|
||||||
lksctp-tools-devel \
|
|
||||||
libidn-devel \
|
|
||||||
gnutls-devel \
|
|
||||||
libgcrypt-devel \
|
|
||||||
openssl-devel \
|
|
||||||
cyrus-sasl-devel \
|
|
||||||
libyaml-devel \
|
|
||||||
mongo-c-driver-devel \
|
|
||||||
libmicrohttpd-devel \
|
|
||||||
libcurl-devel \
|
|
||||||
libnghttp2-devel \
|
|
||||||
iproute
|
|
||||||
|
|
||||||
RUN dnf -y install meson
|
|
|
@ -1,22 +0,0 @@
|
||||||
ARG dist=centos
|
|
||||||
ARG tag=latest
|
|
||||||
ARG username=acetcom
|
|
||||||
FROM ${username}/${dist}-${tag}-open5gs-base
|
|
||||||
|
|
||||||
MAINTAINER Sukchan Lee <acetcom@gmail.com>
|
|
||||||
|
|
||||||
RUN yum -y install \
|
|
||||||
cscope \
|
|
||||||
vim \
|
|
||||||
sudo \
|
|
||||||
iputils \
|
|
||||||
net-tools
|
|
||||||
|
|
||||||
COPY setup.sh /root
|
|
||||||
|
|
||||||
ARG username=acetcom
|
|
||||||
RUN useradd -m --uid=1000 ${username} && \
|
|
||||||
echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \
|
|
||||||
chmod 0440 /etc/sudoers.d/${username}
|
|
||||||
|
|
||||||
WORKDIR /home/${username}
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if ! grep "ogstun" /proc/net/dev > /dev/null; then
|
|
||||||
ip tuntap add name ogstun mode tun
|
|
||||||
fi
|
|
||||||
ip addr del 10.45.0.1/16 dev ogstun 2> /dev/null
|
|
||||||
ip addr add 10.45.0.1/16 dev ogstun
|
|
||||||
ip addr del 2001:230:cafe::1/48 dev ogstun 2> /dev/null
|
|
||||||
ip addr add 2001:230:cafe::1/48 dev ogstun
|
|
||||||
ip link set ogstun up
|
|
|
@ -9,9 +9,6 @@ TAG=bionic docker-compose -f docker-compose.yml -f docker-compose.test.yml run -
|
||||||
DIST=fedora TAG=32 docker-compose build
|
DIST=fedora TAG=32 docker-compose build
|
||||||
DIST=fedora TAG=32 docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm test
|
DIST=fedora TAG=32 docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm test
|
||||||
|
|
||||||
DIST=centos docker-compose build
|
|
||||||
DIST=centos docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm test
|
|
||||||
|
|
||||||
DIST=debian docker-compose build
|
DIST=debian docker-compose build
|
||||||
DIST=debian docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm test
|
DIST=debian docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm test
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ RUN apt-get update && \
|
||||||
libmicrohttpd-dev \
|
libmicrohttpd-dev \
|
||||||
libcurl4-gnutls-dev \
|
libcurl4-gnutls-dev \
|
||||||
libnghttp2-dev \
|
libnghttp2-dev \
|
||||||
|
libtins-dev \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
netbase \
|
netbase \
|
||||||
|
|
|
@ -8,6 +8,7 @@ RUN dnf -y install \
|
||||||
python3 \
|
python3 \
|
||||||
ninja-build \
|
ninja-build \
|
||||||
gcc \
|
gcc \
|
||||||
|
gcc-c++ \
|
||||||
flex \
|
flex \
|
||||||
bison \
|
bison \
|
||||||
git \
|
git \
|
||||||
|
|
|
@ -28,6 +28,7 @@ RUN apt-get update && \
|
||||||
libmicrohttpd-dev \
|
libmicrohttpd-dev \
|
||||||
libcurl4-gnutls-dev \
|
libcurl4-gnutls-dev \
|
||||||
libnghttp2-dev \
|
libnghttp2-dev \
|
||||||
|
libtins-dev \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
netbase \
|
netbase \
|
||||||
|
|
|
@ -112,6 +112,7 @@ https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbunt
|
||||||
https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_19.10/
|
https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_19.10/
|
||||||
https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_20.04/
|
https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_20.04/
|
||||||
https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_20.10/
|
https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_20.10/
|
||||||
|
https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_21.04/
|
||||||
```
|
```
|
||||||
|
|
||||||
#### openSUSE
|
#### openSUSE
|
||||||
|
|
|
@ -44,7 +44,7 @@ $ sudo ip link set ogstun up
|
||||||
Install the dependencies for building the source code.
|
Install the dependencies for building the source code.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo apt install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libnghttp2-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev meson
|
$ sudo apt install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libnghttp2-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev libtins-dev meson
|
||||||
```
|
```
|
||||||
|
|
||||||
Git clone.
|
Git clone.
|
||||||
|
|
|
@ -109,7 +109,7 @@ a base CentOS 8 installation.
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo dnf install python3 meson ninja-build gcc flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel mongo-c-driver-devel libmicrohttpd-devel libcurl-devel libnghttp2-devel
|
$ sudo dnf install python3 meson ninja-build gcc gcc-c++ flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel mongo-c-driver-devel libmicrohttpd-devel libcurl-devel libnghttp2-devel
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install the SCTP kernel module in kernel-modules-extra.
|
### Install the SCTP kernel module in kernel-modules-extra.
|
||||||
|
|
|
@ -70,7 +70,7 @@ $ ip link show
|
||||||
|
|
||||||
Install the depedencies for building the source code.
|
Install the depedencies for building the source code.
|
||||||
```bash
|
```bash
|
||||||
$ sudo dnf install python3 ninja-build gcc flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel mongo-c-driver-devel libmicrohttpd-devel libcurl-devel libnghttp2-devel iproute
|
$ sudo dnf install python3 ninja-build gcc gcc-c++ flex bison git lksctp-tools-devel libidn-devel gnutls-devel libgcrypt-devel openssl-devel cyrus-sasl-devel libyaml-devel mongo-c-driver-devel libmicrohttpd-devel libcurl-devel libnghttp2-devel iproute
|
||||||
```
|
```
|
||||||
|
|
||||||
Install Meson
|
Install Meson
|
||||||
|
|
|
@ -89,7 +89,7 @@ $ sudo pfctl -e -f /etc/pf.anchors/org.open5gs
|
||||||
|
|
||||||
Install the depedencies for building the source code.
|
Install the depedencies for building the source code.
|
||||||
```bash
|
```bash
|
||||||
$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd nghttp2 pkg-config bison libusrsctp
|
$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd nghttp2 pkg-config bison libusrsctp libtins
|
||||||
```
|
```
|
||||||
|
|
||||||
Configure Homebrew PATH
|
Configure Homebrew PATH
|
||||||
|
@ -97,6 +97,7 @@ Configure Homebrew PATH
|
||||||
$ export PATH="/opt/homebrew/opt/bison/bin:/opt/homebrew/bin:$PATH"
|
$ export PATH="/opt/homebrew/opt/bison/bin:/opt/homebrew/bin:$PATH"
|
||||||
$ export LIBRARY_PATH=/opt/homebrew/lib
|
$ export LIBRARY_PATH=/opt/homebrew/lib
|
||||||
$ export C_INCLUDE_PATH=/opt/homebrew/include
|
$ export C_INCLUDE_PATH=/opt/homebrew/include
|
||||||
|
$ export CPLUS_INCLUDE_PATH=/opt/homebrew/include
|
||||||
```
|
```
|
||||||
|
|
||||||
Install Meson using Homebrew.
|
Install Meson using Homebrew.
|
||||||
|
@ -104,10 +105,6 @@ Install Meson using Homebrew.
|
||||||
$ brew install meson
|
$ brew install meson
|
||||||
```
|
```
|
||||||
|
|
||||||
Install libtins.
|
|
||||||
|
|
||||||
Follow the instructions at https://libtins.github.io to install libtins.
|
|
||||||
|
|
||||||
Git clone.
|
Git clone.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -89,7 +89,7 @@ $ sudo pfctl -e -f /etc/pf.anchors/org.open5gs
|
||||||
|
|
||||||
Install the depedencies for building the source code.
|
Install the depedencies for building the source code.
|
||||||
```bash
|
```bash
|
||||||
$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd nghttp2 pkg-config libusrsctp
|
$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd nghttp2 pkg-config libusrsctp libtins
|
||||||
```
|
```
|
||||||
|
|
||||||
Install Bison and Create soft link.
|
Install Bison and Create soft link.
|
||||||
|
@ -103,10 +103,6 @@ Install Meson using Homebrew.
|
||||||
$ brew install meson
|
$ brew install meson
|
||||||
```
|
```
|
||||||
|
|
||||||
Install libtins.
|
|
||||||
|
|
||||||
Follow the instructions at https://libtins.github.io to install libtins.
|
|
||||||
|
|
||||||
Git clone.
|
Git clone.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -121,10 +121,6 @@ $ export LIBRARY_PATH=/usr/local/lib
|
||||||
$ export C_INCLUDE_PATH=/usr/local/include
|
$ export C_INCLUDE_PATH=/usr/local/include
|
||||||
```
|
```
|
||||||
|
|
||||||
Install libtins.
|
|
||||||
|
|
||||||
Follow the instructions at https://libtins.github.io to install libtins.
|
|
||||||
|
|
||||||
Git clone.
|
Git clone.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -27,12 +27,14 @@
|
||||||
using namespace::Tins;
|
using namespace::Tins;
|
||||||
|
|
||||||
|
|
||||||
void _serialize_reply(uint8_t *reply_data, EthernetII &reply) {
|
void _serialize_reply(uint8_t *reply_data, EthernetII &reply)
|
||||||
|
{
|
||||||
PDU::serialization_type serialized = reply.serialize();
|
PDU::serialization_type serialized = reply.serialize();
|
||||||
memcpy(reply_data, serialized.data(), reply.size());
|
memcpy(reply_data, serialized.data(), reply.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _parse_arp(EthernetII &pdu) {
|
bool _parse_arp(EthernetII &pdu)
|
||||||
|
{
|
||||||
if (pdu.payload_type() == ETHERTYPE_ARP) {
|
if (pdu.payload_type() == ETHERTYPE_ARP) {
|
||||||
const ARP& arp = pdu.rfind_pdu<ARP>();
|
const ARP& arp = pdu.rfind_pdu<ARP>();
|
||||||
return arp.opcode() == ARP::REQUEST && pdu.dst_addr().is_broadcast();
|
return arp.opcode() == ARP::REQUEST && pdu.dst_addr().is_broadcast();
|
||||||
|
@ -46,7 +48,9 @@ bool is_arp_req(uint8_t *data, uint len)
|
||||||
return _parse_arp(pdu);
|
return _parse_arp(pdu);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool arp_reply(uint8_t *reply_data, uint8_t *request_data, uint len, const uint8_t *mac) {
|
bool arp_reply(uint8_t *reply_data, uint8_t *request_data, uint len,
|
||||||
|
const uint8_t *mac)
|
||||||
|
{
|
||||||
EthernetII pdu(request_data, len);
|
EthernetII pdu(request_data, len);
|
||||||
if (_parse_arp(pdu)) {
|
if (_parse_arp(pdu)) {
|
||||||
HWAddress<ETHER_ADDR_LEN> source_mac(mac);
|
HWAddress<ETHER_ADDR_LEN> source_mac(mac);
|
||||||
|
@ -62,7 +66,8 @@ bool arp_reply(uint8_t *reply_data, uint8_t *request_data, uint len, const uint8
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _parse_nd(EthernetII &pdu) {
|
bool _parse_nd(EthernetII &pdu)
|
||||||
|
{
|
||||||
if (pdu.payload_type() == ETHERTYPE_IPV6) {
|
if (pdu.payload_type() == ETHERTYPE_IPV6) {
|
||||||
const ICMPv6& icmp6 = pdu.rfind_pdu<ICMPv6>();
|
const ICMPv6& icmp6 = pdu.rfind_pdu<ICMPv6>();
|
||||||
return icmp6.type() == ICMPv6::NEIGHBOUR_SOLICIT;
|
return icmp6.type() == ICMPv6::NEIGHBOUR_SOLICIT;
|
||||||
|
@ -79,7 +84,9 @@ bool is_nd_req(uint8_t *data, uint len)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nd_reply(uint8_t *reply_data, uint8_t *request_data, uint len, const uint8_t *mac) {
|
bool nd_reply(uint8_t *reply_data, uint8_t *request_data, uint len,
|
||||||
|
const uint8_t *mac)
|
||||||
|
{
|
||||||
EthernetII pdu(request_data, len);
|
EthernetII pdu(request_data, len);
|
||||||
if (_parse_nd(pdu)) {
|
if (_parse_nd(pdu)) {
|
||||||
HWAddress<ETHER_ADDR_LEN> source_mac(mac);
|
HWAddress<ETHER_ADDR_LEN> source_mac(mac);
|
||||||
|
|
|
@ -39,11 +39,12 @@ extern "C" {
|
||||||
|
|
||||||
void set_source_mac(uint8_t *data);
|
void set_source_mac(uint8_t *data);
|
||||||
bool is_arp_req(uint8_t *data, uint len);
|
bool is_arp_req(uint8_t *data, uint len);
|
||||||
bool arp_reply(uint8_t *reply_data, uint8_t *request_data, uint len, const uint8_t *mac);
|
bool arp_reply(uint8_t *reply_data, uint8_t *request_data, uint len,
|
||||||
|
const uint8_t *mac);
|
||||||
bool is_nd_req(uint8_t *data, uint len);
|
bool is_nd_req(uint8_t *data, uint len);
|
||||||
bool nd_reply(uint8_t *reply_data, uint8_t *request_data, uint len, const uint8_t *mac);
|
bool nd_reply(uint8_t *reply_data, uint8_t *request_data, uint len,
|
||||||
|
const uint8_t *mac);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -66,30 +66,44 @@ libupf_sources = files('''
|
||||||
pfcp-path.c
|
pfcp-path.c
|
||||||
n4-build.c
|
n4-build.c
|
||||||
n4-handler.c
|
n4-handler.c
|
||||||
arp-nd.h
|
|
||||||
'''.split())
|
'''.split())
|
||||||
|
|
||||||
tins_dep = cc.find_library('tins', required : true)
|
libtins_dep = dependency('libtins',
|
||||||
|
version: ['>=3.4'],
|
||||||
|
fallback: ['libtins', 'libtins_dep'])
|
||||||
|
|
||||||
libarp_nd = static_library('arp_nd',
|
libarp_nd = static_library('arp_nd',
|
||||||
sources : files('''
|
sources : files('''
|
||||||
arp-nd.cpp
|
arp-nd.cpp
|
||||||
arp-nd.h
|
arp-nd.h
|
||||||
'''.split()),
|
'''.split()),
|
||||||
dependencies : tins_dep,
|
dependencies : libtins_dep,
|
||||||
install : false)
|
install : false)
|
||||||
libarp_nd_dep = declare_dependency(link_with : libarp_nd, dependencies : tins_dep)
|
libarp_nd_dep = declare_dependency(
|
||||||
|
link_with : libarp_nd,
|
||||||
|
dependencies : libtins_dep)
|
||||||
|
|
||||||
libupf = static_library('upf',
|
libupf = static_library('upf',
|
||||||
sources : libupf_sources,
|
sources : libupf_sources,
|
||||||
dependencies : [
|
dependencies : [
|
||||||
libapp_dep, libdiameter_gx_dep, libgtp_dep, libpfcp_dep, libtun_dep, libarp_nd_dep,
|
libapp_dep,
|
||||||
|
libdiameter_gx_dep,
|
||||||
|
libgtp_dep,
|
||||||
|
libpfcp_dep,
|
||||||
|
libtun_dep,
|
||||||
|
libarp_nd_dep,
|
||||||
],
|
],
|
||||||
install : false)
|
install : false)
|
||||||
|
|
||||||
libupf_dep = declare_dependency(
|
libupf_dep = declare_dependency(
|
||||||
link_with : libupf,
|
link_with : libupf,
|
||||||
dependencies : [
|
dependencies : [
|
||||||
libapp_dep, libdiameter_gx_dep, libgtp_dep, libpfcp_dep, libtun_dep, libarp_nd_dep,
|
libapp_dep,
|
||||||
|
libdiameter_gx_dep,
|
||||||
|
libgtp_dep,
|
||||||
|
libpfcp_dep,
|
||||||
|
libtun_dep,
|
||||||
|
libarp_nd_dep,
|
||||||
])
|
])
|
||||||
|
|
||||||
upf_sources = files('''
|
upf_sources = files('''
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
[wrap-git]
|
||||||
|
directory = libtins
|
||||||
|
url = https://github.com/open5gs/libtins.git
|
||||||
|
revision = r4.3
|
Loading…
Reference in New Issue