From 39545809e40f335d3d79e8832a6d255d8d27b45f Mon Sep 17 00:00:00 2001 From: Justin Latimer Date: Fri, 29 Apr 2016 03:54:50 +0000 Subject: [PATCH] Add SO_ORIGINAL_DST --- src/sys/socket/consts.rs | 2 ++ src/sys/socket/sockopt.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs index ddd8f6a956..aeeea5c3fe 100644 --- a/src/sys/socket/consts.rs +++ b/src/sys/socket/consts.rs @@ -59,6 +59,8 @@ mod os { pub const SO_TIMESTAMP: c_int = 29; pub const SO_TYPE: c_int = 3; pub const SO_BUSY_POLL: c_int = 46; + #[cfg(target_os = "linux")] + pub const SO_ORIGINAL_DST: c_int = 80; // Socket options for TCP sockets pub const TCP_NODELAY: c_int = 1; diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 17de2d279e..8f30d628c3 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -2,6 +2,8 @@ use super::{ffi, consts, GetSockOpt, SetSockOpt}; use {Errno, Result}; use sys::time::TimeVal; use libc::{c_int, uint8_t, c_void, socklen_t}; +#[cfg(target_os = "linux")] +use libc::sockaddr_in; use std::mem; use std::os::unix::io::RawFd; @@ -168,6 +170,8 @@ sockopt_impl!(GetOnly, SockType, consts::SOL_SOCKET, consts::SO_TYPE, super::Soc target_os = "linux", target_os = "nacl"))] sockopt_impl!(GetOnly, AcceptConn, consts::SOL_SOCKET, consts::SO_ACCEPTCONN, bool); +#[cfg(target_os = "linux")] +sockopt_impl!(GetOnly, OriginalDst, consts::SOL_IP, consts::SO_ORIGINAL_DST, sockaddr_in); /* *