summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/nic_test.go
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2020-09-28 16:22:09 -0700
committergVisor bot <gvisor-bot@google.com>2020-09-28 16:24:04 -0700
commita5acc0616c9552c7252e3f133f9ad4648422cc5f (patch)
treec62a2f05c8f8aee20671c39862ffe6721df35332 /pkg/tcpip/stack/nic_test.go
parenta0e0ba690f3f4946890010e12084db7f081d5bc7 (diff)
Support creating protocol instances with Stack ref
Network or transport protocols may want to reach the stack. Support this by letting the stack create the protocol instances so it can pass a reference to itself at protocol creation time. Note, protocols do not yet use the stack in this CL but later CLs will make use of the stack from protocols. PiperOrigin-RevId: 334260210
Diffstat (limited to 'pkg/tcpip/stack/nic_test.go')
-rw-r--r--pkg/tcpip/stack/nic_test.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/tcpip/stack/nic_test.go b/pkg/tcpip/stack/nic_test.go
index dd6474297..bc9c9881a 100644
--- a/pkg/tcpip/stack/nic_test.go
+++ b/pkg/tcpip/stack/nic_test.go
@@ -241,6 +241,10 @@ func (*testIPv6Protocol) ResolveStaticAddress(addr tcpip.Address) (tcpip.LinkAdd
return "", false
}
+func newTestIPv6Protocol(*Stack) NetworkProtocol {
+ return &testIPv6Protocol{}
+}
+
// Test the race condition where a NIC is removed and an RS timer fires at the
// same time.
func TestRemoveNICWhileHandlingRSTimer(t *testing.T) {
@@ -252,7 +256,7 @@ func TestRemoveNICWhileHandlingRSTimer(t *testing.T) {
e := testLinkEndpoint{}
s := New(Options{
- NetworkProtocols: []NetworkProtocol{&testIPv6Protocol{}},
+ NetworkProtocols: []NetworkProtocolFactory{newTestIPv6Protocol},
NDPConfigs: NDPConfigurations{
MaxRtrSolicitations: maxRtrSolicitations,
RtrSolicitationInterval: minimumRtrSolicitationInterval,