Skip to content

Commit

Permalink
Auto merge of rust-lang#2791 - openqrnch:macos-rawsock, r=Amanieu
Browse files Browse the repository at this point in the history
Macos rawsock

Add some types needed for raw socket access on macos.
  • Loading branch information
bors committed May 24, 2022
2 parents 91e6aa5 + adb6cae commit 7c67179
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,13 @@ fn test_apple(target: &str) {
"mach/thread_policy.h",
"malloc/malloc.h",
"net/bpf.h",
"net/dlil.h",
"net/if.h",
"net/if_arp.h",
"net/if_dl.h",
"net/if_utun.h",
"net/if_var.h",
"net/ndrv.h",
"net/route.h",
"netdb.h",
"netinet/if_ether.h",
Expand All @@ -236,6 +239,7 @@ fn test_apple(target: &str) {
"stdlib.h",
"string.h",
"sysdir.h",
"sys/appleapiopts.h",
"sys/attr.h",
"sys/clonefile.h",
"sys/event.h",
Expand Down
9 changes: 9 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,13 @@ s! {
pub s_addr: ::in_addr_t,
}

// net/ndrv.h
pub struct sockaddr_ndrv {
pub snd_len: ::c_uchar,
pub snd_family: ::c_uchar,
pub snd_name: [::c_uchar; 16] // IFNAMSIZ from if.h
}

// sys/socket.h

pub struct sa_endpoints_t {
Expand Down Expand Up @@ -3466,6 +3473,7 @@ pub const pseudo_AF_RTIP: ::c_int = 22;
pub const AF_IPX: ::c_int = 23;
pub const AF_SIP: ::c_int = 24;
pub const pseudo_AF_PIP: ::c_int = 25;
pub const AF_NDRV: ::c_int = 27;
pub const AF_ISDN: ::c_int = 28;
pub const AF_E164: ::c_int = AF_ISDN;
pub const pseudo_AF_KEY: ::c_int = 29;
Expand Down Expand Up @@ -3508,6 +3516,7 @@ pub const PF_SIP: ::c_int = AF_SIP;
pub const PF_IPX: ::c_int = AF_IPX;
pub const PF_RTIP: ::c_int = pseudo_AF_RTIP;
pub const PF_PIP: ::c_int = pseudo_AF_PIP;
pub const PF_NDRV: ::c_int = AF_NDRV;
pub const PF_ISDN: ::c_int = AF_ISDN;
pub const PF_KEY: ::c_int = pseudo_AF_KEY;
pub const PF_INET6: ::c_int = AF_INET6;
Expand Down

0 comments on commit 7c67179

Please sign in to comment.