Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
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
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
cpp-libs
libnice
Commits
63f4962c
Commit
63f4962c
authored
Jan 07, 2023
by
Klemens Nanni
Committed by
Olivier Crête
Jan 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ifr_ifindex on Linux
parent
37f1e243
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
agent/interfaces.c
agent/interfaces.c
+11
-2
meson.build
meson.build
+6
-0
No files found.
agent/interfaces.c
View file @
63f4962c
...
...
@@ -373,7 +373,7 @@ get_local_ips_ioctl (gboolean include_loopback)
static
guint
get_local_if_index_by_addr_ioctl
(
NiceAddress
*
addr
)
{
#if
def HAVE_IFR_INDEX
#if
defined(HAVE_IFR_INDEX) || defined(HAVE_IFR_IFINDEX)
gint
sockfd
;
gint
size
=
0
;
struct
ifreq
*
ifr
;
...
...
@@ -417,10 +417,18 @@ get_local_if_index_by_addr_ioctl (NiceAddress *addr)
if
(
!
nice_address_equal_no_port
(
myaddr
,
addr
))
continue
;
#if defined(HAVE_IFR_INDEX)
if
(
ifr
->
ifr_index
==
0
)
#else
if
(
ifr
->
ifr_ifindex
==
0
)
#endif
continue
;
#if defined(HAVE_IFR_INDEX)
if_index
=
ifr
->
ifr_index
;
#else
if_index
=
ifr
->
ifr_ifindex
;
#endif
break
;
}
...
...
@@ -430,7 +438,8 @@ get_local_if_index_by_addr_ioctl (NiceAddress *addr)
return
if_index
;
#else
g_critical
(
"getifaddrs() should not fail on a platform that doesn't"
" include ifr_index in the struct ifreq. Please report the bug."
);
" include ifr_index or ifr_ifindex in the struct ifreq."
" Please report the bug."
);
return
0
;
#endif
}
...
...
meson.build
View file @
63f4962c
...
...
@@ -119,10 +119,16 @@ foreach f : ['poll', 'getifaddrs']
endif
endforeach
# BSD and macOS
if cc.has_member('struct ifreq', 'ifr_index', prefix: '#include <net/if.h>')
cdata.set('HAVE_IFR_INDEX', 1)
endif
# Linux
if cc.has_member('struct ifreq', 'ifr_ifindex', prefix: '#include <net/if.h>')
cdata.set('HAVE_IFR_IFINDEX', 1)
endif
if cc.has_argument('-fno-strict-aliasing')
add_project_arguments('-fno-strict-aliasing', language: 'c')
endif
...
...
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