Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
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
Operations
Operations
Metrics
Environments
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
OpenXG-SMF
Commits
72bc9621
Commit
72bc9621
authored
Jun 07, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
f44b0569
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
59 deletions
+29
-59
etc/smf.conf
etc/smf.conf
+1
-1
src/smf_app/smf_app.hpp
src/smf_app/smf_app.hpp
+14
-2
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+7
-17
src/smf_app/smf_config.hpp
src/smf_app/smf_config.hpp
+0
-26
src/smf_app/smf_pco.cpp
src/smf_app/smf_pco.cpp
+7
-13
No files found.
etc/smf.conf
View file @
72bc9621
...
@@ -65,7 +65,7 @@ SMF =
...
@@ -65,7 +65,7 @@ SMF =
DEFAULT_DNS_SEC_IPV6_ADDRESS
=
"2001:4860:4860::8844"
;
# YOUR DNS CONFIG HERE
DEFAULT_DNS_SEC_IPV6_ADDRESS
=
"2001:4860:4860::8844"
;
# YOUR DNS CONFIG HERE
#Default P-CSCF server
#Default P-CSCF server
DEFAULT_CSCF_IPV4_ADDRESS
=
"172.21.16.113"
;
DEFAULT_CSCF_IPV4_ADDRESS
=
"172.21.16.113"
;
#TODO: remove hardcoded value
DEFAULT_CSCF_IPV6_ADDRESS
=
"fe80::7915:f408:1787:db8b"
;
DEFAULT_CSCF_IPV6_ADDRESS
=
"fe80::7915:f408:1787:db8b"
;
#Default UE MTU
#Default UE MTU
...
...
src/smf_app/smf_app.hpp
View file @
72bc9621
...
@@ -193,13 +193,25 @@ class smf_app {
...
@@ -193,13 +193,25 @@ class smf_app {
protocol_configuration_options_t
&
pco_resp
,
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
);
const
pco_protocol_or_container_id_t
*
const
poc_id
);
/*
* process_pco_p_cscf_request
* @param [protocol_configuration_options_t &] pco_resp
* @param [pco_protocol_or_container_id_t *const] proc_id
* @return
*/
int
process_pco_p_cscf_request
(
int
process_pco_p_cscf_request
(
protocol_configuration_options_t
&
pco_resp
,
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
);
const
pco_protocol_or_container_id_t
*
const
poc_id
);
int
process_pco_p_cscf_v6_request
(
/*
* process_pco_p_cscf_v6_request
* @param [protocol_configuration_options_t &] pco_resp
* @param [pco_protocol_or_container_id_t *const] proc_id
* @return
*/
int
process_pco_p_cscf_v6_request
(
protocol_configuration_options_t
&
pco_resp
,
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
);
const
pco_protocol_or_container_id_t
*
const
poc_id
);
public:
public:
explicit
smf_app
(
const
std
::
string
&
config_file
);
explicit
smf_app
(
const
std
::
string
&
config_file
);
...
...
src/smf_app/smf_config.cpp
View file @
72bc9621
...
@@ -436,16 +436,13 @@ int smf_config::load(const string& config_file) {
...
@@ -436,16 +436,13 @@ int smf_config::load(const string& config_file) {
util
::
trim
(
astring
).
c_str
(),
default_dnsv4
,
util
::
trim
(
astring
).
c_str
(),
default_dnsv4
,
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !"
);
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !"
);
smf_cfg
.
lookupValue
(
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS
,
astring
);
SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
default_dns_secv4
,
util
::
trim
(
astring
).
c_str
(),
default_dns_secv4
,
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !"
);
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !"
);
// Default CSCF
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_CSCF_IPV4_ADDRESS
,
astring
);
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_CSCF_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
default_cscfv4
,
util
::
trim
(
astring
).
c_str
(),
default_cscfv4
,
...
@@ -465,8 +462,6 @@ int smf_config::load(const string& config_file) {
...
@@ -465,8 +462,6 @@ int smf_config::load(const string& config_file) {
astring
.
c_str
());
astring
.
c_str
());
}
}
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS
,
astring
);
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS
,
astring
);
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
astring
).
c_str
(),
buf_in6_addr
)
==
1
)
{
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
astring
).
c_str
(),
buf_in6_addr
)
==
1
)
{
memcpy
(
&
default_dnsv6
,
buf_in6_addr
,
sizeof
(
struct
in6_addr
));
memcpy
(
&
default_dnsv6
,
buf_in6_addr
,
sizeof
(
struct
in6_addr
));
...
@@ -901,17 +896,6 @@ void smf_config::display() {
...
@@ -901,17 +896,6 @@ void smf_config::display() {
n4.thread_rd_sched_params.sched_policy); Logger::smf_app().info( "
n4.thread_rd_sched_params.sched_policy); Logger::smf_app().info( "
Scheduling prio .....: %d", n4.thread_rd_sched_params.sched_priority);
Scheduling prio .....: %d", n4.thread_rd_sched_params.sched_priority);
Logger::smf_app().info(
" CSCF .........: %s",
inet_ntoa(*((struct in_addr*) &default_cscfv4)));
if (inet_ntop(AF_INET6, &default_cscfv6, str_addr6, sizeof(str_addr6))) {
Logger::smf_app().info(" CSCF v6 ......: %s", str_addr6);
}
Logger::smf_app().info("- " SMF_CONFIG_STRING_DNN_LIST ":");
for (int i = 0; i < num_dnn; i++) {
Logger::smf_app().info(" DNN %d:", i);
Logger::smf_app().info(
Logger::smf_app().info(
" CPU id ..............: %d", itti.itti_timer_sched_params.cpu_id);
" CPU id ..............: %d", itti.itti_timer_sched_params.cpu_id);
Logger::smf_app().info(
Logger::smf_app().info(
...
@@ -1009,6 +993,12 @@ void smf_config::display() {
...
@@ -1009,6 +993,12 @@ void smf_config::display() {
Logger
::
smf_app
().
info
(
" Secondary DNS v6 ....: %s"
,
str_addr6
);
Logger
::
smf_app
().
info
(
" Secondary DNS v6 ....: %s"
,
str_addr6
);
}
}
Logger
::
smf_app
().
info
(
" CSCF .........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
default_cscfv4
)));
if
(
inet_ntop
(
AF_INET6
,
&
default_cscfv6
,
str_addr6
,
sizeof
(
str_addr6
)))
{
Logger
::
smf_app
().
info
(
" CSCF v6 ......: %s"
,
str_addr6
);
}
Logger
::
smf_app
().
info
(
"- Default UE MTU: %d"
,
ue_mtu
);
Logger
::
smf_app
().
info
(
"- Default UE MTU: %d"
,
ue_mtu
);
Logger
::
smf_app
().
info
(
"- Supported Features:"
);
Logger
::
smf_app
().
info
(
"- Supported Features:"
);
Logger
::
smf_app
().
info
(
Logger
::
smf_app
().
info
(
...
...
src/smf_app/smf_config.hpp
View file @
72bc9621
...
@@ -227,32 +227,6 @@ class smf_config {
...
@@ -227,32 +227,6 @@ class smf_config {
struct
in6_addr
default_dns_secv6
;
struct
in6_addr
default_dns_secv6
;
std
::
map
<
std
::
string
,
dnn_t
>
dnns
;
std
::
map
<
std
::
string
,
dnn_t
>
dnns
;
struct
in6_addr
default_cscfv6
;
struct
in6_addr
default_cscfv6
;
#define SMF_NUM_DNN_MAX 5
int
num_dnn
;
struct
{
std
::
string
dnn
;
std
::
string
dnn_label
;
int
pool_id_iv4
;
int
pool_id_iv6
;
pdu_session_type_t
pdu_session_type
;
}
dnn
[
SMF_NUM_DNN_MAX
];
int
num_ue_pool
;
#define SMF_NUM_UE_POOL_MAX 96
struct
in_addr
ue_pool_range_low
[
SMF_NUM_UE_POOL_MAX
];
struct
in_addr
ue_pool_range_high
[
SMF_NUM_UE_POOL_MAX
];
struct
in_addr
ue_pool_network
[
SMF_NUM_UE_POOL_MAX
];
struct
in_addr
ue_pool_netmask
[
SMF_NUM_UE_POOL_MAX
];
// computed from config, UE IP adresses that matches
// ue_pool_network[]/ue_pool_netmask[] but do not match ue_pool_range_low[] -
// ue_pool_range_high[]
// The problem here is that OpenFlow do not deal with ip ranges but with
// netmasks
std
::
vector
<
struct
in_addr
>
ue_pool_excluded
[
SMF_NUM_UE_POOL_MAX
];
int
num_paa6_pool
;
struct
in6_addr
paa_pool6_prefix
[
SMF_NUM_UE_POOL_MAX
];
uint8_t
paa_pool6_prefix_len
[
SMF_NUM_UE_POOL_MAX
];
bool
force_push_pco
;
bool
force_push_pco
;
uint
ue_mtu
;
uint
ue_mtu
;
...
...
src/smf_app/smf_pco.cpp
View file @
72bc9621
...
@@ -335,17 +335,15 @@ int smf_app::process_pco_link_mtu_request(
...
@@ -335,17 +335,15 @@ int smf_app::process_pco_link_mtu_request(
return
pco_push_protocol_or_container_id
(
pco_resp
,
&
poc_id_resp
);
return
pco_push_protocol_or_container_id
(
pco_resp
,
&
poc_id_resp
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
smf_app
::
process_pco_p_cscf_request
(
int
smf_app
::
process_pco_p_cscf_request
(
protocol_configuration_options_t
&
pco_resp
,
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
)
{
const
pco_protocol_or_container_id_t
*
const
poc_id
)
{
in_addr_t
cscf_ipv4_addr
=
smf_cfg
.
default_cscfv4
.
s_addr
;
in_addr_t
cscf_ipv4_addr
=
smf_cfg
.
default_cscfv4
.
s_addr
;
pco_protocol_or_container_id_t
poc_id_resp
=
{
0
};
pco_protocol_or_container_id_t
poc_id_resp
=
{
0
};
uint8_t
cscf_array
[
4
];
uint8_t
cscf_array
[
4
];
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"PCO: Protocol identifier P CSCF Request"
);
"PCO: Protocol identifier P CSCF Request"
);
poc_id_resp
.
protocol_id
=
PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV4_ADDRESS
;
poc_id_resp
.
protocol_id
=
PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV4_ADDRESS
;
poc_id_resp
.
length_of_protocol_id_contents
=
4
;
poc_id_resp
.
length_of_protocol_id_contents
=
4
;
cscf_array
[
0
]
=
(
uint8_t
)(
cscf_ipv4_addr
&
0x000000FF
);
cscf_array
[
0
]
=
(
uint8_t
)(
cscf_ipv4_addr
&
0x000000FF
);
...
@@ -362,25 +360,23 @@ int smf_app::process_pco_p_cscf_request(
...
@@ -362,25 +360,23 @@ int smf_app::process_pco_p_cscf_request(
int
smf_app
::
process_pco_p_cscf_v6_request
(
int
smf_app
::
process_pco_p_cscf_v6_request
(
protocol_configuration_options_t
&
pco_resp
,
protocol_configuration_options_t
&
pco_resp
,
const
pco_protocol_or_container_id_t
*
const
poc_id
)
{
const
pco_protocol_or_container_id_t
*
const
poc_id
)
{
in6_addr
cscf_ipv6_addr
=
smf_cfg
.
default_cscfv6
;
in6_addr
cscf_ipv6_addr
=
smf_cfg
.
default_cscfv6
;
pco_protocol_or_container_id_t
poc_id_resp
=
{
0
};
pco_protocol_or_container_id_t
poc_id_resp
=
{
0
};
uint8_t
cscfv6_array
[
16
];
uint8_t
cscfv6_array
[
16
];
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"PCO: Protocol identifier P CSCF v6 Request"
);
"PCO: Protocol identifier P CSCF v6 Request"
);
poc_id_resp
.
protocol_id
=
PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV6_ADDRESS
;
poc_id_resp
.
protocol_id
=
PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV6_ADDRESS
;
poc_id_resp
.
length_of_protocol_id_contents
=
16
;
poc_id_resp
.
length_of_protocol_id_contents
=
16
;
char
str_addr6
[
INET6_ADDRSTRLEN
];
char
str_addr6
[
INET6_ADDRSTRLEN
];
if
(
inet_ntop
(
if
(
inet_ntop
(
AF_INET6
,
&
cscf_ipv6_addr
,
str_addr6
,
sizeof
(
str_addr6
)))
{
AF_INET6
,
&
cscf_ipv6_addr
,
str_addr6
,
sizeof
(
str_addr6
)))
{
std
::
string
ipv6_addr_str
((
char
*
)
str_addr6
,
INET6_ADDRSTRLEN
);
std
::
string
ipv6_addr_str
((
char
*
)
str_addr6
,
INET6_ADDRSTRLEN
);
Logger
::
smf_app
().
info
(
" CSCF Ipv6 address....: %s"
,
ipv6_addr_str
.
c_str
());
Logger
::
smf_app
().
info
(
" CSCF Ipv6 address....: %s"
,
ipv6_addr_str
.
c_str
());
unsigned
char
buf_in6_addr
[
sizeof
(
struct
in6_addr
)];
unsigned
char
buf_in6_addr
[
sizeof
(
struct
in6_addr
)];
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
ipv6_addr_str
).
c_str
(),
buf_in6_addr
)
==
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
ipv6_addr_str
).
c_str
(),
buf_in6_addr
)
==
1
)
{
1
)
{
for
(
int
i
=
0
;
i
<=
15
;
i
++
)
cscfv6_array
[
i
]
=
(
uint8_t
)(
buf_in6_addr
[
i
]);
for
(
int
i
=
0
;
i
<=
15
;
i
++
)
cscfv6_array
[
i
]
=
(
uint8_t
)(
buf_in6_addr
[
i
]);
}
}
}
}
...
@@ -390,8 +386,6 @@ int smf_app::process_pco_p_cscf_v6_request(
...
@@ -390,8 +386,6 @@ int smf_app::process_pco_p_cscf_v6_request(
return
pco_push_protocol_or_container_id
(
pco_resp
,
&
poc_id_resp
);
return
pco_push_protocol_or_container_id
(
pco_resp
,
&
poc_id_resp
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
smf_app
::
process_pco_request
(
int
smf_app
::
process_pco_request
(
const
protocol_configuration_options_t
&
pco_req
,
const
protocol_configuration_options_t
&
pco_req
,
...
...
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