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-Simple
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
CommunityXG
OpenXG-SMF-Simple
Commits
94f86e2d
Commit
94f86e2d
authored
Mar 09, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue for PDU Address Information
parent
e3362e99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
23 deletions
+10
-23
src/common/utils/string.cpp
src/common/utils/string.cpp
+9
-21
src/common/utils/string.hpp
src/common/utils/string.hpp
+0
-2
src/smf_app/smf_paa_dynamic.hpp
src/smf_app/smf_paa_dynamic.hpp
+1
-0
No files found.
src/common/utils/string.cpp
View file @
94f86e2d
...
...
@@ -110,31 +110,19 @@ void util::ipv6_to_bstring(struct in6_addr ipv6_address, bstring str) {
void
util
::
ipv4v6_to_bstring
(
struct
in_addr
ipv4_address
,
struct
in6_addr
ipv6_address
,
bstring
str
)
{
unsigned
char
bitstream_addr
[
12
];
bitstream_addr
[
0
]
=
(
uint8_t
)((
ipv4_address
.
s_addr
)
&
0x000000ff
);
bitstream_addr
[
1
]
=
(
uint8_t
)(((
ipv4_address
.
s_addr
)
&
0x0000ff00
)
>>
8
);
bitstream_addr
[
2
]
=
(
uint8_t
)(((
ipv4_address
.
s_addr
)
&
0x00ff0000
)
>>
16
);
bitstream_addr
[
3
]
=
(
uint8_t
)(((
ipv4_address
.
s_addr
)
&
0xff000000
)
>>
24
);
for
(
int
i
=
0
;
i
<=
7
;
i
++
)
bitstream_addr
[
i
+
4
]
=
(
uint8_t
)(
ipv6_address
.
s6_addr16
[
i
]);
str
->
slen
=
12
;
memcpy
(
str
->
data
,
bitstream_addr
,
sizeof
(
bitstream_addr
));
}
void
util
::
ipv4v6_to_bstring
(
struct
in_addr
ipv4_address
,
std
::
string
ipv6_address
,
bstring
str
)
{
unsigned
char
bitstream_addr
[
12
];
bitstream_addr
[
0
]
=
(
uint8_t
)((
ipv4_address
.
s_addr
)
&
0x000000ff
);
bitstream_addr
[
1
]
=
(
uint8_t
)(((
ipv4_address
.
s_addr
)
&
0x0000ff00
)
>>
8
);
bitstream_addr
[
2
]
=
(
uint8_t
)(((
ipv4_address
.
s_addr
)
&
0x00ff0000
)
>>
16
);
bitstream_addr
[
3
]
=
(
uint8_t
)(((
ipv4_address
.
s_addr
)
&
0xff000000
)
>>
24
);
std
::
string
ipv6_addr
=
"2001:4860:4860::2"
;
// TODO: to be updated to remove the hardcoded value
std
::
string
ipv6_addr
=
"2001:4860:4860:0:0:0:0:2"
;
unsigned
char
buf_in6_addr
[
sizeof
(
struct
in6_addr
)];
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
ipv6_addr
).
c_str
(),
buf_in6_addr
)
==
1
)
{
// memcpy(&p, buf_in6_addr, sizeof(struct in6_addr));
for
(
int
i
=
0
;
i
<=
7
;
i
++
)
bitstream_addr
[
i
+
4
]
=
(
uint8_t
)(
buf_in6_addr
[
i
]);
for
(
int
i
=
0
;
i
<=
7
;
i
++
)
bitstream_addr
[
i
]
=
(
uint8_t
)(
buf_in6_addr
[
i
]);
}
bitstream_addr
[
8
]
=
(
uint8_t
)((
ipv4_address
.
s_addr
)
&
0x000000ff
);
bitstream_addr
[
9
]
=
(
uint8_t
)(((
ipv4_address
.
s_addr
)
&
0x0000ff00
)
>>
8
);
bitstream_addr
[
10
]
=
(
uint8_t
)(((
ipv4_address
.
s_addr
)
&
0x00ff0000
)
>>
16
);
bitstream_addr
[
11
]
=
(
uint8_t
)(((
ipv4_address
.
s_addr
)
&
0xff000000
)
>>
24
);
str
->
slen
=
12
;
memcpy
(
str
->
data
,
bitstream_addr
,
sizeof
(
bitstream_addr
));
}
...
...
src/common/utils/string.hpp
View file @
94f86e2d
...
...
@@ -49,8 +49,6 @@ void ipv4_to_bstring(struct in_addr ipv4_address, bstring str);
void
ipv6_to_bstring
(
struct
in6_addr
ipv6_address
,
bstring
str
);
void
ipv4v6_to_bstring
(
struct
in_addr
ipv4_address
,
struct
in6_addr
ipv6_address
,
bstring
str
);
void
ipv4v6_to_bstring
(
struct
in_addr
ipv4_address
,
std
::
string
ipv6_address
,
bstring
str
);
void
string_to_bstring
(
const
std
::
string
&
str
,
bstring
bstr
);
}
// namespace util
...
...
src/smf_app/smf_paa_dynamic.hpp
View file @
94f86e2d
...
...
@@ -249,6 +249,7 @@ class paa_dynamic {
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
ipv6_addr
).
c_str
(),
buf_in6_addr
)
==
1
)
{
memcpy
(
&
paa
.
ipv6_address
,
buf_in6_addr
,
sizeof
(
struct
in6_addr
));
return
true
;
}
}
Logger
::
smf_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