diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-05-19 19:17:55 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-05-19 19:17:55 +0000 |
commit | bd7eb2c99ba9be168231e6b973df2b2bcd5ebc9e (patch) | |
tree | 79acf938df0a4447947934df1f8f9b2c41884464 /pkg/tcpip/network/ipv4/ipv4.go | |
parent | 10a71e09e5c1909dddda921a4fc6ba00cd33e6d9 (diff) | |
parent | b8b43f70c898861a6fd642ded069dd33d35f17f9 (diff) |
Merge release-20210510.0-62-gb8b43f70c (automated)
Diffstat (limited to 'pkg/tcpip/network/ipv4/ipv4.go')
-rw-r--r-- | pkg/tcpip/network/ipv4/ipv4.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/tcpip/network/ipv4/ipv4.go b/pkg/tcpip/network/ipv4/ipv4.go index 23178277a..26fb8a871 100644 --- a/pkg/tcpip/network/ipv4/ipv4.go +++ b/pkg/tcpip/network/ipv4/ipv4.go @@ -104,6 +104,16 @@ type endpoint struct { // HandleLinkResolutionFailure implements stack.LinkResolvableNetworkEndpoint. func (e *endpoint) HandleLinkResolutionFailure(pkt *stack.PacketBuffer) { + // If we are operating as a router, return an ICMP error to the original + // packet's sender. + if pkt.NetworkPacketInfo.IsForwardedPacket { + // TODO(gvisor.dev/issue/6005): Propagate asynchronously generated ICMP + // errors to local endpoints. + e.protocol.returnError(&icmpReasonHostUnreachable{}, pkt) + e.stats.ip.Forwarding.Errors.Increment() + e.stats.ip.Forwarding.HostUnreachable.Increment() + return + } // handleControl expects the entire offending packet to be in the packet // buffer's data field. pkt = stack.NewPacketBuffer(stack.PacketBufferOptions{ |