diff --git a/changelog/2465.changed.md b/changelog/2465.changed.md new file mode 100644 index 0000000000..e8d1bbb796 --- /dev/null +++ b/changelog/2465.changed.md @@ -0,0 +1 @@ +Socket option `IpTos` has been renamed to `Ipv4Tos`, the old symbol is deprecated since 0.30.0 \ No newline at end of file diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 7a88cff2d7..7917e58d72 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -44,6 +44,7 @@ const TCP_CA_NAME_MAX: usize = 16; /// `bool`, `SetUsize` for `usize`, etc.). macro_rules! setsockopt_impl { ($name:ident, $level:expr, $flag:path, $ty:ty, $setter:ty) => { + #[allow(deprecated)] // to allow we have deprecated socket option impl SetSockOpt for $name { type Val = $ty; @@ -89,6 +90,7 @@ macro_rules! setsockopt_impl { /// `bool`, `GetUsize` for `usize`, etc.). macro_rules! getsockopt_impl { ($name:ident, $level:expr, $flag:path, $ty:ty, $getter:ty) => { + #[allow(deprecated)] // to allow we have deprecated socket option impl GetSockOpt for $name { type Val = $ty; @@ -404,6 +406,19 @@ sockopt_impl!( ); #[cfg(any(linux_android, target_os = "freebsd"))] #[cfg(feature = "net")] +sockopt_impl!( + #[deprecated(since = "0.30.0", note = "Use Ipv4Tos instead")] + #[cfg_attr(docsrs, doc(cfg(feature = "net")))] + /// Set or receive the Type-Of-Service (TOS) field that is + /// sent with every IP packet originating from this socket + IpTos, + Both, + libc::IPPROTO_IP, + libc::IP_TOS, + libc::c_int +); +#[cfg(any(linux_android, target_os = "freebsd"))] +#[cfg(feature = "net")] sockopt_impl!( #[cfg_attr(docsrs, doc(cfg(feature = "net")))] /// Set or receive the Type-Of-Service (TOS) field that is