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
885f0f3e
Commit
885f0f3e
authored
Sep 24, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Static IP Addr from UE subscription information
parent
090858b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
42 deletions
+54
-42
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+54
-42
No files found.
src/smf_app/smf_context.cpp
View file @
885f0f3e
...
...
@@ -1366,13 +1366,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
bool
set_paa
=
false
;
paa_t
paa
=
{};
Logger
::
smf_app
().
debug
(
"UE Address Allocation"
);
bool
paa_static_ip
=
false
;
switch
(
sp
->
pdu_session_type
.
pdu_session_type
)
{
case
PDU_SESSION_TYPE_E_IPV4V6
:
{
Logger
::
smf_app
().
debug
(
"PDU Session Type IPv4v6, select PDU Session Type IPv4"
);
bool
paa_res
=
false
;
// TODO: Verify if use default session type or requested session type
std
::
shared_ptr
<
session_management_subscription
>
ss
=
{};
std
::
shared_ptr
<
dnn_configuration_t
>
sdc
=
{};
find_dnn_subscription
(
snssai
,
ss
);
...
...
@@ -1381,12 +1376,53 @@ void smf_context::handle_pdu_session_create_sm_context_request(
if
(
nullptr
!=
sdc
.
get
())
{
paa
.
pdu_session_type
.
pdu_session_type
=
sdc
.
get
()
->
pdu_session_types
.
default_session_type
.
pdu_session_type
;
->
pdu_session_types
.
default_session_type
.
pdu_session_type
;
// TODO: Verified if use default session
// type or requested session type
// Static IP address allocation
for
(
auto
addr
:
sdc
.
get
()
->
static_ip_addresses
)
{
if
((
sp
->
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV4V6
)
or
(
sp
->
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV4
))
{
if
(
addr
.
ip_address_type
==
IP_ADDRESS_TYPE_IPV4_ADDRESS
)
{
Logger
::
smf_app
().
debug
(
"Static IP Address with IPv4 %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
addr
.
u1
.
ipv4_address
)));
paa
.
ipv4_address
.
s_addr
=
addr
.
u1
.
ipv4_address
.
s_addr
;
paa
.
pdu_session_type
=
pdu_session_type_e
::
PDU_SESSION_TYPE_E_IPV4
;
set_paa
=
true
;
paa_static_ip
=
true
;
}
}
else
if
(
sp
->
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV6
)
{
paa
.
pdu_session_type
=
pdu_session_type_e
::
PDU_SESSION_TYPE_E_IPV6
;
if
(
addr
.
ip_address_type
==
IP_ADDRESS_TYPE_IPV6_ADDRESS
)
{
paa
.
ipv6_address
=
addr
.
u1
.
ipv6_address
;
}
else
if
(
addr
.
ip_address_type
==
IP_ADDRESS_TYPE_IPV6_PREFIX
)
{
paa
.
ipv6_address
=
addr
.
u1
.
ipv6_prefix
.
prefix
;
// TODO: prefix length
}
char
str_addr6
[
INET6_ADDRSTRLEN
];
if
(
inet_ntop
(
AF_INET6
,
&
paa
.
ipv6_address
,
str_addr6
,
sizeof
(
str_addr6
)))
{
Logger
::
smf_app
().
debug
(
"Static IP Address with IPv6 %s"
,
str_addr6
);
}
set_paa
=
true
;
paa_static_ip
=
true
;
}
}
}
}
switch
(
sp
->
pdu_session_type
.
pdu_session_type
)
{
case
PDU_SESSION_TYPE_E_IPV4V6
:
{
Logger
::
smf_app
().
debug
(
"PDU Session Type IPv4v6, select PDU Session Type IPv4"
);
// TODO: use requested PDU Session Type?
// paa.pdu_session_type.pdu_session_type = PDU_SESSION_TYPE_E_IPV4V6;
if
((
not
paa_
res
)
||
(
not
paa
.
is_ip_assigned
()))
{
if
((
not
paa_
static_ip
)
||
(
not
paa
.
is_ip_assigned
()))
{
bool
success
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sd
->
dnn_in_use
,
paa
);
if
(
success
)
{
...
...
@@ -1398,8 +1434,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
sm_context_resp_pending
->
res
.
set_cause
(
static_cast
<
uint8_t
>
(
cause_value_5gsm_e
::
CAUSE_26_INSUFFICIENT_RESOURCES
));
}
// TODO: Static IP address allocation
}
else
if
((
paa_res
)
&&
(
paa
.
is_ip_assigned
()))
{
}
else
if
((
paa_static_ip
)
&&
(
paa
.
is_ip_assigned
()))
{
set_paa
=
true
;
}
Logger
::
smf_app
().
info
(
...
...
@@ -1417,30 +1452,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
Logger
::
smf_app
().
debug
(
"PDU Session Type IPv4"
);
if
(
!
pco_ids
.
ci_ipv4_address_allocation_via_dhcpv4
)
{
// use SM NAS signalling
// static or dynamic address allocation
bool
paa_res
=
false
;
// how to define static or dynamic
// depend of subscription information: staticIpAddress in DNN
// Configuration
// TODO: check static IP address is available in the subscription
// information (SessionManagementSubscription) or in DHCP/DN-AAA
std
::
shared_ptr
<
session_management_subscription
>
ss
=
{};
std
::
shared_ptr
<
dnn_configuration_t
>
sdc
=
{};
find_dnn_subscription
(
snssai
,
ss
);
if
(
nullptr
!=
ss
.
get
())
{
ss
.
get
()
->
find_dnn_configuration
(
sd
->
dnn_in_use
,
sdc
);
if
(
nullptr
!=
sdc
.
get
())
{
paa
.
pdu_session_type
.
pdu_session_type
=
sdc
.
get
()
->
pdu_session_types
.
default_session_type
.
pdu_session_type
;
// TODO: Verified if use default session
// type or requested session type
// TODO: static ip address
}
}
if
((
not
paa_res
)
||
(
not
paa
.
is_ip_assigned
()))
{
if
((
not
paa_static_ip
)
||
(
not
paa
.
is_ip_assigned
()))
{
bool
success
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sd
->
dnn_in_use
,
paa
);
if
(
success
)
{
...
...
@@ -1452,8 +1464,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
sm_context_resp_pending
->
res
.
set_cause
(
static_cast
<
uint8_t
>
(
cause_value_5gsm_e
::
CAUSE_26_INSUFFICIENT_RESOURCES
));
}
// Static IP address allocation
}
else
if
((
paa_
res
)
&&
(
paa
.
is_ip_assigned
()))
{
}
else
if
((
paa_
static_ip
)
&&
(
paa
.
is_ip_assigned
()))
{
set_paa
=
true
;
}
Logger
::
smf_app
().
info
(
...
...
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