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
9086eece
Commit
9086eece
authored
Nov 15, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tentative fix for OC
parent
74e79f24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
28 deletions
+62
-28
src/common/3gpp_29.244.h
src/common/3gpp_29.244.h
+42
-14
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+20
-14
No files found.
src/common/3gpp_29.244.h
View file @
9086eece
...
...
@@ -1011,6 +1011,7 @@ typedef struct fseid_s {
// 8.2.38 Node ID
enum
node_id_type_value_e
{
/* Request / Initial message */
NODE_ID_TYPE_UNKNOWN
=
-
1
,
NODE_ID_TYPE_IPV4_ADDRESS
=
0
,
NODE_ID_TYPE_IPV6_ADDRESS
=
1
,
NODE_ID_TYPE_FQDN
=
2
,
...
...
@@ -1025,21 +1026,48 @@ struct node_id_s {
}
u1
;
std
::
string
fqdn
;
// should be in union but problem with virtual ~
bool
operator
==
(
const
struct
node_id_s
&
i
)
const
{
if
((
i
.
node_id_type
==
this
->
node_id_type
)
&&
(
i
.
u1
.
ipv4_address
.
s_addr
==
this
->
u1
.
ipv4_address
.
s_addr
)
&&
(
i
.
fqdn
==
this
->
fqdn
)
&&
(
i
.
u1
.
ipv6_address
.
s6_addr32
[
0
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
0
])
&&
(
i
.
u1
.
ipv6_address
.
s6_addr32
[
1
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
1
])
&&
(
i
.
u1
.
ipv6_address
.
s6_addr32
[
2
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
2
])
&&
(
i
.
u1
.
ipv6_address
.
s6_addr32
[
3
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
3
]))
{
return
true
;
}
else
{
return
false
;
if
(
i
.
node_id_type
!=
this
->
node_id_type
)
return
false
;
switch
(
i
.
node_id_type
)
{
case
NODE_ID_TYPE_IPV4_ADDRESS
:
{
if
(
i
.
u1
.
ipv4_address
.
s_addr
==
this
->
u1
.
ipv4_address
.
s_addr
)
return
true
;
}
break
;
case
NODE_ID_TYPE_IPV6_ADDRESS
:
{
if
((
i
.
u1
.
ipv6_address
.
s6_addr32
[
0
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
0
])
&&
(
i
.
u1
.
ipv6_address
.
s6_addr32
[
1
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
1
])
&&
(
i
.
u1
.
ipv6_address
.
s6_addr32
[
2
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
2
])
&&
(
i
.
u1
.
ipv6_address
.
s6_addr32
[
3
]
==
this
->
u1
.
ipv6_address
.
s6_addr32
[
3
]))
return
true
;
}
break
;
case
NODE_ID_TYPE_FQDN
:
{
if
(
i
.
fqdn
==
this
->
fqdn
)
return
true
;
}
break
;
default:
{
return
false
;
}
}
/*
if ((i.node_id_type == this->node_id_type) &&
(i.u1.ipv4_address.s_addr == this->u1.ipv4_address.s_addr) &&
(i.fqdn == this->fqdn) &&
(i.u1.ipv6_address.s6_addr32[0] ==
this->u1.ipv6_address.s6_addr32[0]) &&
(i.u1.ipv6_address.s6_addr32[1] ==
this->u1.ipv6_address.s6_addr32[1]) &&
(i.u1.ipv6_address.s6_addr32[2] ==
this->u1.ipv6_address.s6_addr32[2]) &&
(i.u1.ipv6_address.s6_addr32[3] ==
this->u1.ipv6_address.s6_addr32[3])) {
return true;
} else {
return false;
}
*/
};
bool
operator
==
(
const
std
::
string
&
f
)
const
{
if
((
NODE_ID_TYPE_FQDN
==
this
->
node_id_type
)
&&
(
fqdn
.
compare
(
f
)
==
0
))
{
...
...
src/smf_app/smf_app.cpp
View file @
9086eece
...
...
@@ -1323,6 +1323,9 @@ bool smf_app::handle_nf_status_notification(
std
::
vector
<
struct
in_addr
>
ipv4_addrs
=
{};
profile
.
get
()
->
get_nf_ipv4_addresses
(
ipv4_addrs
);
pfcp
::
node_id_t
n
=
{};
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_UNKNOWN
;
// Use FQDN if available
if
(
!
upf_fqdn
.
empty
())
{
uint8_t
addr_type
=
{
0
};
...
...
@@ -1336,7 +1339,6 @@ bool smf_app::handle_nf_status_notification(
Logger
::
smf_app
().
debug
(
"Do not support IPv6 addr for UPF"
);
return
false
;
}
else
{
// IPv4
if
(
inet_aton
(
util
::
trim
(
address
).
c_str
(),
&
upf_ipv4_addr
)
==
0
)
{
Logger
::
smf_app
().
debug
(
"Bad IPv4 Addr format for UPF"
);
return
false
;
...
...
@@ -1354,24 +1356,20 @@ bool smf_app::handle_nf_status_notification(
// Add a new UPF node
Logger
::
smf_app
().
debug
(
"Add a new UPF node, FQDN %s"
,
upf_fqdn
.
c_str
());
pfcp
::
node_id_t
n
=
{};
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_FQDN
;
n
.
fqdn
=
upf_fqdn
;
//
pfcp::node_id_t n = {};
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_FQDN
;
n
.
fqdn
=
upf_fqdn
;
n
.
u1
.
ipv4_address
.
s_addr
=
upf_ipv4_addr
.
s_addr
;
// Normally we should not do that, but ok since we
// keep both fqdn and IPv4 at the same time
smf_cfg
.
upfs
.
push_back
(
n
);
upf_profile
*
upf_node_profile
=
dynamic_cast
<
upf_profile
*>
(
profile
.
get
());
start_upf_association
(
n
,
std
::
ref
(
*
upf_node_profile
));
}
else
{
Logger
::
smf_app
().
debug
(
"UPF node already exist (%s)"
,
address
.
c_str
());
}
}
else
if
(
ipv4_addrs
.
size
()
>=
1
)
{
// If FQDN isn't available, check
// IP address
}
if
(
ipv4_addrs
.
size
()
>=
1
)
{
// Use IP address if it's available
bool
found
=
false
;
for
(
auto
node
:
smf_cfg
.
upfs
)
{
if
(
node
.
u1
.
ipv4_address
.
s_addr
==
ipv4_addrs
[
0
].
s_addr
)
{
...
...
@@ -1383,18 +1381,26 @@ bool smf_app::handle_nf_status_notification(
// Add a new UPF node
Logger
::
smf_app
().
debug
(
"Add a new UPF node, Ipv4 Addr %s"
,
inet_ntoa
(
ipv4_addrs
[
0
]));
pfcp
::
node_id_t
n
=
{};
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
;
// pfcp::node_id_t n = {};
if
(
n
.
node_id_type
==
pfcp
::
NODE_ID_TYPE_UNKNOWN
)
n
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
;
n
.
u1
.
ipv4_address
.
s_addr
=
ipv4_addrs
[
0
].
s_addr
;
smf_cfg
.
upfs
.
push_back
(
n
);
/*
smf_cfg.upfs.push_back(n);
upf_profile* upf_node_profile =
dynamic_cast<upf_profile*>(profile.get());
start_upf_association(n, std::ref(*upf_node_profile));
*/
}
else
{
Logger
::
smf_app
().
debug
(
"UPF node already exist (%s)"
,
inet_ntoa
(
ipv4_addrs
[
0
]));
}
}
if
(
n
.
node_id_type
!=
pfcp
::
NODE_ID_TYPE_UNKNOWN
)
{
smf_cfg
.
upfs
.
push_back
(
n
);
upf_profile
*
upf_node_profile
=
dynamic_cast
<
upf_profile
*>
(
profile
.
get
());
start_upf_association
(
n
,
std
::
ref
(
*
upf_node_profile
));
}
else
{
Logger
::
smf_app
().
debug
(
"No IP Addr/FQDN found"
);
return
false
;
...
...
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