Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: #523 #524

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .idea/.gitignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this .idea directory from the commits?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it in later commits, is that enough?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, please rebase the commits.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/socket2.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,37 @@ impl crate::Socket {
}
}

/// Get the value of the `SO_DONTROUTE` option on this socket.
///
/// For more information about this option, see [`set_dont_route`].
///
/// [`set_dont_route`]: crate::Socket::set_dont_route
#[cfg(all(feature = "all", not(target_os = "redox")))]
pub fn dont_route(&self) -> io::Result<bool> {
unsafe {
getsockopt::<c_int>(self.as_raw(), libc::SOL_SOCKET, libc::SO_DONTROUTE)
.map(|reuse| reuse != 0)
}
}

/// Set the value of the `SO_DONTROUTE` option on this socket.
///
/// If set, it instructs the operating system's network stack to bypass the normal
/// routing table for outgoing packets on that socket. Instead of using the routing
/// table to determine the path to the destination, packets are sent directly to
/// the network interface that is connected to the destination network.
#[cfg(all(feature = "all", not(target_os = "redox")))]
pub fn set_dont_route(&self, dont_route: bool) -> io::Result<()> {
unsafe {
setsockopt::<c_int>(
self.as_raw(),
libc::SOL_SOCKET,
libc::SO_DONTROUTE,
dont_route as c_int,
)
}
}
Kleinmarb marked this conversation as resolved.
Show resolved Hide resolved

/// Gets the value of the `TCP_MAXSEG` option on this socket.
///
/// For more information about this option, see [`set_mss`].
Expand Down