diff options
author | Tamir Duberstein <tamird@google.com> | 2021-03-02 11:55:45 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-02 11:58:12 -0800 |
commit | 6bc27946a6cb159ecbe049acff888d0041d4a432 (patch) | |
tree | 6d0c7922e82cc9a8818132ab3b3fb902696a18d9 /pkg/tcpip/stack/route.go | |
parent | 865ca64ee8c0af9eba88a4a04e0730630fae6d8b (diff) |
Plumb link address request errors up to requester
Prevent the situation where callers to (*stack).GetLinkAddress provide
incorrect arguments and are unable to observe this condition.
Updates #5583.
PiperOrigin-RevId: 360481557
Diffstat (limited to 'pkg/tcpip/stack/route.go')
-rw-r--r-- | pkg/tcpip/stack/route.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/tcpip/stack/route.go b/pkg/tcpip/stack/route.go index e946f9fe3..4ba6794a0 100644 --- a/pkg/tcpip/stack/route.go +++ b/pkg/tcpip/stack/route.go @@ -318,7 +318,7 @@ func (r *Route) ResolveWith(addr tcpip.LinkAddress) { // ResolvedFieldsResult is the result of a route resolution attempt. type ResolvedFieldsResult struct { RouteInfo RouteInfo - Success bool + Err tcpip.Error } // ResolvedFields attempts to resolve the remote link address if it is not @@ -349,7 +349,7 @@ func (r *Route) resolvedFields(afterResolve func(ResolvedFieldsResult)) (RouteIn r.mu.RUnlock() if !resolutionRequired { if afterResolve != nil { - afterResolve(ResolvedFieldsResult{RouteInfo: fields, Success: true}) + afterResolve(ResolvedFieldsResult{RouteInfo: fields, Err: nil}) } return fields, nil, nil } @@ -364,11 +364,11 @@ func (r *Route) resolvedFields(afterResolve func(ResolvedFieldsResult)) (RouteIn afterResolveFields := fields linkAddr, ch, err := r.linkRes.getNeighborLinkAddress(r.nextHop(), linkAddressResolutionRequestLocalAddr, func(r LinkResolutionResult) { if afterResolve != nil { - if r.Success { + if r.Err == nil { afterResolveFields.RemoteLinkAddress = r.LinkAddress } - afterResolve(ResolvedFieldsResult{RouteInfo: afterResolveFields, Success: r.Success}) + afterResolve(ResolvedFieldsResult{RouteInfo: afterResolveFields, Err: r.Err}) } }) if err == nil { |