Showing with 8 additions and 2 deletions.
  1. +1 −1 phantomtcp/proxy.go
  2. +7 −1 phantomtcp/raw.go
2 changes: 1 addition & 1 deletion phantomtcp/proxy.go
Expand Up @@ -310,7 +310,7 @@ func tcp_redirect(client net.Conn, addr *net.TCPAddr, domain string, header []by
if length > 0 {
_domain := string(header[offset : offset+length])
if domain != _domain {
pface = DefaultProfile.GetInterface(domain)
pface = DefaultProfile.GetInterface(_domain)
if pface == nil {
return
}
Expand Down
8 changes: 7 additions & 1 deletion phantomtcp/raw.go
Expand Up @@ -363,7 +363,13 @@ func ModifyAndSendPacket(connInfo *ConnectionInfo, payload []byte, hint uint32,
}
defer f.Close()
fd := int(f.Fd())
err = syscall.SetsockoptInt(fd, syscall.IPPROTO_IP, syscall.IP_TTL, int(ttl))
level := syscall.IPPROTO_IP
name := syscall.IP_TTL
if network == "ip6:tcp" {
level = syscall.IPPROTO_IPV6
name = syscall.IPV6_UNICAST_HOPS
}
err = syscall.SetsockoptInt(fd, level, name, int(ttl))
if err != nil {
return err
}
Expand Down