Compare commits

..

11 Commits

Author SHA1 Message Date
Oliver Smith 746e2a3405 Release v2.7.0~sysmocom2 2024-04-09 15:02:11 +02:00
Oliver Smith efd777fca8 lib/dbi/ogs-monoc: add MONGOC_CHECK_VERSION stub 2024-04-09 15:02:11 +02:00
Daniel Willmann 782c40aad3 Release new version 2024-04-09 14:05:11 +02:00
Oliver Smith df6ec47f88 debian: remove open5gs-hss 2024-04-09 14:05:11 +02:00
Alexander Couzens 5759f4a6af add missing stuff to remove mongodb 2024-04-09 14:05:11 +02:00
Daniel Willmann 0afa4ccf16 Use default APN if the one from the ESM info resp could not be found 2024-04-09 14:05:11 +02:00
Alexander Couzens def65362d0 example config: some thoughs about static profiles 2024-04-09 14:05:10 +02:00
Alexander Couzens 056e5d0fd3 WIP: PCRF: use a harded profile as session data
Allow to attach with default bearer without mongodb. No secondary bearer or IMS is supported
right now.
2024-04-09 14:05:10 +02:00
Alexander Couzens 1c99b1a485 FIXME: remove dependency mongodb. FIXME: use get_option() to dynamic depend on mongodb 2024-04-09 14:05:10 +02:00
Alexander Couzens 2502387e4b PCRF: allow to build without mongodb 2024-04-09 14:05:10 +02:00
root 2521c7ae6e FIXME: libsctp: add define HAVE_NETINET_SCTP_H to allow build on debian bullseye
This is a quick fix. Need to investigate why the autodetect doesn't work
or the compilation otherwise fails.
2024-04-09 14:05:10 +02:00
203 changed files with 1342 additions and 2691 deletions

View File

@ -2,51 +2,51 @@ name: Meson Continuous Integration
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
# macos-latest: macos-latest:
# name: Build and Test on MacOS Latest name: Build and Test on MacOS Latest
# runs-on: macos-latest runs-on: macos-latest
# steps: steps:
## - name: Install MongoDB with Package Manager # - name: Install MongoDB with Package Manager
## run: |
## brew tap mongodb/brew
## brew install mongodb-community
## brew services start mongodb-community
# - name: Create the TUN device with the interface name `ogstun`.
# run: | # run: |
# sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255 # brew tap mongodb/brew
# sudo ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255 # brew install mongodb-community
# sudo ifconfig lo0 alias 127.0.0.4 netmask 255.255.255.255 # brew services start mongodb-community
# sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255 - name: Create the TUN device with the interface name `ogstun`.
# sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255 run: |
# sudo ifconfig lo0 alias 127.0.0.6 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.7 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.8 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.4 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.9 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.10 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.11 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.6 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.12 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.7 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.13 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.8 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.14 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.9 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.15 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.10 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.16 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.11 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.17 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.12 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.13 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.14 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.15 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255 sudo ifconfig lo0 alias 127.0.0.16 netmask 255.255.255.255
# - name: Install the dependencies for building the source code. sudo ifconfig lo0 alias 127.0.0.17 netmask 255.255.255.255
# run: brew install mongo-c-driver libidn libmicrohttpd nghttp2 bison libusrsctp libtins talloc meson sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255
# - name: Check out repository code sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255
# uses: actions/checkout@main sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255
# - name: Setup Meson Build sudo ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255
# run: PATH="/usr/local/opt/bison/bin:$PATH" PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" meson setup build - name: Install the dependencies for building the source code.
# env: run: brew install mongo-c-driver libidn libmicrohttpd nghttp2 bison libusrsctp libtins talloc meson
# CC: gcc - name: Check out repository code
# - name : Build Open5GS uses: actions/checkout@main
# run: ninja -C build - name: Setup Meson Build
# - name: Test Open5GS run: PATH="/usr/local/opt/bison/bin:$PATH" PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" meson setup build
# run: sudo meson test -C build -v crypt unit env:
# CC: gcc
- name : Build Open5GS
run: ninja -C build
- name: Test Open5GS
run: sudo meson test -C build -v crypt unit
ubuntu-latest: ubuntu-latest:
name: Build and Test on Ubuntu Latest name: Build and Test on Ubuntu Latest
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -109,10 +109,8 @@ smf:
server: server:
- address: 127.0.0.4 - address: 127.0.0.4
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -191,10 +189,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -142,10 +142,8 @@ smf:
server: server:
- address: 127.0.0.4 - address: 127.0.0.4
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -221,10 +219,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -112,10 +112,8 @@ smf:
- address: 127.0.1.4 - address: 127.0.1.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -209,10 +207,8 @@ upf:
server: server:
- address: 127.0.1.7 - address: 127.0.1.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.1.7 - address: 127.0.1.7

View File

@ -112,10 +112,8 @@ smf:
- address: 127.0.2.4 - address: 127.0.2.4
port: 9090 port: 9090
session: session:
- subnet: 10.46.0.0/16 - subnet: 10.46.0.1/16
gateway: 10.46.0.1 - subnet: 2001:db8:babe::1/48
- subnet: 2001:db8:babe::/48
gateway: 2001:db8:babe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -209,11 +207,9 @@ upf:
server: server:
- address: 127.0.2.7 - address: 127.0.2.7
session: session:
- subnet: 10.46.0.0/16 - subnet: 10.46.0.1/16
gateway: 10.46.0.1
dev: ogstun2 dev: ogstun2
- subnet: 2001:db8:babe::/48 - subnet: 2001:db8:babe::1/48
gateway: 2001:db8:babe::1
dev: ogstun2 dev: ogstun2
metrics: metrics:
server: server:

View File

@ -112,10 +112,8 @@ smf:
- address: 127.0.3.4 - address: 127.0.3.4
port: 9090 port: 9090
session: session:
- subnet: 10.47.0.0/16 - subnet: 10.47.0.1/16
gateway: 10.47.0.1 - subnet: 2001:db8:face::1/48
- subnet: 2001:db8:face::/48
gateway: 2001:db8:face::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -209,11 +207,9 @@ upf:
server: server:
- address: 127.0.3.7 - address: 127.0.3.7
session: session:
- subnet: 10.47.0.0/16 - subnet: 10.47.0.1/16
gateway: 10.47.0.1
dev: ogstun3 dev: ogstun3
- subnet: 2001:db8:face::/48 - subnet: 2001:db8:face::1/48
gateway: 2001:db8:face::1
dev: ogstun3 dev: ogstun3
metrics: metrics:
server: server:

View File

@ -113,10 +113,8 @@ smf:
- address: 127.0.1.4 - address: 127.0.1.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -210,10 +208,8 @@ upf:
server: server:
- address: 127.0.1.7 - address: 127.0.1.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.1.7 - address: 127.0.1.7

View File

@ -113,10 +113,8 @@ smf:
- address: 127.0.2.4 - address: 127.0.2.4
port: 9090 port: 9090
session: session:
- subnet: 10.46.0.0/16 - subnet: 10.46.0.1/16
gateway: 10.46.0.1 - subnet: 2001:db8:babe::1/48
- subnet: 2001:db8:babe::/48
gateway: 2001:db8:babe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -210,11 +208,9 @@ upf:
server: server:
- address: 127.0.2.7 - address: 127.0.2.7
session: session:
- subnet: 10.46.0.0/16 - subnet: 10.46.0.1/16
gateway: 10.46.0.1
dev: ogstun2 dev: ogstun2
- subnet: 2001:db8:babe::/48 - subnet: 2001:db8:babe::1/48
gateway: 2001:db8:babe::1
dev: ogstun2 dev: ogstun2
metrics: metrics:
server: server:

View File

@ -113,10 +113,8 @@ smf:
- address: 127.0.3.4 - address: 127.0.3.4
port: 9090 port: 9090
session: session:
- subnet: 10.47.0.0/16 - subnet: 10.47.0.1/16
gateway: 10.47.0.1 - subnet: 2001:db8:face::1/48
- subnet: 2001:db8:face::/48
gateway: 2001:db8:face::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -210,11 +208,9 @@ upf:
server: server:
- address: 127.0.3.7 - address: 127.0.3.7
session: session:
- subnet: 10.47.0.0/16 - subnet: 10.47.0.1/16
gateway: 10.47.0.1
dev: ogstun3 dev: ogstun3
- subnet: 2001:db8:face::/48 - subnet: 2001:db8:face::1/48
gateway: 2001:db8:face::1
dev: ogstun3 dev: ogstun3
metrics: metrics:
server: server:

View File

@ -118,10 +118,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -205,10 +203,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -118,10 +118,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -205,10 +203,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -116,10 +116,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -200,10 +198,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -118,10 +118,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -205,10 +203,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -116,10 +116,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -200,10 +198,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -118,10 +118,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -205,10 +203,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -118,10 +118,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -205,10 +203,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -118,10 +118,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -205,10 +203,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -116,10 +116,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -200,10 +198,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -110,10 +110,8 @@ smf:
server: server:
- address: 127.0.0.4 - address: 127.0.0.4
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -194,10 +192,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/amf.log
path: @localstatedir@/log/open5gs/amf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/ausf.log
path: @localstatedir@/log/open5gs/ausf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/bsf.log
path: @localstatedir@/log/open5gs/bsf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,7 +1,6 @@
db_uri: mongodb://localhost/open5gs db_uri: mongodb://localhost/open5gs
logger: logger:
file: file: @localstatedir@/log/open5gs/hss.log
path: @localstatedir@/log/open5gs/hss.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/mme.log
path: @localstatedir@/log/open5gs/mme.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/nrf.log
path: @localstatedir@/log/open5gs/nrf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/nssf.log
path: @localstatedir@/log/open5gs/nssf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,7 +1,6 @@
db_uri: mongodb://localhost/open5gs db_uri: mongodb://localhost/open5gs
logger: logger:
file: file: @localstatedir@/log/open5gs/pcf.log
path: @localstatedir@/log/open5gs/pcf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,7 +1,59 @@
db_uri: mongodb://localhost/open5gs db_uri: mongodb://localhost/open5gs
db_json:
default:
af:
ambr:
up: 10000
down: 10000
gmbr:
up: 1000
down: 1000
qci: 4
normal:
ambr:
up: 10000
down: 10000
gmbr:
up: 10000
down: 10000
qci: 5
charging_profiles:
af:
- 1
- 2
- 3
- 4
normal:
- 1
- 2
- 3
- 4
dir:
normal: "/tmp/profiles"
af: "/tmp/profiles_af"
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Default values are used, so no configuration is required)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# logger:
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# logger:
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# logger:
# level: trace
# domain: core,sbi,ausf,event,tlv,mem,sock
#
logger: logger:
file: file: @localstatedir@/log/open5gs/pcrf.log
path: @localstatedir@/log/open5gs/pcrf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/scp.log
path: @localstatedir@/log/open5gs/scp.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/sepp1.log
path: @localstatedir@/log/open5gs/sepp1.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/sepp2.log
path: @localstatedir@/log/open5gs/sepp2.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/sgwc.log
path: @localstatedir@/log/open5gs/sgwc.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/sgwu.log
path: @localstatedir@/log/open5gs/sgwu.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/smf.log
path: @localstatedir@/log/open5gs/smf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:
@ -35,10 +34,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -330,26 +327,23 @@ smf:
# o Specific DNN/APN(e.g 'ims') uses 10.46.0.1/16, 2001:db8:babe::1/48 # o Specific DNN/APN(e.g 'ims') uses 10.46.0.1/16, 2001:db8:babe::1/48
# (If the UE has unknown DNN/APN(not internet/ims), SMF/UPF will crash.) # (If the UE has unknown DNN/APN(not internet/ims), SMF/UPF will crash.)
# session: # session:
# - subnet: 10.45.0.0/16 # - subnet: 10.45.0.1/16
# gateway: 10.45.0.1
# dnn: internet # dnn: internet
# - subnet: 2001:db8:cafe::/48 # - subnet: 2001:db8:cafe::1/48
# dnn: internet # dnn: internet
# - subnet: 10.46.0.0/16 # - subnet: 10.46.0.1/16
# gateway: 10.46.0.1
# dnn: ims # dnn: ims
# - subnet: 2001:db8:babe::/48 # - subnet: 2001:db8:babe::1/48
# dnn: ims # dnn: ims
# #
# o Pool Range # o Pool Range
# session: # session:
# - subnet: 10.45.0.0/16 # - subnet: 10.45.0.1/16
# gateway: 10.45.0.1
# range: # range:
# - 10.45.0.100-10.45.0.200 # - 10.45.0.100-10.45.0.200
# - 10.45.1.100- # - 10.45.1.100-
# - -10.45.0.200 # - -10.45.0.200
# - subnet: 2001:db8:cafe::/48 # - subnet: 2001:db8:cafe::1/48
# range: # range:
# - 2001:db8:cafe:a0::0-2001:db8:cafe:b0::0 # - 2001:db8:cafe:a0::0-2001:db8:cafe:b0::0
# - 2001:db8:cafe:c0::0-2001:db8:cafe:d0::0 # - 2001:db8:cafe:c0::0-2001:db8:cafe:d0::0

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/udm.log
path: @localstatedir@/log/open5gs/udm.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,7 +1,6 @@
db_uri: mongodb://localhost/open5gs db_uri: mongodb://localhost/open5gs
logger: logger:
file: file: @localstatedir@/log/open5gs/udr.log
path: @localstatedir@/log/open5gs/udr.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:

View File

@ -1,6 +1,5 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/upf.log
path: @localstatedir@/log/open5gs/upf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:
@ -19,10 +18,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
@ -73,16 +70,14 @@ upf:
# $ sudo ip addr add 2001:db8:babe::1/48 dev ogstun3 # $ sudo ip addr add 2001:db8:babe::1/48 dev ogstun3
# #
# session: # session:
# - subnet: 10.45.0.0/16 # - subnet: 10.45.0.1/16
# gateway: 10.45.0.1
# dnn: internet # dnn: internet
# - subnet: 2001:db8:cafe::/48 # - subnet: 2001:db8:cafe::1/48
# dnn: internet # dnn: internet
# dev: ogstun2 # dev: ogstun2
# - subnet: 10.46.0.0/16 # - subnet: 10.46.0.1/16
# gateway: 10.46.0.1
# dnn: ims # dnn: ims
# dev: ogstun3 # dev: ogstun3
# - subnet: 2001:db8:babe::/48 # - subnet: 2001:db8:babe::1/48
# dnn: ims # dnn: ims
# dev: ogstun3 # dev: ogstun3

View File

@ -118,10 +118,8 @@ smf:
- address: 127.0.0.4 - address: 127.0.0.4
port: 9090 port: 9090
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -205,10 +203,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -110,10 +110,8 @@ smf:
server: server:
- address: 127.0.0.4 - address: 127.0.0.4
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -196,10 +194,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -107,10 +107,8 @@ smf:
server: server:
- address: 127.0.0.4 - address: 127.0.0.4
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -186,10 +184,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -5,14 +5,6 @@ Name=ogstun
Address=10.45.0.1/16 Address=10.45.0.1/16
Address=2001:db8:cafe::1/48 Address=2001:db8:cafe::1/48
[Route]
Gateway=0.0.0.0
Destination=10.45.0.0/16
[Route]
Gateway=::
Destination=2001:db8:cafe::0/48
[Link] [Link]
MTUBytes=1400 MTUBytes=1400
RequiredForOnline=false RequiredForOnline=false

View File

@ -107,10 +107,8 @@ smf:
server: server:
- address: 127.0.0.4 - address: 127.0.0.4
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -189,10 +187,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

View File

@ -110,9 +110,8 @@ smf:
server: server:
- address: 127.0.0.4 - address: 127.0.0.4
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@ -194,9 +193,8 @@ upf:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7
session: session:
- subnet: 10.45.0.0/16 - subnet: 10.45.0.1/16
gateway: 10.45.0.1 - subnet: 2001:db8:cafe::1/48
- subnet: 2001:db8:cafe::/48
metrics: metrics:
server: server:
- address: 127.0.0.7 - address: 127.0.0.7

31
debian/changelog vendored
View File

@ -1,32 +1,15 @@
open5gs (2.7.1) unstable; urgency=medium open5gs (2.7.0~sysmocom2) unstable; urgency=medium
* Bug Fixed * Rebase on open5gs.git main of 2024-04-09
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:21:46 +0900 -- Oliver Smith <osmith@sysmocom.de> Tue, 09 Apr 2024 14:05:56 +0200
open5gs (2.7.1~mantic) mantic; urgency=medium open5gs (2.7.0sysmocom1) unstable; urgency=medium
* Bug Fixed * Remove mongodb dependency
* Use default APN if none could be found
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:18:53 +0900 -- Daniel Willmann <dwillmann@sysmocom.de> Mon, 29 Jan 2024 20:17:10 +0100
open5gs (2.7.1~bionic) bionic; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:16:21 +0900
open5gs (2.7.1~jammy) jammy; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:11:30 +0900
open5gs (2.7.1~focal) focal; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:08:46 +0900
open5gs (2.7.0) unstable; urgency=medium open5gs (2.7.0) unstable; urgency=medium

20
debian/control vendored
View File

@ -14,7 +14,6 @@ Build-Depends: debhelper (>= 11),
libgcrypt-dev, libgcrypt-dev,
libssl-dev, libssl-dev,
libidn11-dev, libidn11-dev,
libmongoc-dev,
libbson-dev, libbson-dev,
libsctp-dev, libsctp-dev,
libyaml-dev, libyaml-dev,
@ -121,29 +120,11 @@ Description: UPF (User Plane Function)
. .
This package provides the UPF (User Plane Function) This package provides the UPF (User Plane Function)
Package: open5gs-hss
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
mongodb-org | mongodb,
open5gs-common (= ${binary:Version})
Description: HSS (Home Subscriber Server)
Open5GS is a C-language implementation of 5G Core and EPC
Packet Core, i.e. the core network of an NR/LTE network (Release-17)
.
This package provides the HSS (Home Subscriber Server) element of the
EPC, i.e. the central database of mobile network subscribers, with
their IMSI, MSISDN, cryptographic key materials, service subscription
information, etc. It implements the S6a interface towards the MME
using the DIAMETER protocol.
Package: open5gs-pcrf Package: open5gs-pcrf
Architecture: any Architecture: any
Multi-Arch: same Multi-Arch: same
Depends: ${shlibs:Depends}, Depends: ${shlibs:Depends},
${misc:Depends}, ${misc:Depends},
mongodb-org | mongodb,
open5gs-common (= ${binary:Version}) open5gs-common (= ${binary:Version})
Description: PCRF (Policy and Charging Rules Function) Description: PCRF (Policy and Charging Rules Function)
Open5GS is a C-language implementation of 5G Core and EPC Open5GS is a C-language implementation of 5G Core and EPC
@ -273,7 +254,6 @@ Depends: ${misc:Depends},
open5gs-amf (= ${binary:Version}), open5gs-amf (= ${binary:Version}),
open5gs-sgwu (= ${binary:Version}), open5gs-sgwu (= ${binary:Version}),
open5gs-upf (= ${binary:Version}), open5gs-upf (= ${binary:Version}),
open5gs-hss (= ${binary:Version}),
open5gs-pcrf (= ${binary:Version}), open5gs-pcrf (= ${binary:Version}),
open5gs-nrf (= ${binary:Version}), open5gs-nrf (= ${binary:Version}),
open5gs-scp (= ${binary:Version}), open5gs-scp (= ${binary:Version}),

View File

@ -1,6 +0,0 @@
usr/bin/open5gs-hssd
configs/freeDiameter/hss.* etc/freeDiameter
configs/open5gs/hss.yaml etc/open5gs
configs/open5gs/tls/hss.key etc/open5gs/tls
configs/open5gs/tls/hss.crt etc/open5gs/tls
configs/systemd/open5gs-hssd.service lib/systemd/system

View File

@ -13,7 +13,7 @@ RUN apk update && \
sudo sudo
ARG username=acetcom ARG username=acetcom
RUN adduser -u 2000 acetcom -D && \ RUN adduser -u 1000 acetcom -D && \
echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \ echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \
chmod 0440 /etc/sudoers.d/${username} chmod 0440 /etc/sudoers.d/${username}

View File

@ -27,7 +27,7 @@ RUN apt-get update && \
COPY setup.sh /root COPY setup.sh /root
ARG username=acetcom ARG username=acetcom
RUN useradd -m --uid=2000 ${username} && \ RUN useradd -m --uid=1000 ${username} && \
echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \ echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \
chmod 0440 /etc/sudoers.d/${username} chmod 0440 /etc/sudoers.d/${username}

View File

@ -16,7 +16,7 @@ RUN dnf -y install \
COPY setup.sh /root COPY setup.sh /root
ARG username=acetcom ARG username=acetcom
RUN useradd -m --uid=2000 ${username} && \ RUN useradd -m --uid=1000 ${username} && \
echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \ echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \
chmod 0440 /etc/sudoers.d/${username} chmod 0440 /etc/sudoers.d/${username}

View File

