Skip to content

Commit

Permalink
Add additional Linux AF_PACKET options
Browse files Browse the repository at this point in the history
  • Loading branch information
nathaniel-bennett committed Mar 11, 2024
1 parent ba73a3e commit d0e72e9
Show file tree
Hide file tree
Showing 3 changed files with 322 additions and 1 deletion.
19 changes: 18 additions & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3384,7 +3384,6 @@ fn test_linux(target: &str) {
"netinet/ip.h",
"netinet/tcp.h",
"netinet/udp.h",
"netpacket/packet.h",
"poll.h",
"pthread.h",
"pty.h",
Expand Down Expand Up @@ -3486,6 +3485,7 @@ fn test_linux(target: &str) {
"linux/if_addr.h",
"linux/if_alg.h",
"linux/if_ether.h",
"linux/if_packet.h",
"linux/if_tun.h",
"linux/if_xdp.h",
"linux/input.h",
Expand Down Expand Up @@ -3666,6 +3666,23 @@ fn test_linux(target: &str) {
if (gnu && sparc64) && (ty == "ip_mreqn" || ty == "hwtstamp_config") {
return true;
}
// FIXME: pass by value for structs that are not an even 32/64 bits on
// big-endian systems corrupts the value for unknown reasons.
if (sparc64 || ppc || ppc64 || s390x)
&& (ty == "sockaddr_pkt"
|| ty == "tpacket_auxdata"
|| ty == "tpacket_hdr_variant1"
|| ty == "tpacket_req3"
|| ty == "tpacket_stats_v3"
|| ty == "tpacket_req_u")
{
return true;
}
// FIXME: musl doesn't compile with `struct fanout_args` for unknown reasons.
if musl && ty == "fanout_args" {
return true;
}

match ty {
// These cannot be tested when "resolv.h" is included and are tested
// in the `linux_elf.rs` file.
Expand Down
62 changes: 62 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1801,11 +1801,38 @@ O_RSYNC
O_SYNC
O_TMPFILE
PACKET_ADD_MEMBERSHIP
PACKET_AUXDATA
PACKET_BROADCAST
PACKET_DROP_MEMBERSHIP
PACKET_FANOUT
PACKET_FANOUT_CBPF
PACKET_FANOUT_CPU
PACKET_FANOUT_FLAG_DEFRAG
PACKET_FANOUT_FLAG_ROLLOVER
PACKET_FANOUT_FLAG_UNIQUEID
PACKET_FANOUT_HASH
PACKET_FANOUT_LB
PACKET_FANOUT_QM
PACKET_FANOUT_RND
PACKET_FANOUT_ROLLOVER
PACKET_HOST
PACKET_KERNEL
PACKET_LOOPBACK
PACKET_LOSS
PACKET_MR_ALLMULTI
PACKET_MR_MULTICAST
PACKET_MR_PROMISC
PACKET_MR_UNICAST
PACKET_MULTICAST
PACKET_OTHERHOST
PACKET_OUTGOING
PACKET_QDISC_BYPASS
PACKET_RESERVE
PACKET_RX_RING
PACKET_STATISTICS
PACKET_TIMESTAMP
PACKET_USER
PACKET_VERSION
PENDIN
PF_ALG
PF_APPLETALK
Expand Down Expand Up @@ -3190,6 +3217,23 @@ TLS_GET_RECORD_TYPE
TLS_RX
TLS_SET_RECORD_TYPE
TLS_TX
TP_FT_REQ_FILL_RXHASH
TP_STATUS_AVAILABLE
TP_STATUS_BLK_TMO
TP_STATUS_COPY
TP_STATUS_CSUMNOTREADY
TP_STATUS_CSUM_VALID
TP_STATUS_KERNEL
TP_STATUS_LOSING
TP_STATUS_SENDING
TP_STATUS_SEND_REQUEST
TP_STATUS_TS_RAW_HARDWARE
TP_STATUS_TS_SOFTWARE
TP_STATUS_TS_SYS_HARDWARE
TP_STATUS_USER
TP_STATUS_VLAN_TPID_VALID
TP_STATUS_VLAN_VALID
TP_STATUS_WRONG_FORMAT
TUN_READQ_SIZE
TUN_TAP_DEV
TUN_TUN_DEV
Expand Down Expand Up @@ -3452,6 +3496,7 @@ fanotify_event_metadata
fanotify_init
fanotify_mark
fanotify_response
fanout_args
fchdir
fdatasync
fdopendir
Expand Down Expand Up @@ -3819,6 +3864,7 @@ sockaddr_alg
sockaddr_can
sockaddr_ll
sockaddr_nl
sockaddr_pkt
sockaddr_vm
splice
spwd
Expand Down Expand Up @@ -3853,6 +3899,22 @@ timer_getoverrun
timer_gettime
timer_settime
tmpfile64
tpacket2_hdr
tpacket3_hdr
tpacket_auxdata
tpacket_bd_header_u
tpacket_bd_ts
tpacket_block_desc
tpacket_hdr
tpacket_hdr_v1
tpacket_hdr_variant1
tpacket_req
tpacket_req3
tpacket_req_u
tpacket_rollover_stats
tpacket_stats
tpacket_stats_v3
tpacket_versions
truncate
truncate64
ttyname_r
Expand Down
Loading

0 comments on commit d0e72e9

Please sign in to comment.