Skip to content

Commit

Permalink
Merge pull request #61 from detiam/fix_ipv6_raw_ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
macronut committed Aug 25, 2023
2 parents 53b995b + 69f6ec8 commit 7cca681
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion phantomtcp/raw.go
Original file line number Diff line number Diff line change
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

0 comments on commit 7cca681

Please sign in to comment.