Skip to content

How I can enable IP_TRANSPARENT socket option for listener socket? #3702

Answered by Darksonn
alishir asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the setsockopt method in the nix crate for this.

use nix::sys::socket::setsockopt;
use nix::sys::socket::sockopt::IpTransparent;
use std::os::unix::io::AsRawFd;

let listener = ...;
let fd = listener.as_raw_fd();
let res = setsockopt(fd, IpTransparent, &true);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alishir
Comment options

Answer selected by alishir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants