summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/linkaddrcache_test.go
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2021-01-13 16:02:26 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-13 16:04:33 -0800
commit25b5ec7135a6de80674ac1ad4d2289c29e156f42 (patch)
tree5939fd3fd2e4afb2de9c4062cfd9066c544ab46e /pkg/tcpip/stack/linkaddrcache_test.go
parent1efe0ebc5973ec8a06b881c087dae2183898504b (diff)
Do not resolve remote link address at transport layer
Link address resolution is performed at the link layer (if required) so we can defer it from the transport layer. When link resolution is required, packets will be queued and sent once link resolution completes. If link resolution fails, the transport layer will receive a control message indicating that the stack failed to route the packet. tcpip.Endpoint.Write no longer returns a channel now that writes do not wait for link resolution at the transport layer. tcpip.ErrNoLinkAddress is no longer used so it is removed. Removed calls to stack.Route.ResolveWith from the transport layer so that link resolution is performed when a route is created in response to an incoming packet (e.g. to complete TCP handshakes or send a RST). Tests: - integration_test.TestForwarding - integration_test.TestTCPLinkResolutionFailure Fixes #4458 RELNOTES: n/a PiperOrigin-RevId: 351684158
Diffstat (limited to 'pkg/tcpip/stack/linkaddrcache_test.go')
-rw-r--r--pkg/tcpip/stack/linkaddrcache_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/tcpip/stack/linkaddrcache_test.go b/pkg/tcpip/stack/linkaddrcache_test.go
index 6883045b5..03b2f2d6f 100644
--- a/pkg/tcpip/stack/linkaddrcache_test.go
+++ b/pkg/tcpip/stack/linkaddrcache_test.go
@@ -83,7 +83,7 @@ func getBlocking(c *linkAddrCache, addr tcpip.FullAddress, linkRes LinkAddressRe
got, ch, err := c.get(addr, linkRes, "", nil, nil)
if err == tcpip.ErrWouldBlock {
if attemptedResolution {
- return got, tcpip.ErrNoLinkAddress
+ return got, tcpip.ErrTimeout
}
attemptedResolution = true
<-ch
@@ -253,8 +253,8 @@ func TestCacheResolutionFailed(t *testing.T) {
before := atomic.LoadUint32(&requestCount)
e.addr.Addr += "2"
- if _, err := getBlocking(c, e.addr, linkRes); err != tcpip.ErrNoLinkAddress {
- t.Errorf("c.get(%q), got error: %v, want: error ErrNoLinkAddress", string(e.addr.Addr), err)
+ if a, err := getBlocking(c, e.addr, linkRes); err != tcpip.ErrTimeout {
+ t.Errorf("got getBlocking(_, %#v, _) = (%s, %s), want = (_, %s)", e.addr, a, err, tcpip.ErrTimeout)
}
if got, want := int(atomic.LoadUint32(&requestCount)-before), c.resolutionAttempts; got != want {
@@ -269,8 +269,8 @@ func TestCacheResolutionTimeout(t *testing.T) {
linkRes := &testLinkAddressResolver{cache: c, delay: resolverDelay}
e := testAddrs[0]
- if _, err := getBlocking(c, e.addr, linkRes); err != tcpip.ErrNoLinkAddress {
- t.Errorf("c.get(%q), got error: %v, want: error ErrNoLinkAddress", string(e.addr.Addr), err)
+ if a, err := getBlocking(c, e.addr, linkRes); err != tcpip.ErrTimeout {
+ t.Errorf("got getBlocking(_, %#v, _) = (%s, %s), want = (_, %s)", e.addr, a, err, tcpip.ErrTimeout)
}
}