summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/header/icmpv6.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-08-14 09:11:13 +0000
committergVisor bot <gvisor-bot@google.com>2020-08-14 09:11:13 +0000
commitcbbad8e571bca3ddcd0f1e747d40313992012034 (patch)
tree66cb5fdaf2c9904eaa47ca40cdd78f84f39c9b30 /pkg/tcpip/header/icmpv6.go
parent8d6f3d6f733befc11e19a83be7d005b4337e0e8e (diff)
parent190634e0fcf4cf25a449e1bd39533ca2ddad66e6 (diff)
Merge release-20200810.0-29-g190634e0f (automated)
Diffstat (limited to 'pkg/tcpip/header/icmpv6.go')
-rw-r--r--pkg/tcpip/header/icmpv6.go43
1 files changed, 31 insertions, 12 deletions
diff --git a/pkg/tcpip/header/icmpv6.go b/pkg/tcpip/header/icmpv6.go
index a13b4b809..20b01d8f4 100644
--- a/pkg/tcpip/header/icmpv6.go
+++ b/pkg/tcpip/header/icmpv6.go
@@ -92,7 +92,6 @@ const (
// ICMPv6Type is the ICMP type field described in RFC 4443 and friends.
type ICMPv6Type byte
-// Typical values of ICMPv6Type defined in RFC 4443.
const (
ICMPv6DstUnreachable ICMPv6Type = 1
ICMPv6PacketTooBig ICMPv6Type = 2
@@ -110,18 +109,38 @@ const (
ICMPv6RedirectMsg ICMPv6Type = 137
)
-// Values for ICMP destination unreachable code as defined in RFC 4443 section
-// 3.1.
+// ICMPv6Code is the ICMP code field described in RFC 4443.
+type ICMPv6Code byte
+
+// ICMP codes used with Destination Unreachable (Type 1). As per RFC 4443
+// section 3.1.
+const (
+ ICMPv6NetworkUnreachable ICMPv6Code = 0
+ ICMPv6Prohibited ICMPv6Code = 1
+ ICMPv6BeyondScope ICMPv6Code = 2
+ ICMPv6AddressUnreachable ICMPv6Code = 3
+ ICMPv6PortUnreachable ICMPv6Code = 4
+ ICMPv6Policy ICMPv6Code = 5
+ ICMPv6RejectRoute ICMPv6Code = 6
+)
+
+// ICMP codes used with Time Exceeded (Type 3). As per RFC 4443 section 3.3.
const (
- ICMPv6NetworkUnreachable = 0
- ICMPv6Prohibited = 1
- ICMPv6BeyondScope = 2
- ICMPv6AddressUnreachable = 3
- ICMPv6PortUnreachable = 4
- ICMPv6Policy = 5
- ICMPv6RejectRoute = 6
+ ICMPv6HopLimitExceeded ICMPv6Code = 0
+ ICMPv6ReassemblyTimeout ICMPv6Code = 1
)
+// ICMP codes used with Parameter Problem (Type 4). As per RFC 4443 section 3.4.
+const (
+ ICMPv6ErroneousHeader ICMPv6Code = 0
+ ICMPv6UnknownHeader ICMPv6Code = 1
+ ICMPv6UnknownOption ICMPv6Code = 2
+)
+
+// ICMPv6UnusedCode is the code value used with ICMPv6 messages which don't use
+// the code field. (Types not mentioned above.)
+const ICMPv6UnusedCode ICMPv6Code = 0
+
// Type is the ICMP type field.
func (b ICMPv6) Type() ICMPv6Type { return ICMPv6Type(b[0]) }
@@ -129,10 +148,10 @@ func (b ICMPv6) Type() ICMPv6Type { return ICMPv6Type(b[0]) }
func (b ICMPv6) SetType(t ICMPv6Type) { b[0] = byte(t) }
// Code is the ICMP code field. Its meaning depends on the value of Type.
-func (b ICMPv6) Code() byte { return b[1] }
+func (b ICMPv6) Code() ICMPv6Code { return ICMPv6Code(b[1]) }
// SetCode sets the ICMP code field.
-func (b ICMPv6) SetCode(c byte) { b[1] = c }
+func (b ICMPv6) SetCode(c ICMPv6Code) { b[1] = byte(c) }
// Checksum is the ICMP checksum field.
func (b ICMPv6) Checksum() uint16 {