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
4c4a820c
Commit
4c4a820c
authored
Oct 12, 2019
by
dukl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug: sx network(0.0.0.0)
parent
23abe818
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
src/common/utils/if.cpp
src/common/utils/if.cpp
+4
-2
No files found.
src/common/utils/if.cpp
View file @
4c4a820c
...
...
@@ -160,7 +160,8 @@ int get_inet_addr_from_iface(const std::string& if_name, struct in_addr& inet_ad
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
int
fd
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
);
ifr
.
ifr_addr
.
sa_family
=
AF_INET
;
strncpy
(
ifr
.
ifr_name
,
(
const
char
*
)
if_name
.
c_str
(),
IFNAMSIZ
-
1
);
//strncpy(ifr.ifr_name, (const char *)if_name.c_str(), IFNAMSIZ-1);
strcpy
(
ifr
.
ifr_name
,(
const
char
*
)
if_name
.
c_str
());
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
&
ifr
))
{
close
(
fd
);
Logger
::
system
().
error
(
"Failed to probe %s inet addr: error %s
\n
"
,
if_name
.
c_str
(),
strerror
(
errno
));
...
...
@@ -205,7 +206,8 @@ int get_inet_addr_infos_from_iface(const std::string& if_name, struct in_addr& i
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
int
fd
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
);
ifr
.
ifr_addr
.
sa_family
=
AF_INET
;
strncpy
(
ifr
.
ifr_name
,
(
const
char
*
)
if_name
.
c_str
(),
IFNAMSIZ
-
1
);
//strncpy(ifr.ifr_name, (const char *)if_name.c_str(), IFNAMSIZ-1);
strcpy
(
ifr
.
ifr_name
,(
const
char
*
)
if_name
.
c_str
());
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
&
ifr
))
{
close
(
fd
);
Logger
::
system
().
error
(
"Failed to probe %s inet addr: error %s
\n
"
,
if_name
.
c_str
(),
strerror
(
errno
));
...
...
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