Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-NRF
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-NRF
Commits
53b348bd
Unverified
Commit
53b348bd
authored
Jun 28, 2021
by
kharade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for ipv6
parent
6b57e049
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
16 deletions
+37
-16
src/common/utils/api_conversions.cpp
src/common/utils/api_conversions.cpp
+32
-13
src/nrf_app/nrf_profile.cpp
src/nrf_app/nrf_profile.cpp
+5
-3
No files found.
src/common/utils/api_conversions.cpp
View file @
53b348bd
...
@@ -87,21 +87,40 @@ bool api_conv::profile_api_to_nrf_profile(
...
@@ -87,21 +87,40 @@ bool api_conv::profile_api_to_nrf_profile(
profile
.
get
()
->
set_fqdn
(
api_profile
.
getFqdn
());
profile
.
get
()
->
set_fqdn
(
api_profile
.
getFqdn
());
Logger
::
nrf_app
().
debug
(
"
\t
FQDN: %s"
,
api_profile
.
getFqdn
().
c_str
());
Logger
::
nrf_app
().
debug
(
"
\t
FQDN: %s"
,
api_profile
.
getFqdn
().
c_str
());
}
}
std
::
vector
<
std
::
string
>
ipv4_addr_str
=
api_profile
.
getIpv4Addresses
();
if
(
api_profile
.
ipv4AddressesIsSet
())
{
for
(
auto
address
:
ipv4_addr_str
)
{
std
::
vector
<
std
::
string
>
ipv4_addr_str
=
api_profile
.
getIpv4Addresses
();
struct
in_addr
addr4
=
{};
for
(
auto
address
:
ipv4_addr_str
)
{
unsigned
char
buf_in_addr
[
sizeof
(
struct
in_addr
)];
struct
in_addr
addr4
=
{};
if
(
inet_pton
(
AF_INET
,
util
::
trim
(
address
).
c_str
(),
buf_in_addr
)
==
1
)
{
unsigned
char
buf_in_addr
[
sizeof
(
struct
in_addr
)];
memcpy
(
&
addr4
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
if
(
inet_pton
(
AF_INET
,
util
::
trim
(
address
).
c_str
(),
buf_in_addr
)
==
1
)
{
}
else
{
memcpy
(
&
addr4
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
Logger
::
nrf_app
().
warn
(
}
else
{
"Address conversion: Bad value %s"
,
util
::
trim
(
address
).
c_str
());
Logger
::
nrf_app
().
warn
(
}
"Address conversion: Bad value %s"
,
util
::
trim
(
address
).
c_str
());
}
Logger
::
nrf_app
().
debug
(
"
\t
IPv4 Addr: %s"
,
address
.
c_str
());
Logger
::
nrf_app
().
debug
(
"
\t
IPv4 Addr: %s"
,
address
.
c_str
());
profile
.
get
()
->
add_nf_ipv4_addresses
(
addr4
);
profile
.
get
()
->
add_nf_ipv4_addresses
(
addr4
);
}
}
}
// ToDo: Check if ipv6 addr present
// ToDo: For ipv6
// if (api_profile.ipv6AddressesIsSet()) {
// std::vector<Ipv6Addr> ipv6_addr = api_profile.getIpv6Addresses();
// for (auto address : ipv6_addr) {
// struct in6_addr addr6 = {};
// unsigned char buf_in_addr[sizeof(struct in6_addr)];
// if (inet_pton(AF_INET6, util::trim(address).c_str(), buf_in_addr) == 1)
// {
// memcpy(&addr6, buf_in_addr, sizeof(struct in6_addr));
// } else {
// Logger::nrf_app().warn(
// "Address conversion: Bad value %s", util::trim(address).c_str());
// }
// Logger::nrf_app().debug("\tIPv6 Addr: %s", address.c_str());
// profile.get()->add_nf_ipv6_addresses(addr6);
// }
// }
nf_type_t
nf_type
=
string_to_nf_type
(
api_profile
.
getNfType
());
nf_type_t
nf_type
=
string_to_nf_type
(
api_profile
.
getNfType
());
...
...
src/nrf_app/nrf_profile.cpp
View file @
53b348bd
...
@@ -229,12 +229,14 @@ void nrf_profile::display() {
...
@@ -229,12 +229,14 @@ void nrf_profile::display() {
for
(
auto
s
:
snssais
)
{
for
(
auto
s
:
snssais
)
{
Logger
::
nrf_app
().
debug
(
"
\t
NNSSAI(SST, SD): %d, %s"
,
s
.
sST
,
s
.
sD
.
c_str
());
Logger
::
nrf_app
().
debug
(
"
\t
NNSSAI(SST, SD): %d, %s"
,
s
.
sST
,
s
.
sD
.
c_str
());
}
}
if
(
!
fqdn
.
empty
())
{
Logger
::
nrf_app
().
debug
(
"
\t
FQDN: %s"
,
fqdn
.
c_str
());
}
// IPv4 Addresses
// IPv4 Addresses
for
(
auto
address
:
ipv4_addresses
)
{
for
(
auto
address
:
ipv4_addresses
)
{
Logger
::
nrf_app
().
debug
(
"
\t
IPv4 Addr: %s"
,
inet_ntoa
(
address
));
Logger
::
nrf_app
().
debug
(
"
\t
IPv4 Addr: %s"
,
inet_ntoa
(
address
));
}
}
// ToDo : For ipv6 addresses
if
(
!
json_data
.
empty
())
{
if
(
!
json_data
.
empty
())
{
Logger
::
nrf_app
().
debug
(
"
\t
Json Data: %s"
,
json_data
.
dump
().
c_str
());
Logger
::
nrf_app
().
debug
(
"
\t
Json Data: %s"
,
json_data
.
dump
().
c_str
());
}
}
...
@@ -405,7 +407,7 @@ bool nrf_profile::add_profile_info(
...
@@ -405,7 +407,7 @@ bool nrf_profile::add_profile_info(
std
::
string
address
=
value
;
std
::
string
address
=
value
;
struct
in6_addr
addr6
=
{};
struct
in6_addr
addr6
=
{};
unsigned
char
buf_in_addr
[
sizeof
(
struct
in6_addr
)];
unsigned
char
buf_in_addr
[
sizeof
(
struct
in6_addr
)];
if
(
inet_pton
(
AF_INET
,
util
::
trim
(
address
).
c_str
(),
buf_in_addr
)
==
1
)
{
if
(
inet_pton
(
AF_INET
6
,
util
::
trim
(
address
).
c_str
(),
buf_in_addr
)
==
1
)
{
memcpy
(
&
addr6
,
buf_in_addr
,
sizeof
(
struct
in6_addr
));
memcpy
(
&
addr6
,
buf_in_addr
,
sizeof
(
struct
in6_addr
));
}
else
{
}
else
{
Logger
::
nrf_app
().
warn
(
Logger
::
nrf_app
().
warn
(
...
...
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