Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
oai-upf-6g
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
oai-upf-6g
Commits
a6e1a9c1
Commit
a6e1a9c1
authored
Nov 19, 2025
by
Franck MESSAOUDI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change Host-Byte-Order to Network-Byte-Order in NextHopFiner.cpp
parent
ac3fd428
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
100 deletions
+42
-100
README.md
README.md
+1
-1
etc/config.yaml
etc/config.yaml
+32
-94
src/upf_app/SessionProgramManager.cpp
src/upf_app/SessionProgramManager.cpp
+5
-2
src/upf_app/helpers/NextHopFinder.cpp
src/upf_app/helpers/NextHopFinder.cpp
+4
-3
No files found.
README.md
View file @
a6e1a9c1
------------------------------------------------------------------------------
------------------------------------------------------------------------------
OPENAIR-CN-
5
G
OPENAIR-CN-
6
G
An implementation of the 5G Core network by the OpenAirInterface community.
An implementation of the 5G Core network by the OpenAirInterface community.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
...
...
etc/config.yaml
View file @
a6e1a9c1
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# OAI CN Configuration File
log_level
:
log_level
:
general
:
debug
general
:
info
# If you enable registration, the other NFs will use the NRF discovery mechanism
register_nf
:
register_nf
:
general
:
no
general
:
no
http_version
:
2
http_version
:
2
############## SBI Interfaces
############## SBI Interfaces
### Each NF takes its local SBI interfaces and remote interfaces from here, unless it gets them using NRF discovery mechanisms
nfs
:
nfs
:
amf
:
host
:
192.168.10.100
sbi
:
port
:
8080
api_version
:
v1
interface_name
:
enp4s0f0np0
n2
:
interface_name
:
enp4s0f0np0
port
:
38412
smf
:
smf
:
host
:
192.168.1
0.100
host
:
192.168.1
99.68
sbi
:
sbi
:
port
:
8080
port
:
8080
api_version
:
v1
api_version
:
v1
interface_name
:
en
p4s0f0np0
interface_name
:
en
o1
n4
:
n4
:
interface_name
:
en
p4s0f0np0
interface_name
:
en
o1
port
:
8805
port
:
8805
upf
:
upf
:
host
:
192.168.1
0.10
host
:
192.168.1
99.67
sbi
:
sbi
:
port
:
8080
port
:
8080
api_version
:
v1
api_version
:
v1
interface_name
:
en
p1s0f0np0
interface_name
:
en
o1
n3
:
n3
:
interface_name
:
enp1s0f
1np1
interface_name
:
enp1s0f
0np0
port
:
2152
port
:
2152
n4
:
n4
:
interface_name
:
en
p1s0f0np0
interface_name
:
en
o1
port
:
8805
port
:
8805
n6
:
n6
:
interface_name
:
eno1
interface_name
:
enp1s0f1np1
n9
:
interface_name
:
enp1s0f0np0
port
:
2152
udm
:
host
:
192.168.10.100
sbi
:
port
:
8080
api_version
:
v1
interface_name
:
enp4s0f0np0
udr
:
host
:
192.168.10.100
sbi
:
port
:
8080
api_version
:
v1
interface_name
:
enp4s0f0np0
ausf
:
host
:
192.168.10.100
sbi
:
port
:
8080
api_version
:
v1
interface_name
:
enp4s0f0np0
nrf
:
host
:
192.168.10.100
sbi
:
port
:
8080
api_version
:
v1
interface_name
:
enp4s0f0np0
#### Common for UDR and AMF
database
:
host
:
192.168.10.100
user
:
test
type
:
mysql
password
:
test
database_name
:
oai_db
generate_random
:
true
connection_timeout
:
300
## general single_nssai configuration
snssais
:
snssais
:
-
&embb_slice1
-
&embb_slice1
sst
:
1
sst
:
1
-
&embb_slice2
-
&embb_slice2
sst
:
1
sst
:
1
sd
:
000001
sd
:
000001
# in hex
-
&custom_slice
-
&custom_slice
sst
:
222
sst
:
222
sd
:
00007B
sd
:
00007B
# in hex
############## NF-specific configuration
############## NF-specific configuration
amf
:
amf
:
pid_directory
:
"
/var/run"
pid_directory
:
"
/var/run"
amf_name
:
"
OAI-AMF"
amf_name
:
"
OAI-AMF"
# This really depends on if we want to keep the "mini" version or not
support_features_options
:
support_features_options
:
enable_simple_scenario
:
no
enable_simple_scenario
:
no
enable_nssf
:
no
enable_nssf
:
no
enable_smf_selection
:
yes
enable_smf_selection
:
yes
use_external_udm
:
no
use_external_udm
:
no
relative_capacity
:
30
relative_capacity
:
30
statistics_timer_interval
:
20
statistics_timer_interval
:
20
#in seconds
emergency_support
:
false
emergency_support
:
false
served_guami_list
:
served_guami_list
:
-
mcc
:
208
-
mcc
:
208
...
@@ -149,10 +85,11 @@ amf:
...
@@ -149,10 +85,11 @@ amf:
smf
:
smf
:
ue_mtu
:
1500
ue_mtu
:
1500
support_features
:
support_features
:
use_local_subscription_info
:
yes
use_local_subscription_info
:
yes
# Use infos from local_subscription_info or from UDM
use_local_pcc_rules
:
yes
use_local_pcc_rules
:
yes
# Use infos from local_pcc_rules or from PCF
# we resolve from NRF, this is just to configure usage_reporting
upfs
:
upfs
:
-
host
:
192.168.1
0.10
-
host
:
192.168.1
99.67
config
:
config
:
enable_usage_reporting
:
no
enable_usage_reporting
:
no
ue_dns
:
ue_dns
:
...
@@ -160,39 +97,40 @@ smf:
...
@@ -160,39 +97,40 @@ smf:
primary_ipv6
:
"
2001:4860:4860::8888"
primary_ipv6
:
"
2001:4860:4860::8888"
secondary_ipv4
:
"
8.8.4.4"
secondary_ipv4
:
"
8.8.4.4"
secondary_ipv6
:
"
2001:4860:4860::8844"
secondary_ipv6
:
"
2001:4860:4860::8844"
# the DNN you configure here should be configured in "dnns"
local_subscription_infos
:
local_subscription_infos
:
-
single_nssai
:
-
single_nssai
:
sst
:
1
sst
:
1
dnn
:
"
oai"
dnn
:
"
oai"
qos_profile
:
qos_profile
:
5qi
:
9
5qi
:
9
session_ambr_ul
:
"
200Mbps"
session_ambr_ul
:
"
200
0
Mbps"
session_ambr_dl
:
"
400Mbps"
session_ambr_dl
:
"
400
0
Mbps"
-
single_nssai
:
-
single_nssai
:
sst
:
1
sst
:
1
sd
:
1
sd
:
1
dnn
:
"
oai.ipv4"
dnn
:
"
oai.ipv4"
qos_profile
:
qos_profile
:
5qi
:
9
5qi
:
9
session_ambr_ul
:
"
100Mbps"
session_ambr_ul
:
"
100
0
Mbps"
session_ambr_dl
:
"
200Mbps"
session_ambr_dl
:
"
200
0
Mbps"
-
single_nssai
:
-
single_nssai
:
sst
:
222
sst
:
222
sd
:
123
sd
:
123
dnn
:
"
default"
dnn
:
"
default"
qos_profile
:
qos_profile
:
5qi
:
9
5qi
:
9
session_ambr_ul
:
"
50Mbps"
session_ambr_ul
:
"
50
00
Mbps"
session_ambr_dl
:
"
100Mbps"
session_ambr_dl
:
"
100
0
Mbps"
upf
:
upf
:
support_features
:
support_features
:
enable_bpf_datapath
:
no
enable_bpf_datapath
:
on
# If "on": BPF is used as datapath else simpleswitch is used, DEFAULT= off
enable_qos
:
no
enable_qos
:
on
# Only supported for BPF datapath. If "on" we use qdiscs to manage the QoS
qdisc_scheduler
:
"
htb"
qdisc_scheduler
:
"
htb"
# This value is used only in case QoS is enabled
enable_snat
:
no
enable_snat
:
no
# If "on": Source natting is done for UE, DEFAULT= off
remote_n6_gw
:
192.168.
199.1
remote_n6_gw
:
192.168.
20.100
smfs
:
smfs
:
-
host
:
192.168.1
0.100
-
host
:
192.168.1
99.68
config
:
config
:
enable_usage_reporting
:
no
enable_usage_reporting
:
no
upf_info
:
upf_info
:
...
...
src/upf_app/SessionProgramManager.cpp
View file @
a6e1a9c1
...
@@ -374,7 +374,7 @@ void SessionProgramManager::updateARPTableForN6(
...
@@ -374,7 +374,7 @@ void SessionProgramManager::updateARPTableForN6(
uint32_t
ipnexremoteN6hop
=
(
likely
(
is_little_endian
()))
?
uint32_t
ipnexremoteN6hop
=
(
likely
(
is_little_endian
()))
?
htole32
(
getRemoteIP
(
upfn6IP
,
dnIP
))
:
htole32
(
getRemoteIP
(
upfn6IP
,
dnIP
))
:
getRemoteIP
(
upfn6IP
,
dnIP
);
getRemoteIP
(
upfn6IP
,
dnIP
);
Logger
::
upf_app
().
info
(
"-----is_little_endian() is %d
\n
"
,
is_little_endian
());
auto
remoteN6MAC
=
NextHopFinder
::
retrieveNextHopMAC
(
ipnexremoteN6hop
);
auto
remoteN6MAC
=
NextHopFinder
::
retrieveNextHopMAC
(
ipnexremoteN6hop
);
struct
s_arp_mapping
map_table
;
struct
s_arp_mapping
map_table
;
...
@@ -387,11 +387,14 @@ void SessionProgramManager::updateARPTableForN6(
...
@@ -387,11 +387,14 @@ void SessionProgramManager::updateARPTableForN6(
// Logger::upf_app().error(
// Logger::upf_app().error(
// "************************ max_arp_entries = %d", max_entries);
// "************************ max_arp_entries = %d", max_entries);
// pPFCP_Session_LookupProgram->getArpTableMap()->resize(max_entries);
// pPFCP_Session_LookupProgram->getArpTableMap()->resize(max_entries);
// printf("-----------------upfn6Ip is %x\n",upfn6IP);
pPFCP_Session_LookupProgram
->
getArpTableMap
()
->
update
(
pPFCP_Session_LookupProgram
->
getArpTableMap
()
->
update
(
upfn6IP
,
map_table
,
BPF_ANY
);
upfn6IP
,
map_table
,
BPF_ANY
);
}
catch
(
const
std
::
exception
&
ex
)
{
}
catch
(
const
std
::
exception
&
ex
)
{
Logger
::
upf_app
().
error
(
Logger
::
upf_app
().
error
(
"Error: The ARP table was not updated for N6 Next HOP"
);
"Error: The ARP table was not updated for N6 Next HOP, -----upfn6IP is %x, \
dnIP is %x, %s
\n
"
,
upfn6IP
,
dnIP
,
ex
.
what
());
}
}
}
}
...
...
src/upf_app/helpers/NextHopFinder.cpp
View file @
a6e1a9c1
...
@@ -38,9 +38,9 @@ uint32_t NextHopFinder::retrieveNextHopIP(uint32_t ipDest) {
...
@@ -38,9 +38,9 @@ uint32_t NextHopFinder::retrieveNextHopIP(uint32_t ipDest) {
char
*
ipAddress
=
inet_ntoa
(
addr
);
char
*
ipAddress
=
inet_ntoa
(
addr
);
if
(
ipAddress
)
{
if
(
ipAddress
)
{
cmd
=
fmt
::
format
(
"ip route get {} | awk '{
print $3
}'"
,
ipAddress
);
cmd
=
fmt
::
format
(
"ip route get {} | awk '{
{print $3}
}'"
,
ipAddress
);
}
}
uint32_t
nextHopIp
=
htonl
(
inet_addr
(
CmdRunner
::
exec
(
cmd
).
c_str
()));
uint32_t
nextHopIp
=
htonl
(
inet_addr
(
CmdRunner
::
exec
(
cmd
).
c_str
()));
if
(
!
nextHopIp
)
{
if
(
!
nextHopIp
)
{
...
@@ -55,7 +55,7 @@ uint32_t NextHopFinder::retrieveNextHopIP(uint32_t ipDest) {
...
@@ -55,7 +55,7 @@ uint32_t NextHopFinder::retrieveNextHopIP(uint32_t ipDest) {
ether_addr
*
NextHopFinder
::
retrieveNextHopMAC
(
uint32_t
nextHopIp
)
{
ether_addr
*
NextHopFinder
::
retrieveNextHopMAC
(
uint32_t
nextHopIp
)
{
std
::
string
cmd
=
{};
std
::
string
cmd
=
{};
struct
in_addr
addr
=
{.
s_addr
=
nextHopIp
};
struct
in_addr
addr
=
{.
s_addr
=
htonl
(
nextHopIp
)};
// 原本是没有做htonl转换的。
char
*
ipAddress
=
inet_ntoa
(
addr
);
char
*
ipAddress
=
inet_ntoa
(
addr
);
std
::
string
nextHopMac
=
{};
std
::
string
nextHopMac
=
{};
...
@@ -63,6 +63,7 @@ ether_addr* NextHopFinder::retrieveNextHopMAC(uint32_t nextHopIp) {
...
@@ -63,6 +63,7 @@ ether_addr* NextHopFinder::retrieveNextHopMAC(uint32_t nextHopIp) {
cmd
=
fmt
::
format
(
cmd
=
fmt
::
format
(
"sudo arping -c 1 {} | awk '/from/ {{print $4}}'"
,
ipAddress
);
"sudo arping -c 1 {} | awk '/from/ {{print $4}}'"
,
ipAddress
);
}
}
Logger
::
upf_app
().
info
(
"----nextHopIp is %x, cmd is %s
\n
"
,
htonl
(
nextHopIp
),
cmd
);
nextHopMac
=
CmdRunner
::
exec
(
cmd
);
nextHopMac
=
CmdRunner
::
exec
(
cmd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment