diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-09-27 02:27:53 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-27 02:27:53 +0000 |
commit | 9177d7067f52b594767f6bf9e1b041ecd7c0d37e (patch) | |
tree | 957a0f8a7dc101e75a81cd3d825f63431c8a0545 /pkg/tcpip/network/ipv6 | |
parent | 204ecb2a5c047371257eafcbeff7400cd22a4bc3 (diff) | |
parent | a376a0baf362506549fcc58861465fa89ed33f7f (diff) |
Merge release-20200921.0-52-ga376a0baf (automated)
Diffstat (limited to 'pkg/tcpip/network/ipv6')
-rw-r--r-- | pkg/tcpip/network/ipv6/icmp.go | 10 | ||||
-rw-r--r-- | pkg/tcpip/network/ipv6/ipv6.go | 13 |
2 files changed, 12 insertions, 11 deletions
diff --git a/pkg/tcpip/network/ipv6/icmp.go b/pkg/tcpip/network/ipv6/icmp.go index 072c8ccd7..dd3295b31 100644 --- a/pkg/tcpip/network/ipv6/icmp.go +++ b/pkg/tcpip/network/ipv6/icmp.go @@ -671,16 +671,6 @@ func (*protocol) ResolveStaticAddress(addr tcpip.Address) (tcpip.LinkAddress, bo // ======= ICMP Error packet generation ========= -// ReturnError implements stack.TransportProtocol.ReturnError. -func (p *protocol) ReturnError(r *stack.Route, reason tcpip.ICMPReason, pkt *stack.PacketBuffer) *tcpip.Error { - switch reason.(type) { - case *tcpip.ICMPReasonPortUnreachable: - return returnError(r, &icmpReasonPortUnreachable{}, pkt) - default: - return tcpip.ErrNotSupported - } -} - // icmpReason is a marker interface for IPv6 specific ICMP errors. type icmpReason interface { isICMPReason() diff --git a/pkg/tcpip/network/ipv6/ipv6.go b/pkg/tcpip/network/ipv6/ipv6.go index 5b1cca180..3d070ddea 100644 --- a/pkg/tcpip/network/ipv6/ipv6.go +++ b/pkg/tcpip/network/ipv6/ipv6.go @@ -482,7 +482,18 @@ func (e *endpoint) HandlePacket(r *stack.Route, pkt *stack.PacketBuffer) { r.Stats().IP.PacketsDelivered.Increment() // TODO(b/152019344): Send an ICMPv6 Parameter Problem, Code 1 error // in response to unrecognized next header values. - e.dispatcher.DeliverTransportPacket(r, p, pkt) + switch res := e.dispatcher.DeliverTransportPacket(r, p, pkt); res { + case stack.TransportPacketHandled: + case stack.TransportPacketDestinationPortUnreachable: + // As per RFC 4443 section 3.1: + // A destination node SHOULD originate a Destination Unreachable + // message with Code 4 in response to a packet for which the + // transport protocol (e.g., UDP) has no listener, if that transport + // protocol has no alternative means to inform the sender. + _ = returnError(r, &icmpReasonPortUnreachable{}, pkt) + default: + panic(fmt.Sprintf("unrecognized result from DeliverTransportPacket = %d", res)) + } } default: |