Skip to content

Commit

Permalink
fix test break
Browse files Browse the repository at this point in the history
  • Loading branch information
DarienRaymond committed Aug 25, 2017
1 parent 2b9d9e1 commit 5ef1a20
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions transport/internet/tcp/sockopt_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package tcp
import (
"syscall"

"v2ray.com/core/app/log"
v2net "v2ray.com/core/common/net"
"v2ray.com/core/transport/internet"
)
Expand All @@ -21,14 +22,14 @@ func GetOriginalDestination(conn internet.Connection) (v2net.Destination, error)
return v2net.Destination{}, newError("failed to get sys fd").Base(err)
}
var dest v2net.Destination
err := rawConn.Control(func(fd uintptr) {
err = rawConn.Control(func(fd uintptr) {
addr, err := syscall.GetsockoptIPv6Mreq(int(fd), syscall.IPPROTO_IP, SO_ORIGINAL_DST)
if err != nil {
return v2net.Destination{}, newError("failed to call getsockopt").Base(err)
log.Trace(newError("failed to call getsockopt").Base(err))
}
ip := v2net.IPAddress(addr.Multiaddr[4:8])
port := uint16(addr.Multiaddr[2])<<8 + uint16(addr.Multiaddr[3])
addr = v2net.TCPDestination(ip, v2net.Port(port))
dest = v2net.TCPDestination(ip, v2net.Port(port))
})
if err != nil {
return v2net.Destination{}, newError("failed to get original destination").Base(err)
Expand Down

0 comments on commit 5ef1a20

Please sign in to comment.