@ -33,7 +33,7 @@ RUN apt-get update && \
COPY setup.sh /root COPY setup.sh /root
ARG username=acetcom ARG username=acetcom
RUN useradd -m --uid=2000 ${username} && \ RUN useradd -m --uid=1000 ${username} && \
echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \ echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \
chmod 0440 /etc/sudoers.d/${username} chmod 0440 /etc/sudoers.d/${username}

View File

@ -428,34 +428,6 @@ $ sudo systemctl restart open5gs-amfd
$ sudo systemctl restart open5gs-upfd $ sudo systemctl restart open5gs-upfd
``` ```
#### Configure logging
The Open5GS components log to `/var/log/open5gs/*.log` and to `stderr` by
default.
##### Avoid duplicate timestamps in journalctl
Open5GS adds timestamps to each log line in the log file, and on `stderr`. If
you run Open5GS with systemd and prefer looking at the logs with `journalctl`,
then each line will have two timestamps. To fix this, disable the timestamp for
`stderr` with the following configuration change:
```diff
diff --git a/configs/open5gs/mme.yaml.in b/configs/open5gs/mme.yaml.in
index 87c251b9d..599032b8a 100644
--- a/configs/open5gs/mme.yaml.in
+++ b/configs/open5gs/mme.yaml.in
@@ -1,6 +1,9 @@
logger:
+ default:
+ timestamp: false
file:
path: /var/log/open5gs/mme.log
+ timestamp: true
# level: info # fatal|error|warn|info(default)|debug|trace
global:
```
#### Register Subscriber Information #### Register Subscriber Information
--- ---

View File

@ -169,8 +169,7 @@ index a70143f08..e0dba560c 100644
+++ b/configs/open5gs/amf.yaml.in +++ b/configs/open5gs/amf.yaml.in
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/amf.log
path: @localstatedir@/log/open5gs/amf.log
-# level: info # fatal|error|warn|info(default)|debug|trace -# level: info # fatal|error|warn|info(default)|debug|trace
+ level: debug + level: debug

View File

@ -485,8 +485,7 @@ index a70143f08..e0dba560c 100644
+++ b/configs/open5gs/amf.yaml.in +++ b/configs/open5gs/amf.yaml.in
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
logger: logger:
file: file: @localstatedir@/log/open5gs/amf.log
path: @localstatedir@/log/open5gs/amf.log
-# level: info # fatal|error|warn|info(default)|debug|trace -# level: info # fatal|error|warn|info(default)|debug|trace
+ level: debug + level: debug

View File

@ -92,8 +92,7 @@ NRF shall follow TS23.003(28.3.2.3.2 Format of NRF FQDN) for routing.
```bash ```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/h-nrf.yaml $ sh -c 'cat << EOF > ./install/etc/open5gs/h-nrf.yaml
logger: logger:
file: file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/h-nrf.log
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/h-nrf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:
@ -117,8 +116,7 @@ EOF'
```bash ```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/h-scp.yaml $ sh -c 'cat << EOF > ./install/etc/open5gs/h-scp.yaml
logger: logger:
file: file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/h-scp.log
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/h-scp.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
global: global:
@ -304,8 +302,7 @@ $ diff -u ./install/etc/open5gs/pcf.yaml.old ./install/etc/open5gs/pcf.yaml
@@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
-db_uri: mongodb://localhost/open5gs -db_uri: mongodb://localhost/open5gs
logger: logger:
file: file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcf.log
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcf.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
@@ -22,6 +21,29 @@ @@ -22,6 +21,29 @@
server: server:
@ -649,8 +646,7 @@ For now we will set up SEPP without using TLS.
```bash ```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/sepp.yaml $ sh -c 'cat << EOF > ./install/etc/open5gs/sepp.yaml
logger: logger:
file: file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
max: max:
@ -970,8 +966,7 @@ For now we will set up SEPP without using TLS.
```bash ```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/sepp.yaml $ sh -c 'cat << EOF > ./install/etc/open5gs/sepp.yaml
logger: logger:
file: file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
max: max:
@ -1291,8 +1286,7 @@ For now we will set up SEPP without using TLS.
```bash ```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/sepp.yaml $ sh -c 'cat << EOF > ./install/etc/open5gs/sepp.yaml
logger: logger:
file: file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
# level: info # fatal|error|warn|info(default)|debug|trace # level: info # fatal|error|warn|info(default)|debug|trace
max: max:

View File

