New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ipv6 header was stripped from the ip packets in packetConn read apis #40143
Comments
Can you please provide some sample code. Thank you. |
@davecheney added |
Go is only giving you what the operating system network stack is giving you. Here is the relevant code: Here, package When you call Based on this, it is my understanding that none of the Go code in your call stack strips IPv6 headers away. A C program which calls |
@yusong0926 could you describe a little more what you mean by IPv6 header? Do you mean the ethernet frame data? |
@yusong0926 L2/L3 headers are only accessible through raw sockets, you'll need to make syscalls to get them, as explained in https://css.bz/2016/12/08/go-raw-sockets.html |
Closing, answered. Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only. For asking questions, see:
|
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
tried all apis (ipConn, icmp packetConn), couldn't get ip header from the ip packets especially for ipv6 using read or readFrom api.
func main() {
conn, err := icmp.ListenPacket("ip6:ipv6-icmp", "::")
if err != nil {
log.Fatal(err)
}
}
What did you expect to see?
read ipv6 header and read hopLimit or ttl from ip header for icmp packets.
What did you see instead?
ipv6 header was stripped. Read or readfrom only receive ip payload.
The text was updated successfully, but these errors were encountered: