Skip to content

Commit 3954580

Browse files
committed
Add SO_ORIGINAL_DST
1 parent 5fa5fd4 commit 3954580

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/sys/socket/consts.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ mod os {
5959
pub const SO_TIMESTAMP: c_int = 29;
6060
pub const SO_TYPE: c_int = 3;
6161
pub const SO_BUSY_POLL: c_int = 46;
62+
#[cfg(target_os = "linux")]
63+
pub const SO_ORIGINAL_DST: c_int = 80;
6264

6365
// Socket options for TCP sockets
6466
pub const TCP_NODELAY: c_int = 1;

src/sys/socket/sockopt.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use super::{ffi, consts, GetSockOpt, SetSockOpt};
22
use {Errno, Result};
33
use sys::time::TimeVal;
44
use libc::{c_int, uint8_t, c_void, socklen_t};
5+
#[cfg(target_os = "linux")]
6+
use libc::sockaddr_in;
57
use std::mem;
68
use std::os::unix::io::RawFd;
79

@@ -168,6 +170,8 @@ sockopt_impl!(GetOnly, SockType, consts::SOL_SOCKET, consts::SO_TYPE, super::Soc
168170
target_os = "linux",
169171
target_os = "nacl"))]
170172
sockopt_impl!(GetOnly, AcceptConn, consts::SOL_SOCKET, consts::SO_ACCEPTCONN, bool);
173+
#[cfg(target_os = "linux")]
174+
sockopt_impl!(GetOnly, OriginalDst, consts::SOL_IP, consts::SO_ORIGINAL_DST, sockaddr_in);
171175

172176
/*
173177
*

0 commit comments

Comments
 (0)