@ -75,10 +75,8 @@ head_inline: "<style> ul { padding-bottom: 1em; } </style>"
- [srsRAN with eUPF(eBPF/XDP UPF)](https://github.com/s5uishida/open5gs_epc_srsran_eupf_sample_config) - [srsRAN with eUPF(eBPF/XDP UPF)](https://github.com/s5uishida/open5gs_epc_srsran_eupf_sample_config)
- @gradiant helm charts - @gradiant helm charts
- [Open5GS and srsRAN-5G in kubernetes](https://gradiant.github.io/5g-charts/open5gs-srsran-5g-zmq.html) - [Open5GS EPC and SRS LTE in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-srslte.html)
- [Open5GS and srsLTE in kubernetes](https://gradiant.github.io/5g-charts/open5gs-srslte.html) - [Open5GS NGC and UERANSIM in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-ueransim-gnb.html)
- [Open5GS and UERANSIM](https://gradiant.github.io/5g-charts/open5gs-ueransim-gnb.html) - [Open5GS NGC and OpenAirInterface GNB with ettus USRP in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-oaignb.html)
- [Open5GS and PacketRusher](https://gradiant.github.io/5g-charts/open5gs-packetrusher.html) - [Open5GS EPC and SRS ENB with ettus USRP in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-srsenb.html)
- [Open5GS and OAI-GNB](https://gradiant.github.io/5g-charts/open5gs-oaignb.html) - [Open5GS with Service Communication Proxy in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-scp.html)
- [Open5GS and srsenb](https://gradiant.github.io/5g-charts/open5gs-srsenb.html)
- [Open5GS with SCP(Service Communication Proxy](https://gradiant.github.io/5g-charts/open5gs-scp.html)

View File

@ -25,8 +25,7 @@ Example of sgw.yaml to use this feature:
``` ```
logger: logger:
file: file: /var/log/open5gs/sgw.log
path: /var/log/open5gs/sgw.log
level: debug level: debug
parameter: parameter:

View File

@ -1,15 +0,0 @@
---
title: "v2.7.1 - Bug Fixed"
date: 2024-04-19 21:23:00 +0900
categories:
- Release
tags:
- News
- Release
head_inline: "<style> ul { padding-bottom: 1em; } .blue { color: blue; }</style>"
---
See [Release Note](https://github.com/open5gs/open5gs/releases/tag/v2.7.1)
Download -- [v2.7.1.tar.gz](https://github.com/open5gs/open5gs/archive/v2.7.1.tar.gz)
{: .notice--info}

View File

@ -408,8 +408,8 @@ static int local_conf_prepare(void)
* Heartbeat Interval(e.g: 10 seconds) + No Heartbeat Margin(1 second) */ * Heartbeat Interval(e.g: 10 seconds) + No Heartbeat Margin(1 second) */
local_conf.time.nf_instance.no_heartbeat_margin = 1; local_conf.time.nf_instance.no_heartbeat_margin = 1;
/* 30 seconds */ /* 3600 seconds = 1 hour */
local_conf.time.nf_instance.validity_duration = 30; local_conf.time.nf_instance.validity_duration = 3600;
/* 86400 seconds = 1 day */ /* 86400 seconds = 1 day */
local_conf.time.subscription.validity_duration = 86400; local_conf.time.subscription.validity_duration = 86400;

View File

@ -36,15 +36,10 @@ typedef struct ogs_app_context_s {
const char *db_uri; const char *db_uri;
struct {
ogs_log_ts_e timestamp;
} logger_default;
struct { struct {
const char *file; const char *file;
const char *level; const char *level;
const char *domain; const char *domain;
ogs_log_ts_e timestamp;
} logger; } logger;
ogs_queue_t *queue; ogs_queue_t *queue;

View File

@ -114,9 +114,6 @@ int ogs_app_initialize(
ogs_app()->logger.domain, ogs_app()->logger.level); ogs_app()->logger.domain, ogs_app()->logger.level);
if (rv != OGS_OK) return rv; if (rv != OGS_OK) return rv;
ogs_log_set_timestamp(ogs_app()->logger_default.timestamp,
ogs_app()->logger.timestamp);
/************************************************************************** /**************************************************************************
* Stage 5 : Setup Database Module * Stage 5 : Setup Database Module
*/ */
@ -257,57 +254,6 @@ static int context_validation(void)
return OGS_OK; return OGS_OK;
} }
static void parse_config_logger_file(ogs_yaml_iter_t *logger_iter,
const char *logger_key)
{
ogs_yaml_iter_t iter;
/* Legacy format:
* logger:
* file: /var/log/open5gs/mme.log */
if (!strcmp(logger_key, "file") && ogs_yaml_iter_has_value(logger_iter)) {
ogs_app()->logger.file = ogs_yaml_iter_value(logger_iter);
ogs_warn("Please change the configuration file as below.");
ogs_log_print(OGS_LOG_WARN, "\n<OLD Format>\n");
ogs_log_print(OGS_LOG_WARN, "logger:\n");
ogs_log_print(OGS_LOG_WARN, " file: %s\n", ogs_app()->logger.file);
ogs_log_print(OGS_LOG_WARN, "\n<NEW Format>\n");
ogs_log_print(OGS_LOG_WARN, "logger:\n");
ogs_log_print(OGS_LOG_WARN, " file:\n");
ogs_log_print(OGS_LOG_WARN, " path: %s\n", ogs_app()->logger.file);
ogs_log_print(OGS_LOG_WARN, "\n\n\n");
return;
}
/* Current format:
* logger:
* default:
* timestamp: false
* file:
* path: /var/log/open5gs/mme.log
* timestamp: true */
ogs_yaml_iter_recurse(logger_iter, &iter);
while (ogs_yaml_iter_next(&iter)) {
const char *key = ogs_yaml_iter_key(&iter);
ogs_assert(key);
if (!strcmp(key, "timestamp")) {
ogs_log_ts_e ts = ogs_yaml_iter_bool(&iter)
? OGS_LOG_TS_ENABLED
: OGS_LOG_TS_DISABLED;
if (!strcmp(logger_key, "default")) {
ogs_app()->logger_default.timestamp = ts;
} else if (!strcmp(logger_key, "file")) {
ogs_app()->logger.timestamp = ts;
}
} else if (!strcmp(key, "path")) {
if (!strcmp(logger_key, "file")) {
ogs_app()->logger.file = ogs_yaml_iter_value(&iter);
}
}
}
}
static int parse_config(void) static int parse_config(void)
{ {
int rv; int rv;
@ -332,8 +278,9 @@ static int parse_config(void)
while (ogs_yaml_iter_next(&logger_iter)) { while (ogs_yaml_iter_next(&logger_iter)) {
const char *logger_key = ogs_yaml_iter_key(&logger_iter); const char *logger_key = ogs_yaml_iter_key(&logger_iter);
ogs_assert(logger_key); ogs_assert(logger_key);
parse_config_logger_file(&logger_iter, logger_key); if (!strcmp(logger_key, "file")) {
if (!strcmp(logger_key, "level")) { ogs_app()->logger.file = ogs_yaml_iter_value(&logger_iter);
} else if (!strcmp(logger_key, "level")) {
ogs_app()->logger.level = ogs_app()->logger.level =
ogs_yaml_iter_value(&logger_iter); ogs_yaml_iter_value(&logger_iter);
} else if (!strcmp(logger_key, "domain")) { } else if (!strcmp(logger_key, "domain")) {

View File

@ -178,34 +178,6 @@ const char *ogs_yaml_iter_value(ogs_yaml_iter_t *iter)
return NULL; return NULL;
} }
int ogs_yaml_iter_has_value(ogs_yaml_iter_t *iter)
{
ogs_assert(iter);
ogs_assert(iter->document);
ogs_assert(iter->node);
if (iter->node->type == YAML_SCALAR_NODE) {
return 1;
} else if (iter->node->type == YAML_MAPPING_NODE) {
yaml_node_t *node = NULL;
ogs_assert(iter->pair);
node = yaml_document_get_node(iter->document, iter->pair->value);
ogs_assert(node);
return node->type == YAML_SCALAR_NODE;
} else if (iter->node->type == YAML_SEQUENCE_NODE) {
yaml_node_t *node = NULL;
ogs_assert(iter->item);
node = yaml_document_get_node(iter->document, *iter->item);
ogs_assert(node);
return node->type == YAML_SCALAR_NODE;
}
ogs_assert_if_reached();
return 0;
}
int ogs_yaml_iter_bool(ogs_yaml_iter_t *iter) int ogs_yaml_iter_bool(ogs_yaml_iter_t *iter)
{ {
const char *v = ogs_yaml_iter_value(iter); const char *v = ogs_yaml_iter_value(iter);

View File

@ -59,7 +59,6 @@ void ogs_yaml_iter_recurse(ogs_yaml_iter_t *parent, ogs_yaml_iter_t *iter);
int ogs_yaml_iter_type(ogs_yaml_iter_t *iter); int ogs_yaml_iter_type(ogs_yaml_iter_t *iter);
const char *ogs_yaml_iter_key(ogs_yaml_iter_t *iter); const char *ogs_yaml_iter_key(ogs_yaml_iter_t *iter);
const char *ogs_yaml_iter_value(ogs_yaml_iter_t *iter); const char *ogs_yaml_iter_value(ogs_yaml_iter_t *iter);
int ogs_yaml_iter_has_value(ogs_yaml_iter_t *iter);
int ogs_yaml_iter_bool(ogs_yaml_iter_t *iter); int ogs_yaml_iter_bool(ogs_yaml_iter_t *iter);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -340,28 +340,6 @@ void ogs_log_set_mask_level(const char *_mask, ogs_log_level_e level)
} }
} }
void ogs_log_set_timestamp(ogs_log_ts_e ts_default, ogs_log_ts_e ts_file)
{
ogs_log_t *log;
if (ts_default == OGS_LOG_TS_UNSET)
ts_default = OGS_LOG_TS_ENABLED;
if (ts_file == OGS_LOG_TS_UNSET)
ts_file = ts_default;
ogs_list_for_each(&log_list, log) {
switch (log->type) {
case OGS_LOG_FILE_TYPE:
log->print.timestamp = (ts_file == OGS_LOG_TS_ENABLED);
break;
default:
log->print.timestamp = (ts_default == OGS_LOG_TS_ENABLED);
break;
}
}
}
static ogs_log_level_e ogs_log_level_from_string(const char *string) static ogs_log_level_e ogs_log_level_from_string(const char *string)
{ {
ogs_log_level_e level = OGS_ERROR; ogs_log_level_e level = OGS_ERROR;

View File

@ -64,12 +64,6 @@ typedef enum {
OGS_LOG_FULL = OGS_LOG_TRACE, OGS_LOG_FULL = OGS_LOG_TRACE,
} ogs_log_level_e; } ogs_log_level_e;
typedef enum {
OGS_LOG_TS_UNSET,
OGS_LOG_TS_ENABLED,
OGS_LOG_TS_DISABLED,
} ogs_log_ts_e;
typedef struct ogs_log_s ogs_log_t; typedef struct ogs_log_s ogs_log_t;
typedef struct ogs_log_domain_s ogs_log_domain_t; typedef struct ogs_log_domain_s ogs_log_domain_t;
@ -96,7 +90,6 @@ void ogs_log_install_domain(int *domain_id,
int ogs_log_config_domain(const char *domain, const char *level); int ogs_log_config_domain(const char *domain, const char *level);
void ogs_log_set_mask_level(const char *mask, ogs_log_level_e level); void ogs_log_set_mask_level(const char *mask, ogs_log_level_e level);
void ogs_log_set_timestamp(ogs_log_ts_e ts_default, ogs_log_ts_e ts_file);
void ogs_log_vprintf(ogs_log_level_e level, int id, void ogs_log_vprintf(ogs_log_level_e level, int id,
ogs_err_t err, const char *file, int line, const char *func, ogs_err_t err, const char *file, int line, const char *func,

View File

@ -19,6 +19,7 @@
#include "ogs-dbi.h" #include "ogs-dbi.h"
#ifdef OGS_DBI_WITH_MONGODB
int ogs_dbi_msisdn_data( int ogs_dbi_msisdn_data(
char *imsi_or_msisdn_bcd, ogs_msisdn_data_t *msisdn_data) char *imsi_or_msisdn_bcd, ogs_msisdn_data_t *msisdn_data)
{ {
@ -202,3 +203,15 @@ out:
return rv; return rv;
} }
#else /* OGS_DBI_WITH_MONGODB */
int ogs_dbi_msisdn_data(
char *imsi_or_msisdn_bcd, ogs_msisdn_data_t *msisdn_data)
{
return OGS_ERROR;
}
int ogs_dbi_ims_data(char *supi, ogs_ims_data_t *ims_data)
{
return OGS_ERROR;
}
#endif

View File

@ -25,9 +25,6 @@ libdbi_sources = files('''
session.c session.c
ims.c ims.c
'''.split()) '''.split())
libmongoc_dep = dependency('libmongoc-1.0')
libdbi_inc = include_directories('.') libdbi_inc = include_directories('.')
libdbi = library('ogsdbi', libdbi = library('ogsdbi',
@ -35,10 +32,10 @@ libdbi = library('ogsdbi',
version : libogslib_version, version : libogslib_version,
c_args : '-DOGS_DBI_COMPILATION', c_args : '-DOGS_DBI_COMPILATION',
include_directories : [libdbi_inc, libinc], include_directories : [libdbi_inc, libinc],
dependencies : [libproto_dep, libmongoc_dep], dependencies : [libproto_dep],
install : true) install : true)
libdbi_dep = declare_dependency( libdbi_dep = declare_dependency(
link_with : libdbi, link_with : libdbi,
include_directories : [libdbi_inc, libinc], include_directories : [libdbi_inc, libinc],
dependencies : [libproto_dep, libmongoc_dep]) dependencies : [libproto_dep])

34
lib/dbi/meson_dummy.h Normal file
View File

@ -0,0 +1,34 @@
/*
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MESON_DUMMY_H
#define MESON_DUMMY_H
#ifdef __cplusplus
extern "C" {
#endif
struct dummy_bson;
typedef struct dummy_bson bson_t;
#ifdef __cplusplus
}
#endif
#endif /* MESON_DUMMY_H */

View File

@ -17,12 +17,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <mongoc.h>
#include "ogs-dbi.h" #include "ogs-dbi.h"
int __ogs_dbi_domain; int __ogs_dbi_domain;
#ifdef OGS_DBI_WITH_MONGODB
#include <mongoc.h>
static ogs_mongoc_t self; static ogs_mongoc_t self;
/* /*
@ -220,3 +222,28 @@ int ogs_dbi_collection_watch_init(void)
return OGS_ERROR; return OGS_ERROR;
#endif #endif
} }
#else /* OGS_DBI_WITH_MONGODB */
int ogs_mongoc_init(const char *db_uri)
{
return OGS_ERROR;
}
void ogs_mongoc_final(void)
{
}
ogs_mongoc_t *ogs_mongoc(void)
{
return NULL;
}
int ogs_dbi_init(const char *db_uri)
{
return OGS_OK;
}
void ogs_dbi_final()
{
}
#endif

View File

@ -24,7 +24,8 @@
#ifndef OGS_MONGOC_H #ifndef OGS_MONGOC_H
#define OGS_MONGOC_H #define OGS_MONGOC_H
#include <mongoc.h> /* STUB to disable building with mongodb (OS#6215) */
#define MONGOC_CHECK_VERSION(a, b, c) false
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -19,6 +19,7 @@
#include "ogs-dbi.h" #include "ogs-dbi.h"
#ifdef OGS_DBI_WITH_MONGODB
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn, int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data) ogs_session_data_t *session_data)
{ {
@ -503,3 +504,27 @@ out:
return rv; return rv;
} }
#else /* OGS_DBI_WITH_MONGODB */
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data)
{
ogs_session_t *session = &session_data->session;
ogs_qos_t *qos = &session->qos;
session->name = ogs_strndup("staticprof", strlen("foobar"));
/* check if have to set type */
session->ambr.downlink = 300 * 1024 * 1024;
session->ambr.uplink = 150 * 1024 * 1024;
session->qos.index = OGS_QOS_INDEX_5;
session->qos.arp.priority_level = 1;
session->qos.mbr.downlink = 10;
session->qos.mbr.uplink = 10;
session->qos.gbr.downlink = 10;
session->qos.gbr.uplink = 10;
return OGS_OK;
}
#endif /* OGS_DBI_WITH_MONGODB */

View File

@ -19,6 +19,7 @@
#include "ogs-dbi.h" #include "ogs-dbi.h"
#ifdef OGS_DBI_WITH_MONGODB
int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info) int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info)
{ {
int rv = OGS_OK; int rv = OGS_OK;
@ -816,3 +817,31 @@ out:
return rv; return rv;
} }
#else
int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info)
{
return OGS_ERROR;
}
int ogs_dbi_update_sqn(char *supi, uint64_t sqn)
{
return OGS_ERROR;
}
int ogs_dbi_update_imeisv(char *supi, char *imeisv)
{
return OGS_ERROR;
}
int ogs_dbi_increment_sqn(char *supi)
{
return OGS_ERROR;
}
int ogs_dbi_subscription_data(char *supi,
ogs_subscription_data_t *subscription_data)
{
return OGS_ERROR;
}
#endif /* OGS_DBI_WITH_MONGODB */

View File

@ -629,11 +629,7 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
size++; size++;
if (uli->flags.cgi) { if (uli->flags.cgi) {
if (size + sizeof(uli->cgi) > octet->len) { ogs_assert(size + sizeof(uli->cgi) <= octet->len);
ogs_error("size[%d]+sizeof(uli->cgi)[%d] > IE Length[%d]",
size, (int)sizeof(uli->cgi), octet->len);
return 0;
}
memcpy(&uli->cgi, memcpy(&uli->cgi,
(unsigned char *)octet->data + size, sizeof(uli->cgi)); (unsigned char *)octet->data + size, sizeof(uli->cgi));
uli->cgi.lac = be16toh(uli->cgi.lac); uli->cgi.lac = be16toh(uli->cgi.lac);
@ -641,11 +637,7 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
size += sizeof(uli->cgi); size += sizeof(uli->cgi);
} }
if (uli->flags.sai) { if (uli->flags.sai) {
if (size + sizeof(uli->sai) > octet->len) { ogs_assert(size + sizeof(uli->sai) <= octet->len);
ogs_error("size[%d]+sizeof(uli->sai)[%d] > IE Length[%d]",
size, (int)sizeof(uli->sai), octet->len);
return 0;
}
memcpy(&uli->sai, memcpy(&uli->sai,
(unsigned char *)octet->data + size, sizeof(uli->sai)); (unsigned char *)octet->data + size, sizeof(uli->sai));
uli->sai.lac = be16toh(uli->sai.lac); uli->sai.lac = be16toh(uli->sai.lac);
@ -653,11 +645,7 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
size += sizeof(uli->sai); size += sizeof(uli->sai);
} }
if (uli->flags.rai) { if (uli->flags.rai) {
if (size + sizeof(uli->rai) > octet->len) { ogs_assert(size + sizeof(uli->rai) <= octet->len);
ogs_error("size[%d]+sizeof(uli->lai)[%d] > IE Length[%d]",
size, (int)sizeof(uli->lai), octet->len);
return 0;
}
memcpy(&uli->rai, memcpy(&uli->rai,
(unsigned char *)octet->data + size, sizeof(uli->rai)); (unsigned char *)octet->data + size, sizeof(uli->rai));
uli->rai.lac = be16toh(uli->rai.lac); uli->rai.lac = be16toh(uli->rai.lac);
@ -665,44 +653,28 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
size += sizeof(uli->rai); size += sizeof(uli->rai);
} }
if (uli->flags.tai) { if (uli->flags.tai) {
if (size + sizeof(uli->tai) > octet->len) { ogs_assert(size + sizeof(uli->tai) <= octet->len);
ogs_error("size[%d]+sizeof(uli->tai)[%d] > IE Length[%d]",
size, (int)sizeof(uli->tai), octet->len);
return 0;
}
memcpy(&uli->tai, memcpy(&uli->tai,
(unsigned char *)octet->data + size, sizeof(uli->tai)); (unsigned char *)octet->data + size, sizeof(uli->tai));
uli->tai.tac = be16toh(uli->tai.tac); uli->tai.tac = be16toh(uli->tai.tac);
size += sizeof(uli->tai); size += sizeof(uli->tai);
} }
if (uli->flags.e_cgi) { if (uli->flags.e_cgi) {
if (size + sizeof(uli->e_cgi) > octet->len) { ogs_assert(size + sizeof(uli->e_cgi) <= octet->len);
ogs_error("size[%d]+sizeof(uli->e_cgi)[%d] > IE Length[%d]",
size, (int)sizeof(uli->e_cgi), octet->len);
return 0;
}
memcpy(&uli->e_cgi, memcpy(&uli->e_cgi,
(unsigned char *)octet->data + size, sizeof(uli->e_cgi)); (unsigned char *)octet->data + size, sizeof(uli->e_cgi));
uli->e_cgi.cell_id = be32toh(uli->e_cgi.cell_id); uli->e_cgi.cell_id = be32toh(uli->e_cgi.cell_id);
size += sizeof(uli->e_cgi); size += sizeof(uli->e_cgi);
} }
if (uli->flags.lai) { if (uli->flags.lai) {
if (size + sizeof(uli->lai) > octet->len) { ogs_assert(size + sizeof(uli->lai) <= octet->len);
ogs_error("size[%d]+sizeof(uli->lai)[%d] > IE Length[%d]",
size, (int)sizeof(uli->lai), octet->len);
return 0;
}
memcpy(&uli->lai, memcpy(&uli->lai,
(unsigned char *)octet->data + size, sizeof(uli->lai)); (unsigned char *)octet->data + size, sizeof(uli->lai));
uli->lai.lac = be16toh(uli->lai.lac); uli->lai.lac = be16toh(uli->lai.lac);
size += sizeof(uli->lai); size += sizeof(uli->lai);
} }
if (uli->flags.enodeb_id) { if (uli->flags.enodeb_id) {
if (size + sizeof(uli->enodeb_id) > octet->len) { ogs_assert(size + sizeof(uli->enodeb_id) <= octet->len);
ogs_error("size[%d]+sizeof(uli->enodeb_id)[%d] > IE Length[%d]",
size, (int)sizeof(uli->enodeb_id), octet->len);
return 0;
}
memcpy(&uli->enodeb_id, memcpy(&uli->enodeb_id,
(unsigned char *)octet->data + size, sizeof(uli->enodeb_id)); (unsigned char *)octet->data + size, sizeof(uli->enodeb_id));
uli->enodeb_id.enodeb_id = be16toh(uli->enodeb_id.enodeb_id); uli->enodeb_id.enodeb_id = be16toh(uli->enodeb_id.enodeb_id);
@ -712,8 +684,7 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
ogs_error("Extended Macro eNodeB ID in ULI not implemented! see 3GPP TS 29.274 8.21.8"); ogs_error("Extended Macro eNodeB ID in ULI not implemented! see 3GPP TS 29.274 8.21.8");
} }
if (size != octet->len) ogs_assert(size == octet->len);
ogs_error("Mismatch IE Length[%d] != Decoded[%d]", octet->len, size);
return size; return size;
} }

View File

@ -483,59 +483,35 @@ int ogs_nas_parse_qos_flow_descriptions(
ogs_assert(description); ogs_assert(description);
ogs_assert(descriptions); ogs_assert(descriptions);
ogs_assert(descriptions->length);
if (descriptions->length == 0) {
ogs_error("Length is 0");
goto cleanup;
}
if (descriptions->buffer == NULL) {
ogs_error("Buffer is NULL");
goto cleanup;
}
length = descriptions->length; length = descriptions->length;
ogs_assert(descriptions->buffer);
buffer = descriptions->buffer; buffer = descriptions->buffer;
size = 0; size = 0;
while (size < length) { while (size < length) {
memset(description, 0, sizeof(*description)); memset(description, 0, sizeof(*description));
if (size+3 > length) { ogs_assert(size+3 <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(description, buffer+size, 3); memcpy(description, buffer+size, 3);
size += 3; size += 3;
for (i = 0; i < description->num_of_parameter && for (i = 0; i < description->num_of_parameter &&
i < OGS_NAS_MAX_NUM_OF_QOS_FLOW_PARAMETER; i++) { i < OGS_NAS_MAX_NUM_OF_QOS_FLOW_PARAMETER; i++) {
if (size+sizeof(description->param[i].identifier) > length) { ogs_assert(size+sizeof(description->param[i].identifier) <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&description->param[i].identifier, buffer+size, memcpy(&description->param[i].identifier, buffer+size,
sizeof(description->param[i].identifier)); sizeof(description->param[i].identifier));
size += sizeof(description->param[i].identifier); size += sizeof(description->param[i].identifier);
if (size+sizeof(description->param[i].len) > length) { ogs_assert(size+sizeof(description->param[i].len) <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&description->param[i].len, buffer+size, memcpy(&description->param[i].len, buffer+size,
sizeof(description->param[i].len)); sizeof(description->param[i].len));
size += sizeof(description->param[i].len); size += sizeof(description->param[i].len);
switch(description->param[i].identifier) { switch(description->param[i].identifier) {
case OGS_NAX_QOS_FLOW_PARAMETER_ID_5QI: case OGS_NAX_QOS_FLOW_PARAMETER_ID_5QI:
if (description->param[i].len != 1) { ogs_assert(description->param[i].len == 1);
ogs_error("Invalid len[%d]", description->param[i].len); ogs_assert(size+description->param[i].len <= length);
goto cleanup;
}
if (size+description->param[i].len > length) {
ogs_error("Overflow: len[%d] length[%d]",
description->param[i].len, length);
goto cleanup;
}
memcpy(&description->param[i].qos_index, memcpy(&description->param[i].qos_index,
buffer+size, description->param[i].len); buffer+size, description->param[i].len);
size += description->param[i].len; size += description->param[i].len;
@ -545,15 +521,8 @@ int ogs_nas_parse_qos_flow_descriptions(
case OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_DOWNLINK: case OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_DOWNLINK:
case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_UPLINK: case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_UPLINK:
case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_DOWNLINK: case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_DOWNLINK:
if (description->param[i].len != 3) { ogs_assert(description->param[i].len == 3);
ogs_error("Invalid len[%d]", description->param[i].len); ogs_assert(size+description->param[i].len <= length);
goto cleanup;
}
if (size+description->param[i].len > length) {
ogs_error("Overflow: len[%d] length[%d]",
description->param[i].len, length);
goto cleanup;
}
memcpy(&description->param[i].br, memcpy(&description->param[i].br,
buffer+size, description->param[i].len); buffer+size, description->param[i].len);
description->param[i].br.value = description->param[i].br.value =
@ -561,17 +530,15 @@ int ogs_nas_parse_qos_flow_descriptions(
size += description->param[i].len; size += description->param[i].len;
break; break;
default: default:
ogs_error("Unknown qos_flow parameter identifier [%d]", ogs_fatal("Unknown qos_flow parameter identifier [%d]",
description->param[i].identifier); description->param[i].identifier);
goto cleanup; ogs_assert_if_reached();
} }
} }
description++; description++;
} }
cleanup:
return (int)(description-first); return (int)(description-first);
} }
@ -810,50 +777,28 @@ int ogs_nas_parse_qos_rules(
ogs_assert(rule); ogs_assert(rule);
ogs_assert(rules); ogs_assert(rules);
ogs_assert(rules->length);
if (rules->length == 0) {
ogs_error("Length is 0");
goto cleanup;
}
if (rules->buffer == NULL) {
ogs_error("Buffer is NULL");
goto cleanup;
}
length = rules->length; length = rules->length;
ogs_assert(rules->buffer);
buffer = rules->buffer; buffer = rules->buffer;
size = 0; size = 0;
while (size < length) { while (size < length) {
memset(rule, 0, sizeof(*rule)); memset(rule, 0, sizeof(*rule));
if (size+sizeof(rule->identifier) > length) { ogs_assert(size+sizeof(rule->identifier) <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->identifier, buffer+size, sizeof(rule->identifier)); memcpy(&rule->identifier, buffer+size, sizeof(rule->identifier));
size += sizeof(rule->identifier); size += sizeof(rule->identifier);
if (size+sizeof(rule->length) > length) { ogs_assert(size+sizeof(rule->length) <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->length, buffer+size, sizeof(rule->length)); memcpy(&rule->length, buffer+size, sizeof(rule->length));
rule->length = be16toh(rule->length); rule->length = be16toh(rule->length);
size += sizeof(rule->length); size += sizeof(rule->length);
if (size+sizeof(rule->flags) > length) { ogs_assert(size+sizeof(rule->flags) <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->flags, buffer+size, sizeof(rule->flags)); memcpy(&rule->flags, buffer+size, sizeof(rule->flags));
size += sizeof(rule->flags); size += sizeof(rule->flags);
if (rule->code == 0 || rule->code == 7) { /* Reserved */
ogs_error("Reserved Rule Code [%d]", rule->code);
goto cleanup;
}
if (rule->code == OGS_NAS_QOS_CODE_DELETE_EXISTING_QOS_RULE || if (rule->code == OGS_NAS_QOS_CODE_DELETE_EXISTING_QOS_RULE ||
rule->code == OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS) { rule->code == OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS) {
if (rule->num_of_packet_filter != 0) { if (rule->num_of_packet_filter != 0) {
@ -861,16 +806,12 @@ int ogs_nas_parse_qos_rules(
"and number of packet filter[%d]", "and number of packet filter[%d]",
rule->code, rule->num_of_packet_filter); rule->code, rule->num_of_packet_filter);
rule->num_of_packet_filter = 0; rule->num_of_packet_filter = 0;
goto cleanup;
} }
} }
for (i = 0; i < rule->num_of_packet_filter && for (i = 0; i < rule->num_of_packet_filter &&
i < OGS_MAX_NUM_OF_FLOW_IN_GTP; i++) { i < OGS_MAX_NUM_OF_FLOW_IN_GTP; i++) {
if (size+sizeof(rule->pf[i].flags) > length) { ogs_assert(size+sizeof(rule->pf[i].flags) <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->pf[i].flags, buffer+size, sizeof(rule->pf[i].flags)); memcpy(&rule->pf[i].flags, buffer+size, sizeof(rule->pf[i].flags));
size += sizeof(rule->pf[i].flags); size += sizeof(rule->pf[i].flags);
@ -878,35 +819,24 @@ int ogs_nas_parse_qos_rules(
OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS) OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS)
continue; continue;
if (size+sizeof(rule->pf[i].content.length) > length) { ogs_assert(size+sizeof(rule->pf[i].content.length) <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.length, buffer+size, memcpy(&rule->pf[i].content.length, buffer+size,
sizeof(rule->pf[i].content.length)); sizeof(rule->pf[i].content.length));
size += sizeof(rule->pf[i].content.length); size += sizeof(rule->pf[i].content.length);
j = 0; len = 0; j = 0; len = 0;
while(len < rule->pf[i].content.length) { while(len < rule->pf[i].content.length) {
if (size+len+ ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].type) > length) { sizeof(rule->pf[i].content.component[j].type) <= length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].type, memcpy(&rule->pf[i].content.component[j].type,
buffer+size+len, buffer+size+len,
sizeof(rule->pf[i].content.component[j].type)); sizeof(rule->pf[i].content.component[j].type));
len += sizeof(rule->pf[i].content.component[j].type); len += sizeof(rule->pf[i].content.component[j].type);
switch(rule->pf[i].content.component[j].type) { switch(rule->pf[i].content.component[j].type) {
case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE: case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
if (size+len+ ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].proto) > sizeof(rule->pf[i].content.component[j].proto) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].proto, memcpy(&rule->pf[i].content.component[j].proto,
buffer+size+len, buffer+size+len,
sizeof(rule->pf[i].content.component[j].proto)); sizeof(rule->pf[i].content.component[j].proto));
@ -914,25 +844,17 @@ int ogs_nas_parse_qos_rules(
break; break;
case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE: case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE: case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
if (size+len+ ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].ipv4.addr) > sizeof(rule->pf[i].content.component[j].ipv4.addr) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv4.addr, memcpy(&rule->pf[i].content.component[j].ipv4.addr,
buffer+size+len, buffer+size+len,
sizeof(rule->pf[i].content.component[j].ipv4.addr)); sizeof(rule->pf[i].content.component[j].ipv4.addr));
len += sizeof(rule->pf[i].content.component[j].ipv4.addr); len += sizeof(rule->pf[i].content.component[j].ipv4.addr);
if (size+len+ ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].ipv4.mask) > sizeof(rule->pf[i].content.component[j].ipv4.mask) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv4.mask, memcpy(&rule->pf[i].content.component[j].ipv4.mask,
buffer+size+len, buffer+size+len,
sizeof(rule->pf[i].content.component[j].ipv4.mask)); sizeof(rule->pf[i].content.component[j].ipv4.mask));
@ -940,26 +862,18 @@ int ogs_nas_parse_qos_rules(
break; break;
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE: case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE: case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
if (size+len+ ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].ipv6.addr) > sizeof(rule->pf[i].content.component[j].ipv6.addr) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv6.addr, memcpy(&rule->pf[i].content.component[j].ipv6.addr,
buffer+size+len, buffer+size+len,
sizeof(rule->pf[i].content.component[j].ipv6.addr)); sizeof(rule->pf[i].content.component[j].ipv6.addr));
len += sizeof(rule->pf[i].content.component[j].ipv6.addr); len += sizeof(rule->pf[i].content.component[j].ipv6.addr);
if (size+len+ ogs_assert(size+len+
sizeof( sizeof(
rule->pf[i].content.component[j].ipv6.prefixlen) > rule->pf[i].content.component[j].ipv6.prefixlen) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv6.prefixlen, memcpy(&rule->pf[i].content.component[j].ipv6.prefixlen,
buffer+size+len, buffer+size+len,
sizeof( sizeof(
@ -969,14 +883,10 @@ int ogs_nas_parse_qos_rules(
break; break;
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE: case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE: case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
if (size+len+ ogs_assert(size+len+
sizeof( sizeof(
rule->pf[i].content.component[j].ipv6_mask.addr) > rule->pf[i].content.component[j].ipv6_mask.addr) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv6_mask.addr, memcpy(&rule->pf[i].content.component[j].ipv6_mask.addr,
buffer+size+len, buffer+size+len,
sizeof( sizeof(
@ -984,14 +894,10 @@ int ogs_nas_parse_qos_rules(
len += sizeof( len += sizeof(
rule->pf[i].content.component[j].ipv6_mask.addr); rule->pf[i].content.component[j].ipv6_mask.addr);
if (size+len+ ogs_assert(size+len+
sizeof( sizeof(
rule->pf[i].content.component[j].ipv6_mask.mask) > rule->pf[i].content.component[j].ipv6_mask.mask) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv6_mask.mask, memcpy(&rule->pf[i].content.component[j].ipv6_mask.mask,
buffer+size+len, buffer+size+len,
sizeof( sizeof(
@ -1001,13 +907,9 @@ int ogs_nas_parse_qos_rules(
break; break;
case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE: case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE: case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
if (size+len+ ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].port.low) > sizeof(rule->pf[i].content.component[j].port.low) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].port.low, memcpy(&rule->pf[i].content.component[j].port.low,
buffer+size+len, buffer+size+len,
sizeof(rule->pf[i].content.component[j].port.low)); sizeof(rule->pf[i].content.component[j].port.low));
@ -1017,13 +919,9 @@ int ogs_nas_parse_qos_rules(
break; break;
case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE: case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE: case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
if (size+len+ ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].port.low) > sizeof(rule->pf[i].content.component[j].port.low) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].port.low, memcpy(&rule->pf[i].content.component[j].port.low,
buffer+size+len, buffer+size+len,
sizeof(rule->pf[i].content.component[j].port.low)); sizeof(rule->pf[i].content.component[j].port.low));
@ -1031,13 +929,9 @@ int ogs_nas_parse_qos_rules(
be16toh(rule->pf[i].content.component[j].port.low); be16toh(rule->pf[i].content.component[j].port.low);
len += sizeof(rule->pf[i].content.component[j].port.low); len += sizeof(rule->pf[i].content.component[j].port.low);
if (size+len+ ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].port.high) > sizeof(rule->pf[i].content.component[j].port.high) <=
length) { length);
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].port.high, memcpy(&rule->pf[i].content.component[j].port.high,
buffer+size+len, buffer+size+len,
sizeof(rule->pf[i].content.component[j].port.high)); sizeof(rule->pf[i].content.component[j].port.high));
@ -1048,7 +942,7 @@ int ogs_nas_parse_qos_rules(
default: default:
ogs_error("Unknown Packet Filter Type(%d)", ogs_error("Unknown Packet Filter Type(%d)",
rule->pf[i].content.component[j].type); rule->pf[i].content.component[j].type);
goto cleanup; return -1;
} }
j++; j++;
} }
@ -1060,17 +954,11 @@ int ogs_nas_parse_qos_rules(
rule->code != OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS && rule->code != OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS &&
rule->code != OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS) { rule->code != OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS) {
if (size+sizeof(rule->precedence) > length) { ogs_assert(size+sizeof(rule->precedence) <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->precedence, buffer+size, sizeof(rule->precedence)); memcpy(&rule->precedence, buffer+size, sizeof(rule->precedence));
size += sizeof(rule->precedence); size += sizeof(rule->precedence);
if (size+sizeof(rule->flow.flags) > length) { ogs_assert(size+sizeof(rule->flow.flags) <= length);
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->flow.flags, buffer+size, sizeof(rule->flow.flags)); memcpy(&rule->flow.flags, buffer+size, sizeof(rule->flow.flags));
size += sizeof(rule->flow.flags); size += sizeof(rule->flow.flags);
} }
@ -1078,8 +966,6 @@ int ogs_nas_parse_qos_rules(
rule++; rule++;
} }
cleanup:
return (int)(rule-first); return (int)(rule-first);
} }

View File

@ -743,7 +743,6 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do { do {
ogs_pfcp_subnet_t *subnet = NULL; ogs_pfcp_subnet_t *subnet = NULL;
const char *ipstr = NULL; const char *ipstr = NULL;
const char *gateway = NULL;
const char *mask_or_numbits = NULL; const char *mask_or_numbits = NULL;
const char *dnn = NULL; const char *dnn = NULL;
const char *dev = self.tun_ifname; const char *dev = self.tun_ifname;
@ -782,8 +781,6 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
mask_or_numbits = (const char *)v; mask_or_numbits = (const char *)v;
} }
} }
} else if (!strcmp(subnet_key, "gateway")) {
gateway = ogs_yaml_iter_value(&subnet_iter);
} else if (!strcmp(subnet_key, "apn") || } else if (!strcmp(subnet_key, "apn") ||
!strcmp(subnet_key, "dnn")) { !strcmp(subnet_key, "dnn")) {
dnn = ogs_yaml_iter_value(&subnet_iter); dnn = ogs_yaml_iter_value(&subnet_iter);
@ -828,7 +825,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
} }
subnet = ogs_pfcp_subnet_add( subnet = ogs_pfcp_subnet_add(
ipstr, mask_or_numbits, gateway, dnn, dev); ipstr, mask_or_numbits, dnn, dev);
ogs_assert(subnet); ogs_assert(subnet);
subnet->num_of_range = num; subnet->num_of_range = num;
@ -2153,7 +2150,7 @@ ogs_pfcp_dev_t *ogs_pfcp_dev_find_by_ifname(const char *ifname)
ogs_pfcp_subnet_t *ogs_pfcp_subnet_add( ogs_pfcp_subnet_t *ogs_pfcp_subnet_add(
const char *ipstr, const char *mask_or_numbits, const char *ipstr, const char *mask_or_numbits,
const char *gateway, const char *dnn, const char *ifname) const char *dnn, const char *ifname)
{ {
int rv; int rv;
ogs_pfcp_dev_t *dev = NULL; ogs_pfcp_dev_t *dev = NULL;
@ -2182,41 +2179,6 @@ ogs_pfcp_subnet_t *ogs_pfcp_subnet_add(
subnet->family = subnet->gw.family; subnet->family = subnet->gw.family;
subnet->prefixlen = atoi(mask_or_numbits); subnet->prefixlen = atoi(mask_or_numbits);
if (memcmp(subnet->gw.sub, subnet->sub.sub,
sizeof(subnet->gw.sub)) != 0) {
char *subnet_string = NULL;
if (subnet->family == AF_INET) {
subnet_string = ogs_ipv4_to_string(subnet->sub.sub[0]);
ogs_assert(subnet_string);
} else if (subnet->family == AF_INET6) {
subnet_string = ogs_ipv6addr_to_string(
(uint8_t*)&subnet->sub.sub[0]);
ogs_assert(subnet_string);
}
ogs_warn("Please change the configuration files of "
"smf.yaml and upf.yaml as below.");
ogs_log_print(OGS_LOG_WARN, "\n<OLD Format>\n");
ogs_log_print(OGS_LOG_WARN, "smf:\n");
ogs_log_print(OGS_LOG_WARN, " session:\n");
ogs_log_print(OGS_LOG_WARN, " - subnet: %s/%s\n",
ipstr, mask_or_numbits);
ogs_log_print(OGS_LOG_WARN, "\n<NEW Format>\n");
ogs_log_print(OGS_LOG_WARN, "smf:\n");
ogs_log_print(OGS_LOG_WARN, " session:\n");
ogs_log_print(OGS_LOG_WARN, " - subnet: %s/%s\n",
subnet_string ? subnet_string : "Unknown", mask_or_numbits);
ogs_log_print(OGS_LOG_WARN, " gateway: %s\n\n\n", ipstr);
ogs_free(subnet_string);
}
}
if (gateway) {
rv = ogs_ipsubnet(&subnet->gw, gateway, NULL);
ogs_assert(rv == OGS_OK);
} }
if (dnn) if (dnn)

View File

@ -491,7 +491,7 @@ ogs_pfcp_dev_t *ogs_pfcp_dev_find_by_ifname(const char *ifname);
ogs_pfcp_subnet_t *ogs_pfcp_subnet_add( ogs_pfcp_subnet_t *ogs_pfcp_subnet_add(
const char *ipstr, const char *mask_or_numbits, const char *ipstr, const char *mask_or_numbits,
const char *gateway, const char *dnn, const char *ifname); const char *dnn, const char *ifname);
ogs_pfcp_subnet_t *ogs_pfcp_subnet_next(ogs_pfcp_subnet_t *subnet); ogs_pfcp_subnet_t *ogs_pfcp_subnet_next(ogs_pfcp_subnet_t *subnet);
void ogs_pfcp_subnet_remove(ogs_pfcp_subnet_t *subnet); void ogs_pfcp_subnet_remove(ogs_pfcp_subnet_t *subnet);
void ogs_pfcp_subnet_remove_all(void); void ogs_pfcp_subnet_remove_all(void);

View File

@ -94,7 +94,6 @@ bool ogs_pfcp_cp_handle_association_setup_request(
ogs_pfcp_association_setup_request_t *req) ogs_pfcp_association_setup_request_t *req)
{ {
int i; int i;
int16_t decoded;
ogs_assert(xact); ogs_assert(xact);
ogs_assert(node); ogs_assert(node);
@ -113,11 +112,8 @@ bool ogs_pfcp_cp_handle_association_setup_request(
if (message->presence == 0) if (message->presence == 0)
break; break;
decoded = ogs_pfcp_parse_user_plane_ip_resource_info(&info, message); ogs_pfcp_parse_user_plane_ip_resource_info(&info, message);
if (message->len == decoded) ogs_gtpu_resource_add(&node->gtpu_resource_list, &info);
ogs_gtpu_resource_add(&node->gtpu_resource_list, &info);
else
ogs_error("Invalid User Plane IP Resource Info");
} }
if (req->up_function_features.presence) { if (req->up_function_features.presence) {
@ -147,7 +143,6 @@ bool ogs_pfcp_cp_handle_association_setup_response(
ogs_pfcp_association_setup_response_t *rsp) ogs_pfcp_association_setup_response_t *rsp)
{ {
int i; int i;
int16_t decoded;
ogs_assert(xact); ogs_assert(xact);
ogs_pfcp_xact_commit(xact); ogs_pfcp_xact_commit(xact);
@ -165,11 +160,8 @@ bool ogs_pfcp_cp_handle_association_setup_response(
if (message->presence == 0) if (message->presence == 0)
break; break;
decoded = ogs_pfcp_parse_user_plane_ip_resource_info(&info, message); ogs_pfcp_parse_user_plane_ip_resource_info(&info, message);
if (message->len == decoded) ogs_gtpu_resource_add(&node->gtpu_resource_list, &info);
ogs_gtpu_resource_add(&node->gtpu_resource_list, &info);
else
ogs_error("Invalid User Plane IP Resource Info");
} }
if (rsp->up_function_features.presence) { if (rsp->up_function_features.presence) {
@ -432,10 +424,7 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_create_pdr(ogs_pfcp_sess_t *sess,
len = ogs_pfcp_parse_sdf_filter( len = ogs_pfcp_parse_sdf_filter(
&sdf_filter, &message->pdi.sdf_filter[i]); &sdf_filter, &message->pdi.sdf_filter[i]);
if (message->pdi.sdf_filter[i].len != len) { ogs_assert(message->pdi.sdf_filter[i].len == len);
ogs_error("Invalid SDF Filter");
break;
}
/* Check Previous SDF Filter ID */ /* Check Previous SDF Filter ID */
if (sdf_filter.bid) { if (sdf_filter.bid) {
@ -529,13 +518,12 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_create_pdr(ogs_pfcp_sess_t *sess,
if (message->pdi.network_instance.presence) { if (message->pdi.network_instance.presence) {
char dnn[OGS_MAX_DNN_LEN+1]; char dnn[OGS_MAX_DNN_LEN+1];
if (ogs_fqdn_parse(dnn, message->pdi.network_instance.data, ogs_assert(0 < ogs_fqdn_parse(dnn,
ogs_min(message->pdi.network_instance.len, OGS_MAX_DNN_LEN)) > 0) { message->pdi.network_instance.data,
pdr->dnn = ogs_strdup(dnn); ogs_min(message->pdi.network_instance.len, OGS_MAX_DNN_LEN)));
ogs_assert(pdr->dnn);
} else { pdr->dnn = ogs_strdup(dnn);
ogs_error("Invalid pdi.network_instance"); ogs_assert(pdr->dnn);
}
} }
pdr->chid = false; pdr->chid = false;
@ -777,10 +765,7 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_update_pdr(ogs_pfcp_sess_t *sess,
len = ogs_pfcp_parse_sdf_filter( len = ogs_pfcp_parse_sdf_filter(
&sdf_filter, &message->pdi.sdf_filter[i]); &sdf_filter, &message->pdi.sdf_filter[i]);
if (message->pdi.sdf_filter[i].len != len) { ogs_assert(message->pdi.sdf_filter[i].len == len);
ogs_error("Invalid SDF Filter");
break;
}
/* Check Previous SDF Filter ID */ /* Check Previous SDF Filter ID */
if (sdf_filter.bid) { if (sdf_filter.bid) {
@ -870,16 +855,14 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_update_pdr(ogs_pfcp_sess_t *sess,
if (message->pdi.network_instance.presence) { if (message->pdi.network_instance.presence) {
char dnn[OGS_MAX_DNN_LEN+1]; char dnn[OGS_MAX_DNN_LEN+1];
if (ogs_fqdn_parse(dnn, message->pdi.network_instance.data, ogs_assert(0 < ogs_fqdn_parse(dnn,
ogs_min(message->pdi.network_instance.len, message->pdi.network_instance.data,
OGS_MAX_DNN_LEN)) > 0) { ogs_min(message->pdi.network_instance.len, OGS_MAX_DNN_LEN)));
if (pdr->dnn)
ogs_free(pdr->dnn); if (pdr->dnn)
pdr->dnn = ogs_strdup(dnn); ogs_free(pdr->dnn);
ogs_assert(pdr->dnn); pdr->dnn = ogs_strdup(dnn);
} else { ogs_assert(pdr->dnn);
ogs_error("Invalid pdi.network_instance");
}
} }
if (message->pdi.local_f_teid.presence) { if (message->pdi.local_f_teid.presence) {
@ -981,15 +964,13 @@ ogs_pfcp_far_t *ogs_pfcp_handle_create_far(ogs_pfcp_sess_t *sess,
if (message->forwarding_parameters.network_instance.presence) { if (message->forwarding_parameters.network_instance.presence) {
char dnn[OGS_MAX_DNN_LEN+1]; char dnn[OGS_MAX_DNN_LEN+1];
if (ogs_fqdn_parse(dnn, ogs_assert(0 < ogs_fqdn_parse(dnn,
message->forwarding_parameters.network_instance.data, message->forwarding_parameters.network_instance.data,
ogs_min(message->forwarding_parameters.network_instance.len, ogs_min(message->forwarding_parameters.network_instance.len,
OGS_MAX_DNN_LEN)) > 0) { OGS_MAX_DNN_LEN)));
far->dnn = ogs_strdup(dnn);
ogs_assert(far->dnn); far->dnn = ogs_strdup(dnn);
} else { ogs_assert(far->dnn);
ogs_error("Invalid forwarding_parameters.network_instance");
}
} }
if (message->forwarding_parameters.outer_header_creation.presence) { if (message->forwarding_parameters.outer_header_creation.presence) {
@ -1088,18 +1069,15 @@ ogs_pfcp_far_t *ogs_pfcp_handle_update_far(ogs_pfcp_sess_t *sess,
if (message->update_forwarding_parameters.network_instance.presence) { if (message->update_forwarding_parameters.network_instance.presence) {
char dnn[OGS_MAX_DNN_LEN+1]; char dnn[OGS_MAX_DNN_LEN+1];
if (ogs_fqdn_parse(dnn, ogs_assert(0 < ogs_fqdn_parse(dnn,
message->update_forwarding_parameters.network_instance.data, message->update_forwarding_parameters.network_instance.data,
ogs_min(message->update_forwarding_parameters. ogs_min(message->update_forwarding_parameters.
network_instance.len, OGS_MAX_DNN_LEN)) > 0) { network_instance.len, OGS_MAX_DNN_LEN)));
if (far->dnn)
ogs_free(far->dnn); if (far->dnn)
far->dnn = ogs_strdup(dnn); ogs_free(far->dnn);
ogs_assert(far->dnn); far->dnn = ogs_strdup(dnn);
} else { ogs_assert(far->dnn);
ogs_error("Invalid "
"update_forwarding_parameters.network_instance");
}
} }
if (message->update_forwarding_parameters. if (message->update_forwarding_parameters.
@ -1329,7 +1307,6 @@ ogs_pfcp_urr_t *ogs_pfcp_handle_create_urr(ogs_pfcp_sess_t *sess,
ogs_pfcp_tlv_create_urr_t *message, ogs_pfcp_tlv_create_urr_t *message,
uint8_t *cause_value, uint8_t *offending_ie_value) uint8_t *cause_value, uint8_t *offending_ie_value)
{ {
int16_t decoded;
ogs_pfcp_urr_t *urr = NULL; ogs_pfcp_urr_t *urr = NULL;
ogs_assert(message); ogs_assert(message);
@ -1378,26 +1355,12 @@ ogs_pfcp_urr_t *ogs_pfcp_handle_create_urr(ogs_pfcp_sess_t *sess,
if (message->volume_threshold.presence && if (message->volume_threshold.presence &&
(urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) { (urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) {
decoded = ogs_pfcp_parse_volume( ogs_pfcp_parse_volume(&urr->vol_threshold, &message->volume_threshold);
&urr->vol_threshold, &message->volume_threshold);
if (message->volume_threshold.len != decoded) {
ogs_error("Invalid Volume Threshold");
*cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT;
*offending_ie_value = OGS_PFCP_VOLUME_THRESHOLD_TYPE;
return NULL;
}
} }
if (message->volume_quota.presence && if (message->volume_quota.presence &&
(urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) { (urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) {
decoded = ogs_pfcp_parse_volume( ogs_pfcp_parse_volume(&urr->vol_quota, &message->volume_quota);
&urr->vol_quota, &message->volume_quota);
if (message->volume_quota.len != decoded) {
ogs_error("Invalid Volume Quota");
*cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT;
*offending_ie_value = OGS_PFCP_VOLUME_QUOTA_TYPE;
return NULL;
}
} }
if (message->event_threshold.presence && if (message->event_threshold.presence &&
@ -1446,7 +1409,6 @@ ogs_pfcp_urr_t *ogs_pfcp_handle_update_urr(ogs_pfcp_sess_t *sess,
ogs_pfcp_tlv_update_urr_t *message, ogs_pfcp_tlv_update_urr_t *message,
uint8_t *cause_value, uint8_t *offending_ie_value) uint8_t *cause_value, uint8_t *offending_ie_value)
{ {
int16_t decoded;
ogs_pfcp_urr_t *urr = NULL; ogs_pfcp_urr_t *urr = NULL;
ogs_assert(message); ogs_assert(message);
@ -1485,26 +1447,12 @@ ogs_pfcp_urr_t *ogs_pfcp_handle_update_urr(ogs_pfcp_sess_t *sess,
if (message->volume_threshold.presence && if (message->volume_threshold.presence &&
(urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) { (urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) {
decoded = ogs_pfcp_parse_volume( ogs_pfcp_parse_volume(&urr->vol_threshold, &message->volume_threshold);
&urr->vol_threshold, &message->volume_threshold);
if (message->volume_threshold.len != decoded) {
ogs_error("Invalid Volume Threshold");
*cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT;
*offending_ie_value = OGS_PFCP_VOLUME_THRESHOLD_TYPE;
return NULL;
}
} }
if (message->volume_quota.presence && if (message->volume_quota.presence &&
(urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) { (urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) {
decoded = ogs_pfcp_parse_volume( ogs_pfcp_parse_volume(&urr->vol_quota, &message->volume_quota);
&urr->vol_quota, &message->volume_quota);
if (message->volume_quota.len != decoded) {
ogs_error("Invalid Volume Quota");
*cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT;
*offending_ie_value = OGS_PFCP_VOLUME_QUOTA_TYPE;
return NULL;
}
} }
if (message->event_threshold.presence && if (message->event_threshold.presence &&

View File

@ -149,22 +149,14 @@ int16_t ogs_pfcp_parse_user_plane_ip_resource_info(
size++; size++;
if (info->teidri) { if (info->teidri) {
if (size + sizeof(info->teid_range) > octet->len) { ogs_assert(size + sizeof(info->teid_range) <= octet->len);
ogs_error("size[%d]+sizeof(info->teid_range)[%d] > IE Length[%d]",
size, (int)sizeof(info->teid_range), octet->len);
return 0;
}
memcpy(&info->teid_range, (unsigned char *)octet->data + size, memcpy(&info->teid_range, (unsigned char *)octet->data + size,
sizeof(info->teid_range)); sizeof(info->teid_range));
size += sizeof(info->teid_range); size += sizeof(info->teid_range);
} }
if (info->v4) { if (info->v4) {
if (size + sizeof(info->addr) > octet->len) { ogs_assert(size + sizeof(info->addr) <= octet->len);
ogs_error("size[%d]+sizeof(info->addr)[%d] > IE Length[%d]",
size, (int)sizeof(info->addr), octet->len);
return 0;
}
memcpy(&info->addr, memcpy(&info->addr,
(unsigned char *)octet->data + size, (unsigned char *)octet->data + size,
sizeof(info->addr)); sizeof(info->addr));
@ -172,51 +164,30 @@ int16_t ogs_pfcp_parse_user_plane_ip_resource_info(
} }
if (info->v6) { if (info->v6) {
if (size + OGS_IPV6_LEN > octet->len) { ogs_assert(size + OGS_IPV6_LEN <= octet->len);
ogs_error("size[%d]+OGS_IPV6_LEN[%d] > IE Length[%d]",
size, (int)OGS_IPV6_LEN, octet->len);
return 0;
}
memcpy(&info->addr6, (unsigned char *)octet->data + size, OGS_IPV6_LEN); memcpy(&info->addr6, (unsigned char *)octet->data + size, OGS_IPV6_LEN);
size += OGS_IPV6_LEN; size += OGS_IPV6_LEN;
} }
if (info->assoni) { if (info->assoni) {
int len = octet->len - size; int len = octet->len - size;
if (len <= 0) {
ogs_error("len[%d] octect->len[%d] size[%d]", len, octet->len, size);
return 0;
}
if (info->assosi) len--; if (info->assosi) len--;
if (len <= 0) {
ogs_error("info->assosi[%d] len[%d] octect->len[%d] size[%d]",
info->assosi, len, octet->len, size);
return 0;
}
if (ogs_fqdn_parse(info->network_instance, (char *)octet->data + size, ogs_assert(0 < ogs_fqdn_parse(
ogs_min(len, OGS_MAX_APN_LEN)) <= 0) { info->network_instance, (char *)octet->data + size,
ogs_error("Invalid info->network_instance"); ogs_min(len, OGS_MAX_APN_LEN)));
info->network_instance[0] = 0;
}
size += len; size += len;
} }
if (info->assosi) { if (info->assosi) {
if (size + sizeof(info->source_interface) > octet->len) { ogs_assert(size + sizeof(info->source_interface) <=
ogs_error("size[%d]+sizeof(info->source_interface)[%d] > " octet->len);
"IE Length[%d]",
size, (int)sizeof(info->source_interface), octet->len);
return 0;
}
memcpy(&info->source_interface, (unsigned char *)octet->data + size, memcpy(&info->source_interface, (unsigned char *)octet->data + size,
sizeof(info->source_interface)); sizeof(info->source_interface));
size += sizeof(info->source_interface); size += sizeof(info->source_interface);
} }
if (size != octet->len) ogs_assert(size == octet->len);
ogs_error("Mismatch IE Length[%d] != Decoded[%d]", octet->len, size);
return size; return size;
} }
@ -311,32 +282,18 @@ int16_t ogs_pfcp_parse_sdf_filter(
memset(filter, 0, sizeof(ogs_pfcp_sdf_filter_t)); memset(filter, 0, sizeof(ogs_pfcp_sdf_filter_t));
if (size + sizeof(filter->flags) > octet->len) { ogs_assert(size + sizeof(filter->flags) <= octet->len);
ogs_error("size[%d]+sizeof(filter->flags)[%d] > IE Length[%d]",
size, (int)sizeof(filter->flags), octet->len);
return 0;
}
memcpy(&filter->flags, memcpy(&filter->flags,
(unsigned char *)octet->data + size, sizeof(filter->flags)); (unsigned char *)octet->data + size, sizeof(filter->flags));
size++; size++;
if (size + sizeof(filter->spare2) > octet->len) { ogs_assert(size + sizeof(filter->spare2) <= octet->len);
ogs_error("size[%d]+sizeof(filter->spare2)[%d] > IE Length[%d]",
size, (int)sizeof(filter->spare2), octet->len);
return 0;
}
memcpy(&filter->spare2, memcpy(&filter->spare2,
(unsigned char *)octet->data + size, sizeof(filter->flags)); (unsigned char *)octet->data + size, sizeof(filter->flags));
size++; size++;
if (filter->fd) { if (filter->fd) {
if (size + sizeof(filter->flow_description_len) > octet->len) { ogs_assert(size + sizeof(filter->flow_description_len) <= octet->len);
ogs_error("size[%d]+sizeof(filter->flow_description_len)[%d] "
"> IE Length[%d]",
size, (int)sizeof(filter->flow_description_len),
octet->len);
return 0;
}
memcpy(&filter->flow_description_len, memcpy(&filter->flow_description_len,
(unsigned char *)octet->data + size, (unsigned char *)octet->data + size,
sizeof(filter->flow_description_len)); sizeof(filter->flow_description_len));
@ -348,12 +305,7 @@ int16_t ogs_pfcp_parse_sdf_filter(
} }
if (filter->ttc) { if (filter->ttc) {
if (size + sizeof(filter->tos_traffic_class) > octet->len) { ogs_assert(size + sizeof(filter->tos_traffic_class) <= octet->len);
ogs_error("size[%d]+sizeof(filter->tos_traffic_class)[%d] "
"> IE Length[%d]",
size, (int)sizeof(filter->tos_traffic_class), octet->len);
return 0;
}
memcpy(&filter->tos_traffic_class, memcpy(&filter->tos_traffic_class,
(unsigned char *)octet->data + size, (unsigned char *)octet->data + size,
sizeof(filter->tos_traffic_class)); sizeof(filter->tos_traffic_class));
@ -362,13 +314,8 @@ int16_t ogs_pfcp_parse_sdf_filter(
} }
if (filter->spi) { if (filter->spi) {
if (size + sizeof(filter->security_parameter_index) > octet->len) { ogs_assert(size + sizeof(filter->security_parameter_index) <=
ogs_error("size[%d]+sizeof(filter->security_parameter_index)[%d] " octet->len);
"> IE Length[%d]",
size, (int)sizeof(filter->security_parameter_index),
octet->len);
return 0;
}
memcpy(&filter->security_parameter_index, memcpy(&filter->security_parameter_index,
(unsigned char *)octet->data + size, (unsigned char *)octet->data + size,
sizeof(filter->security_parameter_index)); sizeof(filter->security_parameter_index));
@ -379,11 +326,7 @@ int16_t ogs_pfcp_parse_sdf_filter(
if (filter->fl) { if (filter->fl) {
int bit24_len = 3; int bit24_len = 3;
if (size + bit24_len > octet->len) { ogs_assert(size + bit24_len <= octet->len);
ogs_error("size[%d]+bit24_len[%d] > IE Length[%d]",
size, bit24_len, octet->len);
return 0;
}
memcpy(&filter->flow_label, memcpy(&filter->flow_label,
(unsigned char *)octet->data + size, bit24_len); (unsigned char *)octet->data + size, bit24_len);
filter->flow_label = be32toh(filter->flow_label); filter->flow_label = be32toh(filter->flow_label);
@ -391,20 +334,14 @@ int16_t ogs_pfcp_parse_sdf_filter(
} }
if (filter->bid) { if (filter->bid) {
if (size + sizeof(filter->sdf_filter_id) > octet->len) { ogs_assert(size + sizeof(filter->sdf_filter_id) <= octet->len);
ogs_error("size[%d]+sizeof(filter->sdf_filter_id)[%d]"
"> IE Length[%d]",
size, (int)sizeof(filter->sdf_filter_id), octet->len);
return 0;
}
memcpy(&filter->sdf_filter_id, (unsigned char *)octet->data + size, memcpy(&filter->sdf_filter_id, (unsigned char *)octet->data + size,
sizeof(filter->sdf_filter_id)); sizeof(filter->sdf_filter_id));
filter->sdf_filter_id = be32toh(filter->sdf_filter_id); filter->sdf_filter_id = be32toh(filter->sdf_filter_id);
size += sizeof(filter->sdf_filter_id); size += sizeof(filter->sdf_filter_id);
} }
if (size != octet->len) ogs_assert(size == octet->len);
ogs_error("Mismatch IE Length[%d] != Decoded[%d]", octet->len, size);
return size; return size;
} }
@ -542,44 +479,25 @@ int16_t ogs_pfcp_parse_volume(
size += sizeof(volume->flags); size += sizeof(volume->flags);
if (volume->tovol) { if (volume->tovol) {
if (size + sizeof(volume->total_volume) > octet->len) {
ogs_error("size[%d]+sizeof(volume->total_volume)[%d] "
"> IE Length[%d]",
size, (int)sizeof(volume->total_volume), octet->len);
return 0;
}
memcpy(&volume->total_volume, (unsigned char *)octet->data + size, memcpy(&volume->total_volume, (unsigned char *)octet->data + size,
sizeof(volume->total_volume)); sizeof(volume->total_volume));
volume->total_volume = be64toh(volume->total_volume); volume->total_volume = be64toh(volume->total_volume);
size += sizeof(volume->total_volume); size += sizeof(volume->total_volume);
} }
if (volume->ulvol) { if (volume->ulvol) {
if (size + sizeof(volume->uplink_volume) > octet->len) {
ogs_error("size[%d]+sizeof(volume->uplink_volume)[%d] "
"> IE Length[%d]",
size, (int)sizeof(volume->uplink_volume), octet->len);
return 0;
}
memcpy(&volume->uplink_volume, (unsigned char *)octet->data + size, memcpy(&volume->uplink_volume, (unsigned char *)octet->data + size,
sizeof(volume->uplink_volume)); sizeof(volume->uplink_volume));
volume->uplink_volume = be64toh(volume->uplink_volume); volume->uplink_volume = be64toh(volume->uplink_volume);
size += sizeof(volume->uplink_volume); size += sizeof(volume->uplink_volume);
} }
if (volume->dlvol) { if (volume->dlvol) {
if (size + sizeof(volume->downlink_volume) > octet->len) {
ogs_error("size[%d]+sizeof(volume->downlink_volume)[%d] "
"> IE Length[%d]",
size, (int)sizeof(volume->downlink_volume), octet->len);
return 0;
}
memcpy(&volume->downlink_volume, (unsigned char *)octet->data + size, memcpy(&volume->downlink_volume, (unsigned char *)octet->data + size,
sizeof(volume->downlink_volume)); sizeof(volume->downlink_volume));
volume->downlink_volume = be64toh(volume->downlink_volume); volume->downlink_volume = be64toh(volume->downlink_volume);
size += sizeof(volume->downlink_volume); size += sizeof(volume->downlink_volume);
} }
if (size != octet->len) ogs_assert(size == octet->len);
ogs_error("Mismatch IE Length[%d] != Decoded[%d]", octet->len, size);
return size; return size;
} }

View File

@ -419,8 +419,8 @@ int ogs_fqdn_parse(char *dst, const char *src, int length)
while (i+1 < length) { while (i+1 < length) {
len = src[i++]; len = src[i++];
if ((j + len + 1) > length) { if ((j + len + 1) > length) {
ogs_error("Invalid FQDN encoding[j:%d+len:%d] + 1 > length[%d]", ogs_error("Invalid FQDN encoding[len:%d] + 1 > length[%d]",
j, len, length); len, length);
ogs_log_hexdump(OGS_LOG_ERROR, (unsigned char *)src, length); ogs_log_hexdump(OGS_LOG_ERROR, (unsigned char *)src, length);
return 0; return 0;
} }

View File

@ -379,6 +379,11 @@ ED2(uint8_t spare:4;,
typedef struct ogs_paa_s { typedef struct ogs_paa_s {
ED2(uint8_t spare:5;, ED2(uint8_t spare:5;,
/* 8.34 PDN Type */ /* 8.34 PDN Type */
#define OGS_PDU_SESSION_TYPE_IS_VALID(x) \
((x) == OGS_PDU_SESSION_TYPE_IPV4 || \
(x) == OGS_PDU_SESSION_TYPE_IPV6 || \
(x) == OGS_PDU_SESSION_TYPE_IPV4V6) \
uint8_t session_type:3;) uint8_t session_type:3;)
union { union {
/* PDU_SESSION_TYPE_IPV4 */ /* PDU_SESSION_TYPE_IPV4 */

View File

@ -57,19 +57,6 @@ extern "C" {
OGS_OBJECT_REF(__pClient); \ OGS_OBJECT_REF(__pClient); \
((__cTX)->client) = (__pClient); \ ((__cTX)->client) = (__pClient); \
ogs_debug("CLIENT Ref [%d]", (__pClient)->reference_count); \ ogs_debug("CLIENT Ref [%d]", (__pClient)->reference_count); \
if ((__pClient)->fqdn) { \
ogs_info("NF EndPoint(fqdn) setup [%s:%d]", \
(__pClient)->fqdn, (__pClient)->fqdn_port); \
} \
if ((__pClient)->addr) { \
ogs_info("NF EndPoint(addr) setup [%s:%d]", \
OGS_ADDR((__pClient)->addr, buf), OGS_PORT((__pClient)->addr)); \
} \
if ((__pClient)->addr6) { \
ogs_info("NF EndPoint(addr6) setup [%s:%d]", \
OGS_ADDR((__pClient)->addr6, buf), \
OGS_PORT((__pClient)->addr6)); \
} \
} while(0) } while(0)
typedef int (*ogs_sbi_client_cb_f)( typedef int (*ogs_sbi_client_cb_f)(

View File

@ -1085,6 +1085,8 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(void)
ogs_assert(nf_instance); ogs_assert(nf_instance);
memset(nf_instance, 0, sizeof(ogs_sbi_nf_instance_t)); memset(nf_instance, 0, sizeof(ogs_sbi_nf_instance_t));
OGS_OBJECT_REF(nf_instance);
nf_instance->time.heartbeat_interval = nf_instance->time.heartbeat_interval =
ogs_local_conf()->time.nf_instance.heartbeat_interval; ogs_local_conf()->time.nf_instance.heartbeat_interval;
@ -1094,10 +1096,10 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(void)
ogs_list_add(&ogs_sbi_self()->nf_instance_list, nf_instance); ogs_list_add(&ogs_sbi_self()->nf_instance_list, nf_instance);
ogs_debug("[%s] NFInstance added with Ref [%s]", ogs_debug("[%s] NFInstance added with Ref [%s:%d]",
nf_instance->nf_type ? nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL", OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id); nf_instance->id, nf_instance->reference_count);
return nf_instance; return nf_instance;
} }
@ -1194,10 +1196,20 @@ void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance)
{ {
ogs_assert(nf_instance); ogs_assert(nf_instance);
ogs_debug("[%s] NFInstance removed [%s]", ogs_debug("[%s] NFInstance UnRef [%s:%d]",
nf_instance->nf_type ? nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL", OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id); nf_instance->id, nf_instance->reference_count);
if (OGS_OBJECT_IS_REF(nf_instance)) {
OGS_OBJECT_UNREF(nf_instance);
return;
}
ogs_debug("[%s] NFInstance removed [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
ogs_list_remove(&ogs_sbi_self()->nf_instance_list, nf_instance); ogs_list_remove(&ogs_sbi_self()->nf_instance_list, nf_instance);
@ -2118,6 +2130,9 @@ bool ogs_sbi_discovery_param_is_matched(
if (NF_INSTANCE_EXCLUDED_FROM_DISCOVERY(nf_instance)) if (NF_INSTANCE_EXCLUDED_FROM_DISCOVERY(nf_instance))
return false; return false;
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered))
return false;
if (nf_instance->nf_type != target_nf_type) if (nf_instance->nf_type != target_nf_type)
return false; return false;
@ -2187,10 +2202,10 @@ void ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance)
client = nf_instance_find_client(nf_instance); client = nf_instance_find_client(nf_instance);
ogs_assert(client); ogs_assert(client);
ogs_debug("[%s] NFInstance associated [%s]", ogs_debug("[%s] NFInstance associated [%s:%d]",
nf_instance->nf_type ? nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL", OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id); nf_instance->id, nf_instance->reference_count);
OGS_SBI_SETUP_CLIENT(nf_instance, client); OGS_SBI_SETUP_CLIENT(nf_instance, client);
@ -2245,15 +2260,30 @@ ogs_sbi_client_t *ogs_sbi_client_find_by_service_type(
return nf_service->client; return nf_service->client;
} }
return NULL; return nf_instance->client;
} }
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object) void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
{ {
int i;
ogs_assert(sbi_object); ogs_assert(sbi_object);
if (ogs_list_count(&sbi_object->xact_list)) if (ogs_list_count(&sbi_object->xact_list))
ogs_error("SBI running [%d]", ogs_list_count(&sbi_object->xact_list)); ogs_error("SBI running [%d]", ogs_list_count(&sbi_object->xact_list));
for (i = 0; i < OGS_SBI_MAX_NUM_OF_SERVICE_TYPE; i++) {
ogs_sbi_nf_instance_t *nf_instance =
sbi_object->service_type_array[i].nf_instance;
if (nf_instance)
ogs_sbi_nf_instance_remove(nf_instance);
}
for (i = 0; i < OGS_SBI_MAX_NUM_OF_NF_TYPE; i++) {
ogs_sbi_nf_instance_t *nf_instance =
sbi_object->nf_type_array[i].nf_instance;
if (nf_instance)
ogs_sbi_nf_instance_remove(nf_instance);
}
} }
ogs_sbi_xact_t *ogs_sbi_xact_add( ogs_sbi_xact_t *ogs_sbi_xact_add(
@ -2463,26 +2493,12 @@ ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_add(void)
return subscription_data; return subscription_data;
} }
void ogs_sbi_subscription_data_set_resource_uri(
ogs_sbi_subscription_data_t *subscription_data, char *resource_uri)
{
ogs_assert(subscription_data);
ogs_assert(resource_uri);
if (subscription_data->resource_uri)
ogs_free(subscription_data->resource_uri);
subscription_data->resource_uri = ogs_strdup(resource_uri);
ogs_assert(subscription_data->resource_uri);
}
void ogs_sbi_subscription_data_set_id( void ogs_sbi_subscription_data_set_id(
ogs_sbi_subscription_data_t *subscription_data, char *id) ogs_sbi_subscription_data_t *subscription_data, char *id)
{ {
ogs_assert(subscription_data); ogs_assert(subscription_data);
ogs_assert(id); ogs_assert(id);
if (subscription_data->id)
ogs_free(subscription_data->id);
subscription_data->id = ogs_strdup(id); subscription_data->id = ogs_strdup(id);
ogs_assert(subscription_data->id); ogs_assert(subscription_data->id);
} }
@ -2500,9 +2516,6 @@ void ogs_sbi_subscription_data_remove(
if (subscription_data->notification_uri) if (subscription_data->notification_uri)
ogs_free(subscription_data->notification_uri); ogs_free(subscription_data->notification_uri);
if (subscription_data->resource_uri)
ogs_free(subscription_data->resource_uri);
if (subscription_data->req_nf_instance_id) if (subscription_data->req_nf_instance_id)
ogs_free(subscription_data->req_nf_instance_id); ogs_free(subscription_data->req_nf_instance_id);

View File

@ -175,6 +175,7 @@ typedef struct ogs_sbi_nf_instance_s {
#define NF_INSTANCE_CLIENT(__nFInstance) \ #define NF_INSTANCE_CLIENT(__nFInstance) \
((__nFInstance) ? ((__nFInstance)->client) : NULL) ((__nFInstance) ? ((__nFInstance)->client) : NULL)
void *client; /* only used in CLIENT */ void *client; /* only used in CLIENT */
unsigned int reference_count; /* reference count for memory free */
} ogs_sbi_nf_instance_t; } ogs_sbi_nf_instance_t;
typedef enum { typedef enum {
@ -193,16 +194,6 @@ typedef struct ogs_sbi_object_s {
struct { struct {
ogs_sbi_nf_instance_t *nf_instance; ogs_sbi_nf_instance_t *nf_instance;
/*
* Search.Result stored in nf_instance->time.validity_duration;
*
* validity_timeout = nf_instance->validity->timeout =
* ogs_get_monotonic_time() + nf_instance->time.validity_duration;
*
* if no validityPeriod in SearchResult, validity_timeout is 0.
*/
ogs_time_t validity_timeout;
} nf_type_array[OGS_SBI_MAX_NUM_OF_NF_TYPE], } nf_type_array[OGS_SBI_MAX_NUM_OF_NF_TYPE],
service_type_array[OGS_SBI_MAX_NUM_OF_SERVICE_TYPE]; service_type_array[OGS_SBI_MAX_NUM_OF_SERVICE_TYPE];
@ -295,7 +286,6 @@ typedef struct ogs_sbi_subscription_data_s {
OpenAPI_nf_type_e req_nf_type; /* reqNfType */ OpenAPI_nf_type_e req_nf_type; /* reqNfType */
OpenAPI_nf_status_e nf_status; OpenAPI_nf_status_e nf_status;
char *notification_uri; char *notification_uri;
char *resource_uri;
struct { struct {
OpenAPI_nf_type_e nf_type; /* nfType */ OpenAPI_nf_type_e nf_type; /* nfType */
@ -305,7 +295,7 @@ typedef struct ogs_sbi_subscription_data_s {
uint64_t requester_features; uint64_t requester_features;
uint64_t nrf_supported_features; uint64_t nrf_supported_features;
void *client; void *client; /* only used in SERVER */
} ogs_sbi_subscription_data_t; } ogs_sbi_subscription_data_t;
typedef struct ogs_sbi_smf_info_s { typedef struct ogs_sbi_smf_info_s {
@ -471,47 +461,18 @@ int ogs_sbi_default_client_port(OpenAPI_uri_scheme_e scheme);
#define OGS_SBI_SETUP_NF_INSTANCE(__cTX, __nFInstance) \ #define OGS_SBI_SETUP_NF_INSTANCE(__cTX, __nFInstance) \
do { \ do { \
ogs_assert(__nFInstance); \ ogs_assert(__nFInstance); \
ogs_assert((__nFInstance)->id); \
ogs_assert((__nFInstance)->t_validity); \
\ \
if ((__cTX).nf_instance) { \ if ((__cTX).nf_instance) { \
ogs_warn("[%s] NF Instance updated [type:%s validity:%ds]", \ ogs_warn("NF Instance [%s] updated [%s]", \
((__cTX).nf_instance)->id, \ OpenAPI_nf_type_ToString((__nFInstance)->nf_type), \
OpenAPI_nf_type_ToString(((__cTX).nf_instance)->nf_type), \ (__nFInstance)->id); \
((__cTX).nf_instance)->time.validity_duration); \ ogs_sbi_nf_instance_remove((__cTX).nf_instance); \
} \ } \
\ \
((__cTX).nf_instance) = __nFInstance; \ OGS_OBJECT_REF(__nFInstance); \
if ((__nFInstance)->time.validity_duration) { \ ((__cTX).nf_instance) = (__nFInstance); \
((__cTX).validity_timeout) = (__nFInstance)->t_validity->timeout; \
} else { \
((__cTX).validity_timeout) = 0; \
} \
ogs_info("[%s] NF Instance setup [type:%s validity:%ds]", \
(__nFInstance)->id, \
OpenAPI_nf_type_ToString((__nFInstance)->nf_type), \
(__nFInstance)->time.validity_duration); \
} while(0) } while(0)
/*
* Search.Result stored in nf_instance->time.validity_duration;
*
* validity_timeout = nf_instance->validity->timeout =
* ogs_get_monotonic_time() + nf_instance->time.validity_duration;
*
* if no validityPeriod in SearchResult, validity_timeout is 0.
*/
#define OGS_SBI_GET_NF_INSTANCE(__cTX) \
((__cTX).validity_timeout == 0 || \
(__cTX).validity_timeout > ogs_get_monotonic_time() ? \
((__cTX).nf_instance) : NULL)
#define OGS_SBI_NF_INSTANCE_VALID(__nFInstance) \
(((__nFInstance) && ((__nFInstance)->t_validity) && \
((__nFInstance)->time.validity_duration == 0 || \
(__nFInstance)->t_validity->timeout > ogs_get_monotonic_time())) ? \
true : false)
bool ogs_sbi_discovery_param_is_matched( bool ogs_sbi_discovery_param_is_matched(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_nf_instance_t *nf_instance,
OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e target_nf_type,
@ -554,8 +515,6 @@ void ogs_sbi_subscription_spec_remove(
void ogs_sbi_subscription_spec_remove_all(void); void ogs_sbi_subscription_spec_remove_all(void);
ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_add(void); ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_add(void);
void ogs_sbi_subscription_data_set_resource_uri(
ogs_sbi_subscription_data_t *subscription_data, char *resource_uri);
void ogs_sbi_subscription_data_set_id( void ogs_sbi_subscription_data_set_id(
ogs_sbi_subscription_data_t *subscription_data, char *id); ogs_sbi_subscription_data_t *subscription_data, char *id);
void ogs_sbi_subscription_data_remove( void ogs_sbi_subscription_data_remove(

View File

@ -32,6 +32,19 @@ void ogs_sbi_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance)
ogs_sbi_nf_state_initial, ogs_sbi_nf_state_final, &e); ogs_sbi_nf_state_initial, ogs_sbi_nf_state_final, &e);
} }
void ogs_sbi_nf_fsm_tran(ogs_sbi_nf_instance_t *nf_instance, void *state)
{
ogs_event_t e;
ogs_assert(nf_instance);
ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
memset(&e, 0, sizeof(e));
e.sbi.data = nf_instance;
ogs_fsm_tran(&nf_instance->sm, state, &e);
}
void ogs_sbi_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance) void ogs_sbi_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance)
{ {
ogs_event_t e; ogs_event_t e;
@ -294,7 +307,7 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
break; break;
case OGS_TIMER_NF_INSTANCE_NO_HEARTBEAT: case OGS_TIMER_NF_INSTANCE_NO_HEARTBEAT:
ogs_error("[%s] No heartbeat [type:%s]", ogs_error("[%s:%s] No heartbeat",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance), NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
OpenAPI_nf_type_ToString( OpenAPI_nf_type_ToString(
NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance))); NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance)));
@ -305,24 +318,22 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
ogs_assert(!NF_INSTANCE_TYPE_IS_NRF(nf_instance)); ogs_assert(!NF_INSTANCE_TYPE_IS_NRF(nf_instance));
ogs_assert(nf_instance->id); ogs_assert(nf_instance->id);
ogs_info("[%s] NF expired [type:%s]", ogs_info("[%s] NF expired", nf_instance->id);
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_de_registered); OGS_FSM_TRAN(s, &ogs_sbi_nf_state_de_registered);
break; break;
default: default:
ogs_error("[%s] Unknown timer [type:%s timer:%s:%d]", ogs_error("[%s:%s] Unknown timer[%s:%d]",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type), OpenAPI_nf_type_ToString(nf_instance->nf_type),
nf_instance->id ? nf_instance->id : "Undefined",
ogs_timer_get_name(e->timer_id), e->timer_id); ogs_timer_get_name(e->timer_id), e->timer_id);
} }
break; break;
default: default:
ogs_error("[%s] Unknown event [type:%s event:%s]", ogs_error("[%s:%s] Unknown event %s",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type), OpenAPI_nf_type_ToString(nf_instance->nf_type),
nf_instance->id ? nf_instance->id : "Undefined",
ogs_event_get_name(e)); ogs_event_get_name(e));
break; break;
} }
@ -342,20 +353,19 @@ void ogs_sbi_nf_state_de_registered(ogs_fsm_t *s, ogs_event_t *e)
switch (e->id) { switch (e->id) {
case OGS_FSM_ENTRY_SIG: case OGS_FSM_ENTRY_SIG:
ogs_info("[%s] NF de-registered [type:%s]", if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) {
nf_instance->id, ogs_info("[%s] NF de-registered",
OpenAPI_nf_type_ToString(nf_instance->nf_type)); NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
ogs_sbi_nf_fsm_fini(nf_instance); }
ogs_sbi_nf_instance_remove(nf_instance);
break; break;
case OGS_FSM_EXIT_SIG: case OGS_FSM_EXIT_SIG:
break; break;
default: default:
ogs_error("[%s] Unknown event [type:%s event:%s]", ogs_error("[%s:%s] Unknown event %s",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type), OpenAPI_nf_type_ToString(nf_instance->nf_type),
nf_instance->id ? nf_instance->id : "Undefined",
ogs_event_get_name(e)); ogs_event_get_name(e));
break; break;
} }
@ -399,9 +409,9 @@ void ogs_sbi_nf_state_exception(ogs_fsm_t *s, ogs_event_t *e)
break; break;
default: default:
ogs_error("[%s] Unknown timer[type:%s timer:%s:%d]", ogs_error("[%s:%s] Unknown timer[%s:%d]",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type), OpenAPI_nf_type_ToString(nf_instance->nf_type),
nf_instance->id ? nf_instance->id : "Undefined",
ogs_timer_get_name(e->timer_id), e->timer_id); ogs_timer_get_name(e->timer_id), e->timer_id);
} }
break; break;
@ -427,9 +437,9 @@ void ogs_sbi_nf_state_exception(ogs_fsm_t *s, ogs_event_t *e)
break; break;
default: default:
ogs_error("[%s] Unknown event [type:%s event:%s]", ogs_error("[%s:%s] Unknown event %s",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type), OpenAPI_nf_type_ToString(nf_instance->nf_type),
nf_instance->id ? nf_instance->id : "Undefined",
ogs_event_get_name(e)); ogs_event_get_name(e));
break; break;
} }

View File

@ -29,6 +29,7 @@ extern "C" {
#endif #endif
void ogs_sbi_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance); void ogs_sbi_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nf_fsm_tran(ogs_sbi_nf_instance_t *nf_instance, void *state);
void ogs_sbi_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance); void ogs_sbi_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nf_state_initial(ogs_fsm_t *s, ogs_event_t *e); void ogs_sbi_nf_state_initial(ogs_fsm_t *s, ogs_event_t *e);

View File

@ -1712,7 +1712,11 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_update(
memset(&message, 0, sizeof(message)); memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_PATCH; message.h.method = (char *)OGS_SBI_HTTP_METHOD_PATCH;
message.h.uri = subscription_data->resource_uri; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
message.h.api.version = (char *)OGS_SBI_API_V1;
message.h.resource.component[0] =
(char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS;
message.h.resource.component[1] = subscription_data->id;
message.http.content_type = (char *)OGS_SBI_CONTENT_PATCH_TYPE; message.http.content_type = (char *)OGS_SBI_CONTENT_PATCH_TYPE;
@ -1767,7 +1771,11 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
memset(&message, 0, sizeof(message)); memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE; message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE;
message.h.uri = subscription_data->resource_uri; message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
message.h.api.version = (char *)OGS_SBI_API_V1;
message.h.resource.component[0] =
(char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS;
message.h.resource.component[1] = subscription_data->id;
message.http.custom.callback = message.http.custom.callback =
(char *)OGS_SBI_CALLBACK_NNRF_NFMANAGEMENT_NF_STATUS_NOTIFY; (char *)OGS_SBI_CALLBACK_NNRF_NFMANAGEMENT_NF_STATUS_NOTIFY;

View File

@ -54,15 +54,6 @@ void ogs_nnrf_nfm_handle_nf_register(
OpenAPI_list_for_each(NFProfile->plmn_list, node) { OpenAPI_list_for_each(NFProfile->plmn_list, node) {
OpenAPI_plmn_id_t *PlmnId = node->data; OpenAPI_plmn_id_t *PlmnId = node->data;
if (PlmnId) { if (PlmnId) {
if (ogs_local_conf()->num_of_serving_plmn_id >=
OGS_ARRAY_SIZE(ogs_local_conf()->serving_plmn_id)) {
ogs_error("OVERFLOW NFProfile->plmn_list [%d:%d:%d]",
ogs_local_conf()->num_of_serving_plmn_id,
OGS_MAX_NUM_OF_PLMN,
(int)OGS_ARRAY_SIZE(
ogs_local_conf()->serving_plmn_id));
break;
}
ogs_sbi_parse_plmn_id( ogs_sbi_parse_plmn_id(
&ogs_local_conf()->serving_plmn_id[ &ogs_local_conf()->serving_plmn_id[
ogs_local_conf()->num_of_serving_plmn_id], PlmnId); ogs_local_conf()->num_of_serving_plmn_id], PlmnId);
@ -105,13 +96,6 @@ void ogs_nnrf_nfm_handle_nf_profile(
OpenAPI_list_for_each(NFProfile->plmn_list, node) { OpenAPI_list_for_each(NFProfile->plmn_list, node) {
OpenAPI_plmn_id_t *PlmnId = node->data; OpenAPI_plmn_id_t *PlmnId = node->data;
if (PlmnId) { if (PlmnId) {
if (nf_instance->num_of_plmn_id >=
OGS_ARRAY_SIZE(nf_instance->plmn_id)) {
ogs_error("OVERFLOW NFProfile->plmn_list [%d:%d:%d]",
nf_instance->num_of_plmn_id, OGS_MAX_NUM_OF_PLMN,
(int)OGS_ARRAY_SIZE(nf_instance->plmn_id));
break;
}
ogs_sbi_parse_plmn_id( ogs_sbi_parse_plmn_id(
&nf_instance->plmn_id[nf_instance->num_of_plmn_id], PlmnId); &nf_instance->plmn_id[nf_instance->num_of_plmn_id], PlmnId);
nf_instance->num_of_plmn_id++; nf_instance->num_of_plmn_id++;
@ -483,12 +467,8 @@ static void handle_smf_info(
TaiRangeItem = node->data; TaiRangeItem = node->data;
if (TaiRangeItem && TaiRangeItem->plmn_id && if (TaiRangeItem && TaiRangeItem->plmn_id &&
TaiRangeItem->tac_range_list) { TaiRangeItem->tac_range_list) {
ogs_assert(nf_info->smf.num_of_nr_tai_range <
if (nf_info->smf.num_of_nr_tai_range >= OGS_MAX_NUM_OF_TAI) { OGS_MAX_NUM_OF_TAI);
ogs_error("OVERFLOW TaiRangeItem [%d:%d]",
nf_info->smf.num_of_nr_tai_range, OGS_MAX_NUM_OF_TAI);
break;
}
ogs_sbi_parse_plmn_id( ogs_sbi_parse_plmn_id(
&nf_info->smf.nr_tai_range &nf_info->smf.nr_tai_range
@ -729,13 +709,7 @@ static void handle_amf_info(
TaiItem = node->data; TaiItem = node->data;
if (TaiItem && TaiItem->plmn_id && TaiItem->tac) { if (TaiItem && TaiItem->plmn_id && TaiItem->tac) {
ogs_5gs_tai_t *nr_tai = NULL; ogs_5gs_tai_t *nr_tai = NULL;
ogs_assert(nf_info->amf.num_of_nr_tai < OGS_MAX_NUM_OF_TAI);
if (nf_info->amf.num_of_nr_tai >= OGS_MAX_NUM_OF_TAI) {
ogs_error("OVERFLOW TaiItem [%d:%d]",
nf_info->amf.num_of_nr_tai, OGS_MAX_NUM_OF_TAI);
break;
}
nr_tai = &nf_info->amf.nr_tai[nf_info->amf.num_of_nr_tai]; nr_tai = &nf_info->amf.nr_tai[nf_info->amf.num_of_nr_tai];
ogs_assert(nr_tai); ogs_assert(nr_tai);
ogs_sbi_parse_plmn_id(&nr_tai->plmn_id, TaiItem->plmn_id); ogs_sbi_parse_plmn_id(&nr_tai->plmn_id, TaiItem->plmn_id);
@ -752,12 +726,6 @@ static void handle_amf_info(
ogs_assert(nf_info->amf.num_of_nr_tai_range < ogs_assert(nf_info->amf.num_of_nr_tai_range <
OGS_MAX_NUM_OF_TAI); OGS_MAX_NUM_OF_TAI);
if (nf_info->amf.num_of_nr_tai_range >= OGS_MAX_NUM_OF_TAI) {
ogs_error("OVERFLOW TaiRangeItem [%d:%d]",
nf_info->amf.num_of_nr_tai_range, OGS_MAX_NUM_OF_TAI);
break;
}
ogs_sbi_parse_plmn_id( ogs_sbi_parse_plmn_id(
&nf_info->amf.nr_tai_range &nf_info->amf.nr_tai_range
[nf_info->amf.num_of_nr_tai_range].plmn_id, [nf_info->amf.num_of_nr_tai_range].plmn_id,
@ -856,17 +824,6 @@ void ogs_nnrf_nfm_handle_nf_status_subscribe(
{ {
OpenAPI_subscription_data_t *SubscriptionData = NULL; OpenAPI_subscription_data_t *SubscriptionData = NULL;
int rv;
ogs_sbi_message_t message;
ogs_sbi_header_t header;
bool rc;
ogs_sbi_client_t *client = NULL;
OpenAPI_uri_scheme_e scheme = OpenAPI_uri_scheme_NULL;
char *fqdn = NULL;
uint16_t fqdn_port = 0;
ogs_sockaddr_t *addr = NULL, *addr6 = NULL;
ogs_assert(recvmsg); ogs_assert(recvmsg);
ogs_assert(subscription_data); ogs_assert(subscription_data);
@ -876,62 +833,44 @@ void ogs_nnrf_nfm_handle_nf_status_subscribe(
return; return;
} }
if (!recvmsg->http.location) { if (recvmsg->http.location) {
ogs_error("No http.location"); int rv;
return; ogs_sbi_message_t message;
} ogs_sbi_header_t header;
memset(&header, 0, sizeof(header)); memset(&header, 0, sizeof(header));
header.uri = recvmsg->http.location; header.uri = recvmsg->http.location;
rv = ogs_sbi_parse_header(&message, &header);
if (rv != OGS_OK) {
ogs_error("Cannot parse http.location [%s]",
recvmsg->http.location);
return;
}
if (!message.h.resource.component[1]) {
ogs_error("No Subscription ID [%s]", recvmsg->http.location);
ogs_sbi_header_free(&header);
return;
}
rc = ogs_sbi_getaddr_from_uri(
&scheme, &fqdn, &fqdn_port, &addr, &addr6, header.uri);
if (rc == false || scheme == OpenAPI_uri_scheme_NULL) {
ogs_error("Invalid URI [%s]", header.uri);
ogs_sbi_header_free(&header);
return;
}
client = ogs_sbi_client_find(scheme, fqdn, fqdn_port, addr, addr6);
if (!client) {
ogs_debug("%s: ogs_sbi_client_add()", OGS_FUNC);
client = ogs_sbi_client_add(scheme, fqdn, fqdn_port, addr, addr6);
if (!client) {
ogs_error("%s: ogs_sbi_client_add() failed", OGS_FUNC);
ogs_sbi_header_free(&header);
ogs_free(fqdn);
ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6);
rv = ogs_sbi_parse_header(&message, &header);
if (rv != OGS_OK) {
ogs_error("Cannot parse http.location [%s]",
recvmsg->http.location);
return; return;
} }
if (!message.h.resource.component[1]) {
ogs_error("No Subscription ID [%s]", recvmsg->http.location);
ogs_sbi_header_free(&header);
return;
}
ogs_sbi_subscription_data_set_id(
subscription_data, message.h.resource.component[1]);
ogs_sbi_header_free(&header);
} else if (SubscriptionData->subscription_id) {
/*
* For compatibility with v2.5.x and lower versions
*
* Deprecated : It will be removed soon.
*/
ogs_sbi_subscription_data_set_id(
subscription_data, SubscriptionData->subscription_id);
} else {
ogs_error("No Subscription ID");
return;
} }
OGS_SBI_SETUP_CLIENT(subscription_data, client);
ogs_free(fqdn);
ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6);
ogs_sbi_subscription_data_set_resource_uri(
subscription_data, header.uri);
ogs_sbi_subscription_data_set_id(
subscription_data, message.h.resource.component[1]);
ogs_sbi_header_free(&header);
/* SBI Features */ /* SBI Features */
if (SubscriptionData->nrf_supported_features) { if (SubscriptionData->nrf_supported_features) {
@ -1087,23 +1026,24 @@ bool ogs_nnrf_nfm_handle_nf_status_notify(
nf_instance, message.h.resource.component[1]); nf_instance, message.h.resource.component[1]);
ogs_sbi_nf_fsm_init(nf_instance); ogs_sbi_nf_fsm_init(nf_instance);
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id); ogs_info("(NRF-notify) NF registered [%s:%d]",
nf_instance->id, nf_instance->reference_count);
} else { } else {
ogs_warn("[%s] (NRF-notify) NF has already been added [type:%s]", ogs_warn("[%s] (NRF-notify) NF has already been added [%s:%d]",
nf_instance->id, nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type)); OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered)) { nf_instance->id, nf_instance->reference_count);
ogs_error("[%s] (NRF-notify) NF invalid state [type:%s]",
nf_instance->id, ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
OpenAPI_nf_type_ToString(nf_instance->nf_type)); ogs_sbi_nf_fsm_tran(nf_instance, ogs_sbi_nf_state_registered);
}
} }
ogs_nnrf_nfm_handle_nf_profile(nf_instance, NFProfile); ogs_nnrf_nfm_handle_nf_profile(nf_instance, NFProfile);
ogs_info("[%s] (NRF-notify) NF Profile updated [type:%s]", ogs_info("[%s] (NRF-notify) NF Profile updated [%s:%d]",
nf_instance->id, nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type)); OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
ogs_sbi_client_associate(nf_instance); ogs_sbi_client_associate(nf_instance);
@ -1119,11 +1059,27 @@ bool ogs_nnrf_nfm_handle_nf_status_notify(
OpenAPI_notification_event_type_NF_DEREGISTERED) { OpenAPI_notification_event_type_NF_DEREGISTERED) {
nf_instance = ogs_sbi_nf_instance_find(message.h.resource.component[1]); nf_instance = ogs_sbi_nf_instance_find(message.h.resource.component[1]);
if (nf_instance) { if (nf_instance) {
ogs_info("[%s] (NRF-notify) NF_DEREGISTERED event [type:%s]", if (OGS_OBJECT_IS_REF(nf_instance)) {
nf_instance->id, /* There are references to other contexts. */
OpenAPI_nf_type_ToString(nf_instance->nf_type)); ogs_warn("[%s] (NRF-notify) NF was referenced "
ogs_sbi_nf_fsm_fini(nf_instance); "in other contexts [%s:%d]",
ogs_sbi_nf_instance_remove(nf_instance); nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) :
"NULL",
nf_instance->id, nf_instance->reference_count);
ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
ogs_sbi_nf_fsm_tran(
nf_instance, ogs_sbi_nf_state_de_registered);
} else {
ogs_info("[%s] (NRF-notify) NF_DEREGISTERED event [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) :
"NULL",
nf_instance->id, nf_instance->reference_count);
ogs_sbi_nf_fsm_fini((nf_instance));
ogs_sbi_nf_instance_remove(nf_instance);
}
} else { } else {
ogs_warn("[%s] (NRF-notify) Not found", ogs_warn("[%s] (NRF-notify) Not found",
message.h.resource.component[1]); message.h.resource.component[1]);
@ -1199,18 +1155,18 @@ void ogs_nnrf_disc_handle_nf_discover_search_result(
ogs_sbi_nf_instance_set_id(nf_instance, NFProfile->nf_instance_id); ogs_sbi_nf_instance_set_id(nf_instance, NFProfile->nf_instance_id);
ogs_sbi_nf_fsm_init(nf_instance); ogs_sbi_nf_fsm_init(nf_instance);
ogs_info("[%s] (NRF-discover) NF registered [type:%s]", ogs_info("[%s] (NRF-discover) NF registered [%s:%d]",
nf_instance->id, nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type)); OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
} else { } else {
ogs_warn("[%s] (NRF-discover) NF has already been added [type:%s]", ogs_warn("[%s] (NRF-discover) NF has already been added [%s:%d]",
nf_instance->id, nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type)); OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered)) { nf_instance->id, nf_instance->reference_count);
ogs_error("[%s] (NRF-notify) NF invalid state [type:%s]",
nf_instance->id, ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
OpenAPI_nf_type_ToString(nf_instance->nf_type)); ogs_sbi_nf_fsm_tran(nf_instance, ogs_sbi_nf_state_registered);
}
} }
if (NF_INSTANCE_ID_IS_OTHERS(nf_instance->id)) { if (NF_INSTANCE_ID_IS_OTHERS(nf_instance->id)) {
@ -1237,18 +1193,15 @@ void ogs_nnrf_disc_handle_nf_discover_search_result(
ogs_time_from_sec(nf_instance->time.validity_duration)); ogs_time_from_sec(nf_instance->time.validity_duration));
} else } else
ogs_warn("[%s] NF Instance validity-time should not 0 " ogs_warn("[%s] NF Instance validity-time should not 0 [%s:%d]",
"[type:%s]",
nf_instance->id,
nf_instance->nf_type ? nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
"NULL"); nf_instance->id, nf_instance->reference_count);
ogs_info("[%s] (NF-discover) NF Profile updated " ogs_info("[%s] (NF-discover) NF Profile updated [%s:%d]",
"[type:%s validity:%ds]", nf_instance->nf_type ?
nf_instance->id, OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
OpenAPI_nf_type_ToString(nf_instance->nf_type), nf_instance->id, nf_instance->reference_count);
nf_instance->time.validity_duration);
} }
} }
} }

View File

@ -208,19 +208,18 @@ static int client_discover_cb(
ogs_sbi_nf_fsm_init(nf_instance); ogs_sbi_nf_fsm_init(nf_instance);
ogs_info("[%s] (SCP-discover) NF registered [%s]", ogs_info("[%s] (SCP-discover) NF registered [%s:%d]",
nf_instance->nf_type ? nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL", OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id); nf_instance->id, nf_instance->reference_count);
} else { } else {
ogs_warn("[%s] (SCP-discover) NF has already been added [%s]", ogs_warn("[%s] (SCP-discover) NF has already been added [%s:%d]",
OpenAPI_nf_type_ToString(nf_instance->nf_type), nf_instance->nf_type ?
nf_instance->id); OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered)) { nf_instance->id, nf_instance->reference_count);
ogs_error("[%s] (SCP-discover) NF invalid state [%s]",
OpenAPI_nf_type_ToString(nf_instance->nf_type), ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
nf_instance->id); ogs_sbi_nf_fsm_tran(nf_instance, ogs_sbi_nf_state_registered);
}
} }
OGS_SBI_SETUP_NF_INSTANCE( OGS_SBI_SETUP_NF_INSTANCE(
@ -282,8 +281,7 @@ int ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
} }
/* Target NF-Instance */ /* Target NF-Instance */
nf_instance = OGS_SBI_GET_NF_INSTANCE( nf_instance = sbi_object->service_type_array[service_type].nf_instance;
sbi_object->service_type_array[service_type]);
if (!nf_instance) { if (!nf_instance) {
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param( nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, requester_nf_type, discovery_option); target_nf_type, requester_nf_type, discovery_option);
@ -315,11 +313,6 @@ int ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
ogs_free(fqdn); ogs_free(fqdn);
ogs_freeaddrinfo(addr); ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6); ogs_freeaddrinfo(addr6);
if (!client) {
ogs_fatal("No Client : [%s]", request->h.uri);
ogs_assert_if_reached();
}
} }
if (scp_client) { if (scp_client) {

View File

@ -46,6 +46,7 @@ if host_system == 'darwin'
libsctp_sources += files('ogs-usrsctp.c') libsctp_sources += files('ogs-usrsctp.c')
libsctp_conf.set('HAVE_USRSCTP', 1) libsctp_conf.set('HAVE_USRSCTP', 1)
else else
libsctp_conf.set('HAVE_NETINET_SCTP_H', 1)
sctp_dep = cc.find_library('sctp', required : false) sctp_dep = cc.find_library('sctp', required : false)
libsctp_sources += files('ogs-lksctp.c') libsctp_sources += files('ogs-lksctp.c')
endif endif

View File

@ -16,7 +16,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
project('open5gs', 'c', 'cpp', project('open5gs', 'c', 'cpp',
version : '2.7.1', version : '2.7.0',
license : 'AGPL-3.0-or-later', license : 'AGPL-3.0-or-later',
meson_version : '>= 0.43.0', meson_version : '>= 0.43.0',
default_options : [ default_options : [
@ -25,7 +25,7 @@ project('open5gs', 'c', 'cpp',
], ],
) )
libogslib_version = '2.7.1' libogslib_version = '2.7.0'
prefix = get_option('prefix') prefix = get_option('prefix')
bindir = join_paths(prefix, get_option('bindir')) bindir = join_paths(prefix, get_option('bindir'))
@ -127,7 +127,7 @@ subdir('src')
subdir('misc') subdir('misc')
# Don't build the tests unless we can run them (either natively or in an exe wrapper) # Don't build the tests unless we can run them (either natively or in an exe wrapper)
build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper()) build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
if build_tests if build_tests and get_option('mongodb')
subdir('tests') subdir('tests')
endif endif

View File

@ -1,2 +1,4 @@
option('fuzzing', type: 'boolean', value: false, description: 'Enable fuzzing tests') option('fuzzing', type: 'boolean', value: false, description: 'Enable fuzzing tests')
option('lib_fuzzing_engine', type : 'string', value : '', description : 'Path to the libFuzzer engine library') option('lib_fuzzing_engine', type : 'string', value : '', description : 'Path to the libFuzzer engine library')
option('metrics_impl', type : 'combo', choices : ['void', 'prometheus'], value : 'void', description : 'libogsmetrics implementation')
option('mongodb', type : 'boolean', value : 'false', description : 'build with mongo db support')

View File

@ -1676,17 +1676,13 @@ void amf_ue_remove(amf_ue_t *amf_ue)
/* Clear SubscribedInfo */ /* Clear SubscribedInfo */
amf_clear_subscribed_info(amf_ue); amf_clear_subscribed_info(amf_ue);
PCF_AM_POLICY_CLEAR(amf_ue); if (amf_ue->policy_association_id)
if (amf_ue->policy_association.client) ogs_free(amf_ue->policy_association_id);
ogs_sbi_client_remove(amf_ue->policy_association.client); if (amf_ue->data_change_subscription_id)
ogs_free(amf_ue->data_change_subscription_id);
UDM_SDM_CLEAR(amf_ue); if (amf_ue->confirmation_url_for_5g_aka)
if (amf_ue->data_change_subscription.client) ogs_free(amf_ue->confirmation_url_for_5g_aka);
ogs_sbi_client_remove(amf_ue->data_change_subscription.client);
CLEAR_5G_AKA_CONFIRMATION(amf_ue);
if (amf_ue->confirmation_for_5g_aka.client)
ogs_sbi_client_remove(amf_ue->confirmation_for_5g_aka.client);
/* Free UeRadioCapability */ /* Free UeRadioCapability */
OGS_ASN_CLEAR_DATA(&amf_ue->ueRadioCapability); OGS_ASN_CLEAR_DATA(&amf_ue->ueRadioCapability);
@ -2253,10 +2249,8 @@ void amf_sess_remove(amf_sess_t *sess)
ogs_list_count(&sess->sbi.xact_list)); ogs_list_count(&sess->sbi.xact_list));
ogs_sbi_object_free(&sess->sbi); ogs_sbi_object_free(&sess->sbi);
CLEAR_SESSION_CONTEXT(sess); if (sess->sm_context_ref)
ogs_free(sess->sm_context_ref);
if (sess->sm_context.client)
ogs_sbi_client_remove(sess->sm_context.client);
if (sess->payload_container) if (sess->payload_container)
ogs_pkbuf_free(sess->payload_container); ogs_pkbuf_free(sess->payload_container);

View File

@ -290,33 +290,13 @@ struct amf_ue_s {
/* PCF sends the RESPONSE /* PCF sends the RESPONSE
* of [POST] /npcf-am-polocy-control/v1/policies */ * of [POST] /npcf-am-polocy-control/v1/policies */
#define PCF_AM_POLICY_ASSOCIATED(__aMF) \ #define PCF_AM_POLICY_ASSOCIATED(__aMF) \
((__aMF) && ((__aMF)->policy_association.id)) ((__aMF) && ((__aMF)->policy_association_id))
#define PCF_AM_POLICY_CLEAR(__aMF) \ #define PCF_AM_POLICY_CLEAR(__aMF) \
do { \ OGS_MEM_CLEAR((__aMF)->policy_association_id);
ogs_assert((__aMF)); \ #define PCF_AM_POLICY_STORE(__aMF, __iD) \
if ((__aMF)->policy_association.resource_uri) \ OGS_STRING_DUP((__aMF)->policy_association_id, __iD);
ogs_free((__aMF)->policy_association.resource_uri); \ char *policy_association_id;
(__aMF)->policy_association.resource_uri = NULL; \
if ((__aMF)->policy_association.id) \
ogs_free((__aMF)->policy_association.id); \
(__aMF)->policy_association.id = NULL; \
} while(0)
#define PCF_AM_POLICY_STORE(__aMF, __rESOURCE_URI, __iD) \
do { \
ogs_assert((__aMF)); \
ogs_assert((__rESOURCE_URI)); \
ogs_assert((__iD)); \
PCF_AM_POLICY_CLEAR(__aMF); \
(__aMF)->policy_association.resource_uri = ogs_strdup(__rESOURCE_URI); \
ogs_assert((__aMF)->policy_association.resource_uri); \
(__aMF)->policy_association.id = ogs_strdup(__iD); \
ogs_assert((__aMF)->policy_association.id); \
} while(0)
struct {
char *resource_uri;
char *id;
ogs_sbi_client_t *client;
} policy_association;
/* 5GMM Capability */ /* 5GMM Capability */
struct { struct {
@ -342,27 +322,7 @@ struct amf_ue_s {
/* Security Context */ /* Security Context */
ogs_nas_ue_security_capability_t ue_security_capability; ogs_nas_ue_security_capability_t ue_security_capability;
ogs_nas_ue_network_capability_t ue_network_capability; ogs_nas_ue_network_capability_t ue_network_capability;
#define CHECK_5G_AKA_CONFIRMATION(__aMF) \ char *confirmation_url_for_5g_aka;
((__aMF) && ((__aMF)->confirmation_for_5g_aka.resource_uri))
#define STORE_5G_AKA_CONFIRMATION(__aMF, __rESOURCE_URI) \
do { \
ogs_assert((__aMF)); \
CLEAR_5G_AKA_CONFIRMATION(__aMF); \
(__aMF)->confirmation_for_5g_aka.resource_uri = \
ogs_strdup(__rESOURCE_URI); \
ogs_assert((__aMF)->confirmation_for_5g_aka.resource_uri); \
} while(0)
#define CLEAR_5G_AKA_CONFIRMATION(__aMF) \
do { \
ogs_assert((__aMF)); \
if ((__aMF)->confirmation_for_5g_aka.resource_uri) \
ogs_free((__aMF)->confirmation_for_5g_aka.resource_uri); \
(__aMF)->confirmation_for_5g_aka.resource_uri = NULL; \
} while(0)
struct {
char *resource_uri;
ogs_sbi_client_t *client;
} confirmation_for_5g_aka;
uint8_t rand[OGS_RAND_LEN]; uint8_t rand[OGS_RAND_LEN];
uint8_t autn[OGS_AUTN_LEN]; uint8_t autn[OGS_AUTN_LEN];
uint8_t xres_star[OGS_MAX_RES_LEN]; uint8_t xres_star[OGS_MAX_RES_LEN];
@ -508,34 +468,8 @@ struct amf_ue_s {
/* SubscriptionId of Subscription to Data Change Notification to UDM */ /* SubscriptionId of Subscription to Data Change Notification to UDM */
#define UDM_SDM_SUBSCRIBED(__aMF) \ #define UDM_SDM_SUBSCRIBED(__aMF) \
((__aMF) && ((__aMF)->data_change_subscription.id)) ((__aMF) && ((__aMF)->data_change_subscription_id))
#define UDM_SDM_CLEAR(__aMF) \ char *data_change_subscription_id;
do { \
ogs_assert((__aMF)); \
if ((__aMF)->data_change_subscription.resource_uri) \
ogs_free((__aMF)->data_change_subscription.resource_uri); \
(__aMF)->data_change_subscription.resource_uri = NULL; \
if ((__aMF)->data_change_subscription.id) \
ogs_free((__aMF)->data_change_subscription.id); \
(__aMF)->data_change_subscription.id = NULL; \
} while(0)
#define UDM_SDM_STORE(__aMF, __rESOURCE_URI, __iD) \
do { \
ogs_assert((__aMF)); \
ogs_assert((__rESOURCE_URI)); \
ogs_assert((__iD)); \
UDM_SDM_CLEAR(__aMF); \
(__aMF)->data_change_subscription.resource_uri = \
ogs_strdup(__rESOURCE_URI); \
ogs_assert((__aMF)->data_change_subscription.resource_uri); \
(__aMF)->data_change_subscription.id = ogs_strdup(__iD); \
ogs_assert((__aMF)->data_change_subscription.id); \
} while(0)
struct {
char *resource_uri;
char *id;
ogs_sbi_client_t *client;
} data_change_subscription;
struct { struct {
/* /*
@ -565,37 +499,18 @@ typedef struct amf_sess_s {
uint8_t pti; /* Procedure Trasaction Identity */ uint8_t pti; /* Procedure Trasaction Identity */
#define SESSION_CONTEXT_IN_SMF(__sESS) \ #define SESSION_CONTEXT_IN_SMF(__sESS) \
((__sESS) && (__sESS)->sm_context.ref) ((__sESS) && (__sESS)->sm_context_ref)
#define STORE_SESSION_CONTEXT(__sESS, __rESOURCE_URI, __rEF) \ #define CLEAR_SM_CONTEXT_REF(__sESS) \
do { \ do { \
ogs_assert(__sESS); \ ogs_assert(__sESS); \
ogs_assert(__rESOURCE_URI); \ ogs_assert((__sESS)->sm_context_ref); \
ogs_assert(__rEF); \ ogs_free((__sESS)->sm_context_ref); \
CLEAR_SESSION_CONTEXT(__sESS); \ (__sESS)->sm_context_ref = NULL; \
(__sESS)->sm_context.resource_uri = ogs_strdup(__rESOURCE_URI); \
ogs_assert((__sESS)->sm_context.resource_uri); \
(__sESS)->sm_context.ref = ogs_strdup(__rEF); \
ogs_assert((__sESS)->sm_context.ref); \
} while(0);
#define CLEAR_SESSION_CONTEXT(__sESS) \
do { \
ogs_assert(__sESS); \
if ((__sESS)->sm_context.ref) \
ogs_free((__sESS)->sm_context.ref); \
(__sESS)->sm_context.ref = NULL; \
if ((__sESS)->sm_context.resource_uri) \
ogs_free((__sESS)->sm_context.resource_uri); \
(__sESS)->sm_context.resource_uri = NULL; \
} while(0); } while(0);
/* SMF sends the RESPONSE /* SMF sends the RESPONSE
* of [POST] /nsmf-pdusession/v1/sm-contexts */ * of [POST] /nsmf-pdusession/v1/sm-contexts */
struct { char *sm_context_ref;
char *resource_uri;
char *ref;
ogs_sbi_client_t *client;
} sm_context;
bool pdu_session_release_complete_received; bool pdu_session_release_complete_received;
bool pdu_session_resource_release_response_received; bool pdu_session_resource_release_response_received;

View File

@ -1283,11 +1283,9 @@ int gmm_handle_ul_nas_transport(ran_ue_t *ran_ue, amf_ue_t *amf_ue,
sess->s_nssai.sd.v = selected_slice->s_nssai.sd.v; sess->s_nssai.sd.v = selected_slice->s_nssai.sd.v;
ogs_info("UE SUPI[%s] DNN[%s] S_NSSAI[SST:%d SD:0x%x] " ogs_info("UE SUPI[%s] DNN[%s] S_NSSAI[SST:%d SD:0x%x] "
"smContextRef[%s] smContextResourceURI[%s]", "smContextRef [%s]",
amf_ue->supi, sess->dnn, sess->s_nssai.sst, sess->s_nssai.sd.v, amf_ue->supi, sess->dnn, sess->s_nssai.sst, sess->s_nssai.sd.v,
sess->sm_context.ref ? sess->sm_context.ref : "NULL", sess->sm_context_ref ? sess->sm_context_ref : "NULL");
sess->sm_context.resource_uri ?
sess->sm_context.resource_uri : "NULL");
if (!SESSION_CONTEXT_IN_SMF(sess)) { if (!SESSION_CONTEXT_IN_SMF(sess)) {
ogs_sbi_nf_instance_t *nf_instance = NULL; ogs_sbi_nf_instance_t *nf_instance = NULL;
@ -1305,8 +1303,8 @@ int gmm_handle_ul_nas_transport(ran_ue_t *ran_ue, amf_ue_t *amf_ue,
ogs_sbi_discovery_option_set_tai( ogs_sbi_discovery_option_set_tai(
discovery_option, &amf_ue->nr_tai); discovery_option, &amf_ue->nr_tai);
nf_instance = OGS_SBI_GET_NF_INSTANCE( nf_instance = sess->sbi.
sess->sbi.service_type_array[service_type]); service_type_array[service_type].nf_instance;
if (!nf_instance) { if (!nf_instance) {
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_e requester_nf_type =
NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance); NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
@ -1317,8 +1315,8 @@ int gmm_handle_ul_nas_transport(ran_ue_t *ran_ue, amf_ue_t *amf_ue,
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION,
requester_nf_type, requester_nf_type,
discovery_option); discovery_option);
nf_instance = OGS_SBI_GET_NF_INSTANCE( nf_instance = sess->sbi.
sess->sbi.service_type_array[service_type]); service_type_array[service_type].nf_instance;
if (!nf_instance) if (!nf_instance)
ogs_info("No SMF Instance"); ogs_info("No SMF Instance");
@ -1437,7 +1435,7 @@ int gmm_handle_ul_nas_transport(ran_ue_t *ran_ue, amf_ue_t *amf_ue,
sess->pdu_session_release_complete_received = true; sess->pdu_session_release_complete_received = true;
if (sess->pdu_session_resource_release_response_received == if (sess->pdu_session_resource_release_response_received ==
true) true)
CLEAR_SESSION_CONTEXT(sess); CLEAR_SM_CONTEXT_REF(sess);
break; break;
default: default:
break; break;
@ -1678,7 +1676,7 @@ static void amf_namf_comm_decode_ue_session_context_list(
sess = amf_sess_add(amf_ue, PduSessionContext->pdu_session_id); sess = amf_sess_add(amf_ue, PduSessionContext->pdu_session_id);
ogs_assert(sess); ogs_assert(sess);
sess->sm_context.ref = PduSessionContext->sm_context_ref; sess->sm_context_ref = PduSessionContext->sm_context_ref;
if (PduSessionContext->s_nssai) { if (PduSessionContext->s_nssai) {
memset(&sess->s_nssai, 0, sizeof(sess->s_nssai)); memset(&sess->s_nssai, 0, sizeof(sess->s_nssai));

View File

@ -274,7 +274,9 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
ogs_warn("[%s] Ignore SBI message", amf_ue->suci); ogs_warn("[%s] Ignore SBI message", amf_ue->suci);
break; break;
CASE(OGS_SBI_HTTP_METHOD_DELETE) CASE(OGS_SBI_HTTP_METHOD_DELETE)
CLEAR_5G_AKA_CONFIRMATION(amf_ue); if (amf_ue->confirmation_url_for_5g_aka)
ogs_free(amf_ue->confirmation_url_for_5g_aka);
amf_ue->confirmation_url_for_5g_aka = NULL;
if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE || if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE ||
state == AMF_UE_INITIATED_DE_REGISTERED) { state == AMF_UE_INITIATED_DE_REGISTERED) {
@ -376,7 +378,10 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
*/ */
if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE || if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE ||
state == AMF_UE_INITIATED_DE_REGISTERED) { state == AMF_UE_INITIATED_DE_REGISTERED) {
UDM_SDM_CLEAR(amf_ue); if (amf_ue->data_change_subscription_id) {
ogs_free(amf_ue->data_change_subscription_id);
amf_ue->data_change_subscription_id = NULL;
}
r = amf_ue_sbi_discover_and_send( r = amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL, OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL,
@ -442,7 +447,7 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE || if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE ||
state == AMF_UE_INITIATED_DE_REGISTERED) { state == AMF_UE_INITIATED_DE_REGISTERED) {
if (CHECK_5G_AKA_CONFIRMATION(amf_ue)) { if (amf_ue->confirmation_url_for_5g_aka) {
r = amf_ue_sbi_discover_and_send( r = amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, OGS_SBI_SERVICE_TYPE_NAUSF_AUTH,
NULL, NULL,
@ -852,7 +857,9 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
ogs_warn("[%s] Ignore SBI message", amf_ue->suci); ogs_warn("[%s] Ignore SBI message", amf_ue->suci);
break; break;
CASE(OGS_SBI_HTTP_METHOD_DELETE) CASE(OGS_SBI_HTTP_METHOD_DELETE)
CLEAR_5G_AKA_CONFIRMATION(amf_ue); if (amf_ue->confirmation_url_for_5g_aka)
ogs_free(amf_ue->confirmation_url_for_5g_aka);
amf_ue->confirmation_url_for_5g_aka = NULL;
if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE || if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE ||
state == AMF_UE_INITIATED_DE_REGISTERED) { state == AMF_UE_INITIATED_DE_REGISTERED) {
@ -960,7 +967,10 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
AMF_NETWORK_INITIATED_IMPLICIT_DE_REGISTERED || AMF_NETWORK_INITIATED_IMPLICIT_DE_REGISTERED ||
state == state ==
AMF_NETWORK_INITIATED_EXPLICIT_DE_REGISTERED) { AMF_NETWORK_INITIATED_EXPLICIT_DE_REGISTERED) {
UDM_SDM_CLEAR(amf_ue); if (amf_ue->data_change_subscription_id) {
ogs_free(amf_ue->data_change_subscription_id);
amf_ue->data_change_subscription_id = NULL;
}
r = amf_ue_sbi_discover_and_send( r = amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL, OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL,
@ -1034,7 +1044,7 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
state == state ==
AMF_NETWORK_INITIATED_EXPLICIT_DE_REGISTERED) { AMF_NETWORK_INITIATED_EXPLICIT_DE_REGISTERED) {
if (amf_ue->confirmation_for_5g_aka.resource_uri) { if (amf_ue->confirmation_url_for_5g_aka) {
r = amf_ue_sbi_discover_and_send( r = amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, OGS_SBI_SERVICE_TYPE_NAUSF_AUTH,
NULL, NULL,

View File

@ -38,10 +38,6 @@ int amf_initialize(void)
ogs_sbi_context_init(OpenAPI_nf_type_AMF); ogs_sbi_context_init(OpenAPI_nf_type_AMF);
amf_context_init(); amf_context_init();
rv = ogs_log_config_domain(
ogs_app()->logger.domain, ogs_app()->logger.level);
if (rv != OGS_OK) return rv;
rv = ogs_sbi_context_parse_config(APP_NAME, "nrf", "scp"); rv = ogs_sbi_context_parse_config(APP_NAME, "nrf", "scp");
if (rv != OGS_OK) return rv; if (rv != OGS_OK) return rv;
@ -54,6 +50,10 @@ int amf_initialize(void)
rv = amf_context_nf_info(); rv = amf_context_nf_info();
if (rv != OGS_OK) return rv; if (rv != OGS_OK) return rv;
rv = ogs_log_config_domain(
ogs_app()->logger.domain, ogs_app()->logger.level);
if (rv != OGS_OK) return rv;
ogs_metrics_context_open(ogs_metrics_self()); ogs_metrics_context_open(ogs_metrics_self());
rv = amf_sbi_open(); rv = amf_sbi_open();

View File

@ -246,7 +246,7 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
amf_ue->supi, sess->psi, amf_ue->supi, sess->psi,
N1N2MessageTransferReqData-> N1N2MessageTransferReqData->
n1n2_failure_txf_notif_uri); n1n2_failure_txf_notif_uri);
return OGS_ERROR; return OGS_ERROR;;
} }
client = ogs_sbi_client_find( client = ogs_sbi_client_find(
@ -287,7 +287,7 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
header.resource.component[1] = amf_ue->supi; header.resource.component[1] = amf_ue->supi;
header.resource.component[2] = header.resource.component[2] =
(char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES; (char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES;
header.resource.component[3] = sess->sm_context.ref; header.resource.component[3] = sess->sm_context_ref;
sendmsg.http.location = ogs_sbi_server_uri(server, &header); sendmsg.http.location = ogs_sbi_server_uri(server, &header);
@ -349,12 +349,13 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
header.resource.component[1] = amf_ue->supi; header.resource.component[1] = amf_ue->supi;
header.resource.component[2] = header.resource.component[2] =
(char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES; (char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES;
header.resource.component[3] = sess->sm_context.ref; header.resource.component[3] = sess->sm_context_ref;
sendmsg.http.location = ogs_sbi_server_uri(server, &header); sendmsg.http.location = ogs_sbi_server_uri(server, &header);
/* Store Paging Info */ /* Store Paging Info */
AMF_SESS_STORE_PAGING_INFO(sess, sendmsg.http.location, NULL); AMF_SESS_STORE_PAGING_INFO(
sess, sendmsg.http.location, NULL);
/* Store 5GSM Message */ /* Store 5GSM Message */
AMF_SESS_STORE_5GSM_MESSAGE(sess, AMF_SESS_STORE_5GSM_MESSAGE(sess,
@ -423,12 +424,13 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
header.resource.component[1] = amf_ue->supi; header.resource.component[1] = amf_ue->supi;
header.resource.component[2] = header.resource.component[2] =
(char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES; (char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES;
header.resource.component[3] = sess->sm_context.ref; header.resource.component[3] = sess->sm_context_ref;
sendmsg.http.location = ogs_sbi_server_uri(server, &header); sendmsg.http.location = ogs_sbi_server_uri(server, &header);
/* Store Paging Info */ /* Store Paging Info */
AMF_SESS_STORE_PAGING_INFO(sess, sendmsg.http.location, NULL); AMF_SESS_STORE_PAGING_INFO(
sess, sendmsg.http.location, NULL);
/* Store 5GSM Message */ /* Store 5GSM Message */
AMF_SESS_STORE_5GSM_MESSAGE(sess, AMF_SESS_STORE_5GSM_MESSAGE(sess,
@ -1172,7 +1174,7 @@ static OpenAPI_list_t *amf_namf_comm_encode_ue_session_context_list(amf_ue_t *am
ogs_assert(sNSSAI); ogs_assert(sNSSAI);
PduSessionContext->pdu_session_id = sess->psi; PduSessionContext->pdu_session_id = sess->psi;
PduSessionContext->sm_context_ref = sess->sm_context.ref; PduSessionContext->sm_context_ref = sess->sm_context_ref;
sNSSAI->sst = sess->s_nssai.sst; sNSSAI->sst = sess->s_nssai.sst;
sNSSAI->sd = ogs_s_nssai_sd_to_string(sess->s_nssai.sd); sNSSAI->sd = ogs_s_nssai_sd_to_string(sess->s_nssai.sd);
@ -1333,8 +1335,6 @@ int amf_namf_comm_handle_ue_context_transfer_request(
OpenAPI_ue_context_transfer_rsp_data_t UeContextTransferRspData; OpenAPI_ue_context_transfer_rsp_data_t UeContextTransferRspData;
ogs_sbi_nf_instance_t *pcf_nf_instance = NULL;
char *ue_context_id = NULL; char *ue_context_id = NULL;
char *encoded_gmm_capability = NULL; char *encoded_gmm_capability = NULL;
int status = OGS_SBI_HTTP_STATUS_OK; int status = OGS_SBI_HTTP_STATUS_OK;
@ -1418,14 +1418,8 @@ int amf_namf_comm_handle_ue_context_transfer_request(
encoded_gmm_capability = amf_namf_comm_base64_encode_5gmm_capability(amf_ue); encoded_gmm_capability = amf_namf_comm_base64_encode_5gmm_capability(amf_ue);
UeContext._5g_mm_capability = encoded_gmm_capability; UeContext._5g_mm_capability = encoded_gmm_capability;
pcf_nf_instance = OGS_SBI_GET_NF_INSTANCE( UeContext.pcf_id = amf_ue->sbi.service_type_array[
amf_ue->sbi.service_type_array[ OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL].nf_instance->id;
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL]);
if (pcf_nf_instance) {
UeContext.pcf_id = pcf_nf_instance->id;
} else {
ogs_warn("No PCF NF Instnace");
}
/* TODO UeContext.pcfAmPolicyUri */ /* TODO UeContext.pcfAmPolicyUri */
/* TODO UeContext.pcfUePolicyUri */ /* TODO UeContext.pcfUePolicyUri */

View File

@ -87,11 +87,11 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate_delete(
ogs_sbi_request_t *request = NULL; ogs_sbi_request_t *request = NULL;
ogs_assert(amf_ue); ogs_assert(amf_ue);
ogs_assert(amf_ue->confirmation_for_5g_aka.resource_uri); ogs_assert(amf_ue->confirmation_url_for_5g_aka);
memset(&message, 0, sizeof(message)); memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE; message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE;
message.h.uri = amf_ue->confirmation_for_5g_aka.resource_uri; message.h.uri = amf_ue->confirmation_url_for_5g_aka;
request = ogs_sbi_build_request(&message); request = ogs_sbi_build_request(&message);
ogs_expect(request); ogs_expect(request);
@ -110,11 +110,11 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate_confirmation(
OpenAPI_confirmation_data_t *ConfirmationData = NULL; OpenAPI_confirmation_data_t *ConfirmationData = NULL;
ogs_assert(amf_ue); ogs_assert(amf_ue);
ogs_assert(amf_ue->confirmation_for_5g_aka.resource_uri); ogs_assert(amf_ue->confirmation_url_for_5g_aka);
memset(&message, 0, sizeof(message)); memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT; message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT;
message.h.uri = amf_ue->confirmation_for_5g_aka.resource_uri; message.h.uri = amf_ue->confirmation_url_for_5g_aka;
ConfirmationData = ogs_calloc(1, sizeof(*ConfirmationData)); ConfirmationData = ogs_calloc(1, sizeof(*ConfirmationData));
if (!ConfirmationData) { if (!ConfirmationData) {

View File

@ -30,21 +30,9 @@ int amf_nausf_auth_handle_authenticate(
OpenAPI_map_t *LinksValueScheme = NULL; OpenAPI_map_t *LinksValueScheme = NULL;
OpenAPI_lnode_t *node = NULL; OpenAPI_lnode_t *node = NULL;
bool rc;
ogs_sbi_client_t *client = NULL;
OpenAPI_uri_scheme_e scheme = OpenAPI_uri_scheme_NULL;
char *fqdn = NULL;
uint16_t fqdn_port = 0;
ogs_sockaddr_t *addr = NULL, *addr6 = NULL;
ogs_assert(amf_ue); ogs_assert(amf_ue);
ogs_assert(message); ogs_assert(message);
if (!message->http.location) {
ogs_error("[%s] No http.location", amf_ue->suci);
return OGS_ERROR;
}
UeAuthenticationCtx = message->UeAuthenticationCtx; UeAuthenticationCtx = message->UeAuthenticationCtx;
if (!UeAuthenticationCtx) { if (!UeAuthenticationCtx) {
ogs_error("[%s] No UeAuthenticationCtx", amf_ue->suci); ogs_error("[%s] No UeAuthenticationCtx", amf_ue->suci);
@ -104,36 +92,11 @@ int amf_nausf_auth_handle_authenticate(
return OGS_ERROR; return OGS_ERROR;
} }
rc = ogs_sbi_getaddr_from_uri( if (amf_ue->confirmation_url_for_5g_aka)
&scheme, &fqdn, &fqdn_port, &addr, &addr6, message->http.location); ogs_free(amf_ue->confirmation_url_for_5g_aka);
if (rc == false || scheme == OpenAPI_uri_scheme_NULL) { amf_ue->confirmation_url_for_5g_aka =
ogs_error("[%s] Invalid URI [%s]", ogs_strdup(LinksValueSchemeValue->href);
amf_ue->suci, message->http.location); ogs_assert(amf_ue->confirmation_url_for_5g_aka);
return OGS_ERROR;
}
client = ogs_sbi_client_find(scheme, fqdn, fqdn_port, addr, addr6);
if (!client) {
ogs_debug("[%s] ogs_sbi_client_add()", amf_ue->suci);
client = ogs_sbi_client_add(scheme, fqdn, fqdn_port, addr, addr6);
if (!client) {
ogs_error("[%s] ogs_sbi_client_add() failed", amf_ue->suci);
ogs_free(fqdn);
ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6);
return OGS_ERROR;
}
}
OGS_SBI_SETUP_CLIENT(&amf_ue->confirmation_for_5g_aka, client);
ogs_free(fqdn);
ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6);
STORE_5G_AKA_CONFIRMATION(amf_ue, message->http.location);
ogs_ascii_to_hex(AV5G_AKA->rand, strlen(AV5G_AKA->rand), ogs_ascii_to_hex(AV5G_AKA->rand, strlen(AV5G_AKA->rand),
amf_ue->rand, sizeof(amf_ue->rand)); amf_ue->rand, sizeof(amf_ue->rand));

View File

@ -209,16 +209,6 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message)
i++) { i++) {
NGAP_SupportedTAItem_t *SupportedTAItem = NULL; NGAP_SupportedTAItem_t *SupportedTAItem = NULL;
if (gnb->num_of_supported_ta_list >=
OGS_ARRAY_SIZE(gnb->supported_ta_list)) {
ogs_error("OVERFLOW GNB->num_of_supported_ta_list "
"[%d:%d:%d]",
gnb->num_of_supported_ta_list,
OGS_MAX_NUM_OF_SUPPORTED_TA,
(int)OGS_ARRAY_SIZE(gnb->supported_ta_list));
break;
}
SupportedTAItem = (NGAP_SupportedTAItem_t *) SupportedTAItem = (NGAP_SupportedTAItem_t *)
SupportedTAList->list.array[i]; SupportedTAList->list.array[i];
if (!SupportedTAItem) { if (!SupportedTAItem) {
@ -245,17 +235,6 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message)
NGAP_BroadcastPLMNItem_t *BroadcastPLMNItem = NULL; NGAP_BroadcastPLMNItem_t *BroadcastPLMNItem = NULL;
NGAP_PLMNIdentity_t *pLMNIdentity = NULL; NGAP_PLMNIdentity_t *pLMNIdentity = NULL;
if (gnb->supported_ta_list[i].num_of_bplmn_list >=
OGS_ARRAY_SIZE(gnb->supported_ta_list[i].bplmn_list)) {
ogs_error("OVERFLOW GNB->supported_ta_list.num_of_bplmn_list "
"[%d:%d:%d]",
gnb->supported_ta_list[i].num_of_bplmn_list,
OGS_MAX_NUM_OF_BPLMN,
(int)OGS_ARRAY_SIZE(
gnb->supported_ta_list[i].bplmn_list));
break;
}
BroadcastPLMNItem = (NGAP_BroadcastPLMNItem_t *) BroadcastPLMNItem = (NGAP_BroadcastPLMNItem_t *)
SupportedTAItem->broadcastPLMNList.list.array[j]; SupportedTAItem->broadcastPLMNList.list.array[j];
if (!BroadcastPLMNItem) { if (!BroadcastPLMNItem) {
@ -289,19 +268,6 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message)
NGAP_SliceSupportItem_t *SliceSupportItem = NULL; NGAP_SliceSupportItem_t *SliceSupportItem = NULL;
NGAP_S_NSSAI_t *s_NSSAI = NULL; NGAP_S_NSSAI_t *s_NSSAI = NULL;
if (gnb->supported_ta_list[i].bplmn_list[j].num_of_s_nssai >=
OGS_ARRAY_SIZE(
gnb->supported_ta_list[i].bplmn_list[j].s_nssai)) {
ogs_error("OVERFLOW GNB->supported_ta_list."
"bplmn_list.num_of_s_nssai [%d:%d:%d]",
gnb->supported_ta_list[i].bplmn_list[j].
num_of_s_nssai,
OGS_MAX_NUM_OF_SLICE_SUPPORT,
(int)OGS_ARRAY_SIZE(gnb->
supported_ta_list[i].bplmn_list[j].s_nssai));
break;
}
SliceSupportItem = (NGAP_SliceSupportItem_t *) SliceSupportItem = (NGAP_SliceSupportItem_t *)
BroadcastPLMNItem->tAISliceSupportList.list.array[k]; BroadcastPLMNItem->tAISliceSupportList.list.array[k];
if (!SliceSupportItem) { if (!SliceSupportItem) {
@ -2550,7 +2516,7 @@ void ngap_handle_pdu_session_resource_release_response(
sess->pdu_session_resource_release_response_received = true; sess->pdu_session_resource_release_response_received = true;
if (sess->pdu_session_release_complete_received == true) if (sess->pdu_session_release_complete_received == true)
CLEAR_SESSION_CONTEXT(sess); CLEAR_SM_CONTEXT_REF(sess);
} }
} }
@ -4306,16 +4272,6 @@ void ngap_handle_ran_configuration_update(
i++) { i++) {
NGAP_SupportedTAItem_t *SupportedTAItem = NULL; NGAP_SupportedTAItem_t *SupportedTAItem = NULL;
if (gnb->num_of_supported_ta_list >=
OGS_ARRAY_SIZE(gnb->supported_ta_list)) {
ogs_error("OVERFLOW GNB->num_of_supported_ta_list "
"[%d:%d:%d]",
gnb->num_of_supported_ta_list,
OGS_MAX_NUM_OF_SUPPORTED_TA,
(int)OGS_ARRAY_SIZE(gnb->supported_ta_list));
break;
}
SupportedTAItem = (NGAP_SupportedTAItem_t *) SupportedTAItem = (NGAP_SupportedTAItem_t *)
SupportedTAList->list.array[i]; SupportedTAList->list.array[i];
if (!SupportedTAItem) { if (!SupportedTAItem) {
@ -4343,17 +4299,6 @@ void ngap_handle_ran_configuration_update(
NGAP_BroadcastPLMNItem_t *BroadcastPLMNItem = NULL; NGAP_BroadcastPLMNItem_t *BroadcastPLMNItem = NULL;
NGAP_PLMNIdentity_t *pLMNIdentity = NULL; NGAP_PLMNIdentity_t *pLMNIdentity = NULL;
if (gnb->supported_ta_list[i].num_of_bplmn_list >=
OGS_ARRAY_SIZE(gnb->supported_ta_list[i].bplmn_list)) {
ogs_error("OVERFLOW GNB->supported_ta_list."
"num_of_bplm_list [%d:%d:%d]",
gnb->supported_ta_list[i].num_of_bplmn_list,
OGS_MAX_NUM_OF_BPLMN,
(int)OGS_ARRAY_SIZE(
gnb->supported_ta_list[i].bplmn_list));
break;
}
BroadcastPLMNItem = (NGAP_BroadcastPLMNItem_t *) BroadcastPLMNItem = (NGAP_BroadcastPLMNItem_t *)
SupportedTAItem->broadcastPLMNList.list.array[j]; SupportedTAItem->broadcastPLMNList.list.array[j];
if (!BroadcastPLMNItem) { if (!BroadcastPLMNItem) {
@ -4388,21 +4333,6 @@ void ngap_handle_ran_configuration_update(
NGAP_SliceSupportItem_t *SliceSupportItem = NULL; NGAP_SliceSupportItem_t *SliceSupportItem = NULL;
NGAP_S_NSSAI_t *s_NSSAI = NULL; NGAP_S_NSSAI_t *s_NSSAI = NULL;
if (gnb->supported_ta_list[i].
bplmn_list[j].num_of_s_nssai >=
OGS_ARRAY_SIZE(gnb->supported_ta_list[i].
bplmn_list[j].s_nssai)) {
ogs_error("OVERFLOW GNB->num_of_supported_ta_list."
"bplmn_list.num_of_s_nssai"
"[%d:%d:%d]",
gnb->supported_ta_list[i].bplmn_list[j].
num_of_s_nssai,
OGS_MAX_NUM_OF_SLICE_SUPPORT,
(int)OGS_ARRAY_SIZE(gnb->supported_ta_list[i].
bplmn_list[j].s_nssai));
break;
}
SliceSupportItem = (NGAP_SliceSupportItem_t *) SliceSupportItem = (NGAP_SliceSupportItem_t *)
BroadcastPLMNItem->tAISliceSupportList.list.array[k]; BroadcastPLMNItem->tAISliceSupportList.list.array[k];
if (!SliceSupportItem) { if (!SliceSupportItem) {

View File

@ -200,7 +200,6 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
default: default:
ogs_error("Not implemented(security header type:0x%x)", ogs_error("Not implemented(security header type:0x%x)",
sh->security_header_type); sh->security_header_type);
ran_ue_remove(ran_ue);
return OGS_ERROR; return OGS_ERROR;
} }
@ -208,39 +207,12 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
if (nas_5gs_security_decode(ran_ue->amf_ue, if (nas_5gs_security_decode(ran_ue->amf_ue,
security_header_type, nasbuf) != OGS_OK) { security_header_type, nasbuf) != OGS_OK) {
ogs_error("nas_eps_security_decode failed()"); ogs_error("nas_eps_security_decode failed()");
ran_ue_remove(ran_ue);
return OGS_ERROR; return OGS_ERROR;
} }
} }
h = (ogs_nas_5gmm_header_t *)nasbuf->data; h = (ogs_nas_5gmm_header_t *)nasbuf->data;
ogs_assert(h); ogs_assert(h);
if (procedureCode == NGAP_ProcedureCode_id_InitialUEMessage) {
if (h->extended_protocol_discriminator !=
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM) {
ogs_error("Invalid extended_protocol_discriminator [%d]",
h->extended_protocol_discriminator);
ogs_pkbuf_free(nasbuf);
ran_ue_remove(ran_ue);
return OGS_ERROR;
}
if (h->message_type != OGS_NAS_5GS_REGISTRATION_REQUEST &&
h->message_type != OGS_NAS_5GS_SERVICE_REQUEST &&
h->message_type != OGS_NAS_5GS_DEREGISTRATION_REQUEST_FROM_UE) {
ogs_error("Invalid 5GMM message type [%d]", h->message_type);
ogs_pkbuf_free(nasbuf);
ran_ue_remove(ran_ue);
return OGS_ERROR;
}
}
if (h->extended_protocol_discriminator == if (h->extended_protocol_discriminator ==
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM) { OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM) {
e = amf_event_new(AMF_EVENT_5GMM_MESSAGE); e = amf_event_new(AMF_EVENT_5GMM_MESSAGE);
@ -275,10 +247,7 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
} else { } else {
ogs_error("Unknown NAS Protocol discriminator 0x%02x", ogs_error("Unknown NAS Protocol discriminator 0x%02x",
h->extended_protocol_discriminator); h->extended_protocol_discriminator);
ogs_pkbuf_free(nasbuf); ogs_pkbuf_free(nasbuf);
ran_ue_remove(ran_ue);
return OGS_ERROR; return OGS_ERROR;
} }
} }

Some files were not shown because too many files have changed in this diff Show More