Skip to content

Commit 5940300

Browse files
authored
feat: add socket option IP_TOS/IPV6_TCLASS on Android/FreeBSD (#2464)
* feat: add socket option IP_TOS/IPV6_TCLASS on Android/FreeBSD * chore: changelog entry[skip ci]
1 parent 50e4283 commit 5940300

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

changelog/2464.added.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add socket option IP_TOS (nix::sys::socket::sockopt::IpTos) IPV6_TCLASS (nix::sys::socket::sockopt::Ipv6TClass) on Android/FreeBSD

src/sys/socket/sockopt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ sockopt_impl!(
402402
libc::SO_PRIORITY,
403403
libc::c_int
404404
);
405-
#[cfg(target_os = "linux")]
405+
#[cfg(any(linux_android, target_os = "freebsd"))]
406406
#[cfg(feature = "net")]
407407
sockopt_impl!(
408408
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
@@ -414,7 +414,7 @@ sockopt_impl!(
414414
libc::IP_TOS,
415415
libc::c_int
416416
);
417-
#[cfg(target_os = "linux")]
417+
#[cfg(any(linux_android, target_os = "freebsd"))]
418418
#[cfg(feature = "net")]
419419
sockopt_impl!(
420420
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]

test/sys/test_sockopt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ fn test_so_priority() {
469469
}
470470

471471
#[test]
472-
#[cfg(target_os = "linux")]
472+
#[cfg(any(linux_android, target_os = "freebsd"))]
473473
fn test_ip_tos() {
474474
let fd = socket(
475475
AddressFamily::Inet,
@@ -484,7 +484,7 @@ fn test_ip_tos() {
484484
}
485485

486486
#[test]
487-
#[cfg(target_os = "linux")]
487+
#[cfg(any(linux_android, target_os = "freebsd"))]
488488
// Disable the test under emulation because it fails in Cirrus-CI. Lack
489489
// of QEMU support is suspected.
490490
#[cfg_attr(qemu, ignore)]

0 commit comments

Comments
 (0)