diff options
author | Tamir Duberstein <tamird@google.com> | 2018-08-31 10:22:06 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-08-31 10:23:32 -0700 |
commit | 625edb9f2864c1b3aebc6b4c9828197131c2e003 (patch) | |
tree | 8c68bfa3f7f43c14a5de0206a2d7e66487dc1ae7 /pkg/tcpip/link/sniffer | |
parent | 08bfb5643c4d4755d0e982e69d2da99449e25c57 (diff) |
ipv6: ICMP support
This CL does NDP link-address discovery for IPv6.
It includes several small changes necessary to get linux to talk to
this implementation. In particular, a hop limit of 255 is necessary
for ICMPv6.
PiperOrigin-RevId: 211103930
Change-Id: If25370ab84c6b1decfb15de917f3b0020f2c4e0e
Diffstat (limited to 'pkg/tcpip/link/sniffer')
-rw-r--r-- | pkg/tcpip/link/sniffer/sniffer.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pkg/tcpip/link/sniffer/sniffer.go b/pkg/tcpip/link/sniffer/sniffer.go index 414a7edb4..1e302f557 100644 --- a/pkg/tcpip/link/sniffer/sniffer.go +++ b/pkg/tcpip/link/sniffer/sniffer.go @@ -303,6 +303,37 @@ func logPacket(prefix string, protocol tcpip.NetworkProtocolNumber, b, plb []byt log.Infof("%s %s %v -> %v %s len:%d id:%04x code:%d", prefix, transName, src, dst, icmpType, size, id, icmp.Code()) return + case header.ICMPv6ProtocolNumber: + transName = "icmp" + icmp := header.ICMPv6(b) + icmpType := "unknown" + switch icmp.Type() { + case header.ICMPv6DstUnreachable: + icmpType = "destination unreachable" + case header.ICMPv6PacketTooBig: + icmpType = "packet too big" + case header.ICMPv6TimeExceeded: + icmpType = "time exceeded" + case header.ICMPv6ParamProblem: + icmpType = "param problem" + case header.ICMPv6EchoRequest: + icmpType = "echo request" + case header.ICMPv6EchoReply: + icmpType = "echo reply" + case header.ICMPv6RouterSolicit: + icmpType = "router solicit" + case header.ICMPv6RouterAdvert: + icmpType = "router advert" + case header.ICMPv6NeighborSolicit: + icmpType = "neighbor solicit" + case header.ICMPv6NeighborAdvert: + icmpType = "neighbor advert" + case header.ICMPv6RedirectMsg: + icmpType = "redirect message" + } + log.Infof("%s %s %v -> %v %s len:%d id:%04x code:%d", prefix, transName, src, dst, icmpType, size, id, icmp.Code()) + return + case header.UDPProtocolNumber: transName = "udp" udp := header.UDP(b) |