mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
gstreamer: ptp-helper: Use c_ulong
for ifa_flags
on Solaris/Illumos
Based on a patch by Marcel Telka <marcel@telka.sk>. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3553 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6947>
This commit is contained in:
parent
895ee6f72e
commit
c97ec122d9
2 changed files with 23 additions and 11 deletions
|
@ -220,13 +220,25 @@ pub mod unix {
|
|||
#[cfg(target_os = "linux")]
|
||||
pub const AF_PACKET: c_int = 17;
|
||||
|
||||
pub const IFF_UP: c_int = 0x1;
|
||||
pub const IFF_LOOPBACK: c_int = 0x8;
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "macos",
|
||||
))]
|
||||
pub type IfaFlags = c_uint;
|
||||
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
|
||||
pub type IfaFlags = c_ulong;
|
||||
|
||||
pub const IFF_UP: IfaFlags = 0x1;
|
||||
pub const IFF_LOOPBACK: IfaFlags = 0x8;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const IFF_MULTICAST: c_int = 0x1000;
|
||||
pub const IFF_MULTICAST: IfaFlags = 0x1000;
|
||||
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
|
||||
pub const IFF_MULTICAST: ::c_int = 0x0800;
|
||||
pub const IFF_MULTICAST: IfaFlags = 0x0800;
|
||||
#[cfg(any(
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
|
@ -234,7 +246,7 @@ pub mod unix {
|
|||
target_os = "dragonfly",
|
||||
target_os = "macos",
|
||||
))]
|
||||
pub const IFF_MULTICAST: c_int = 0x08000;
|
||||
pub const IFF_MULTICAST: IfaFlags = 0x08000;
|
||||
|
||||
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
|
||||
pub const IF_NAMESIZE: usize = 32;
|
||||
|
@ -342,7 +354,7 @@ pub mod unix {
|
|||
pub struct ifaddrs {
|
||||
pub ifa_next: *mut ifaddrs,
|
||||
pub ifa_name: *mut c_char,
|
||||
pub ifa_flags: c_ulong,
|
||||
pub ifa_flags: IfaFlags,
|
||||
pub ifa_addr: *mut sockaddr,
|
||||
pub ifa_netmask: *mut sockaddr,
|
||||
pub ifa_dstaddr: *mut sockaddr,
|
||||
|
@ -354,7 +366,7 @@ pub mod unix {
|
|||
pub struct ifaddrs {
|
||||
pub ifa_next: *mut ifaddrs,
|
||||
pub ifa_name: *mut c_char,
|
||||
pub ifa_flags: c_uint,
|
||||
pub ifa_flags: IfaFlags,
|
||||
pub ifa_addr: *mut sockaddr,
|
||||
pub ifa_netmask: *mut sockaddr,
|
||||
pub ifa_ifu: *mut sockaddr,
|
||||
|
@ -372,7 +384,7 @@ pub mod unix {
|
|||
pub struct ifaddrs {
|
||||
pub ifa_next: *mut ifaddrs,
|
||||
pub ifa_name: *mut c_char,
|
||||
pub ifa_flags: c_uint,
|
||||
pub ifa_flags: IfaFlags,
|
||||
pub ifa_addr: *mut sockaddr,
|
||||
pub ifa_netmask: *mut sockaddr,
|
||||
pub ifa_dstaddr: *mut sockaddr,
|
||||
|
|
|
@ -116,15 +116,15 @@ mod imp {
|
|||
// Skip loopback interfaces, interfaces that are not up and interfaces that can't do
|
||||
// multicast. These are all unusable for PTP purposes.
|
||||
let flags = ifaddr.ifa_flags;
|
||||
if flags & IFF_LOOPBACK as u32 != 0 {
|
||||
if flags & IFF_LOOPBACK != 0 {
|
||||
debug!("Interface {} is loopback interface", name);
|
||||
continue;
|
||||
}
|
||||
if flags & IFF_UP as u32 == 0 {
|
||||
if flags & IFF_UP == 0 {
|
||||
debug!("Interface {} is not up", name);
|
||||
continue;
|
||||
}
|
||||
if flags & IFF_MULTICAST as u32 == 0 {
|
||||
if flags & IFF_MULTICAST == 0 {
|
||||
debug!("Interface {} does not support multicast", name);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue