You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but i think it should match ipv6.ICMPTypeEchoReply, if i change
switch rm.Type {
case ipv6.ICMPTypeEchoReply:
log.Printf("got reflection from %v", peer)
default:
log.Printf("got %+v; want echo reply", rm)
}
to
switch rm.Type {
case ipv6.ICMPTypeEchoRequest:
log.Printf("got reflection from %v", peer)
default:
log.Printf("got %+v; want echo reply", rm)
}
default is not be matched, i thinks it wrong?
What did you see instead?
The text was updated successfully, but these errors were encountered:
odeke-em
changed the title
https://godoc.org/golang.org/x/net/icmp#example-PacketConn--NonPrivilegedPing example is wrong
x/net/icmp: PacketConn.NonPrivilegedPing example is wrong
Apr 3, 2019
Thank you for the report @labulaka521 and welcome to the Go project!
To me, yes in deed, it doesn't look correct that we expect from our sender a packet of type of ipv6.ICMPTypeEchoReply yet they sent a ipv6.ICMPTypeEchoRequest
odeke-em
changed the title
x/net/icmp: PacketConn.NonPrivilegedPing example is wrong
x/net/icmp: PacketConn.NonPrivilegedPing example is not correct in final expectation
Apr 3, 2019
I believe that you modified and ran the example on your node, so your modification is the key because fe80::1 is assigned to only loopback interfaces on darwin by default.
Please be informed that IPv6 multicast packet delivery via loopback interface depends on each implementation. Some might send back the original packet and ICMP never touches the packet because "loopback interface is just for the sake of maintenance and handling unicast/anycast packets is enough for the purpose." FWIW, you can control the multicast loopback by using icmp.PacektConn.IPv6PacketConn.
Please try the example w/ non-loopback links. If you have a better example, not a dumb unicast one, because we already have two unicast ICMP examples in ipv4 and ipv6 packages, feel free to send a CL. Thanks.
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?
What did you expect to see?
output
in this case , it match
default
option in last,but i think it should match
ipv6.ICMPTypeEchoReply
, if i changeto
default
is not be matched, i thinks it wrong?What did you see instead?
The text was updated successfully, but these errors were encountered: