diff --git a/pkg/tcpip/link/fdbased/BUILD b/pkg/tcpip/link/fdbased/BUILD index 0f82177ce..2f8b0d998 100644 --- a/pkg/tcpip/link/fdbased/BUILD +++ b/pkg/tcpip/link/fdbased/BUILD @@ -11,7 +11,7 @@ go_library( "endpoint.go", "endpoint_unsafe.go", "mmap.go", - "mmap_stub.go", + "mmap_nonlinux.go", "mmap_unsafe.go", "packet_dispatchers.go", "processors.go", diff --git a/pkg/tcpip/link/fdbased/endpoint_test.go b/pkg/tcpip/link/fdbased/endpoint_test.go index 601a6308e..c06bf1c25 100644 --- a/pkg/tcpip/link/fdbased/endpoint_test.go +++ b/pkg/tcpip/link/fdbased/endpoint_test.go @@ -77,7 +77,7 @@ func checkPacketInfoEqual(t *testing.T, got, want packetInfo) { } } -type context struct { +type testContext struct { t *testing.T readFDs []int writeFDs []int @@ -86,7 +86,7 @@ type context struct { done chan struct{} } -func newContext(t *testing.T, opt *Options) *context { +func newContext(t *testing.T, opt *Options) *testContext { firstFDPair, err := unix.Socketpair(unix.AF_UNIX, unix.SOCK_SEQPACKET, 0) if err != nil { t.Fatalf("Socketpair failed: %v", err) @@ -107,7 +107,7 @@ func newContext(t *testing.T, opt *Options) *context { t.Fatalf("Failed to create FD endpoint: %v", err) } - c := &context{ + c := &testContext{ t: t, readFDs: []int{firstFDPair[0], secondFDPair[0]}, writeFDs: opt.FDs, @@ -121,7 +121,7 @@ func newContext(t *testing.T, opt *Options) *context { return c } -func (c *context) cleanup() { +func (c *testContext) cleanup() { for _, fd := range c.readFDs { unix.Close(fd) } @@ -132,12 +132,12 @@ func (c *context) cleanup() { } } -func (c *context) DeliverNetworkPacket(protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer) { +func (c *testContext) DeliverNetworkPacket(protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer) { pkt.IncRef() c.ch <- packetInfo{protocol, pkt} } -func (c *context) DeliverLinkPacket(tcpip.NetworkProtocolNumber, *stack.PacketBuffer) { +func (c *testContext) DeliverLinkPacket(tcpip.NetworkProtocolNumber, *stack.PacketBuffer) { c.t.Fatal("DeliverLinkPacket not implemented") } diff --git a/pkg/tcpip/link/fdbased/mmap_stub.go b/pkg/tcpip/link/fdbased/mmap_nonlinux.go similarity index 100% rename from pkg/tcpip/link/fdbased/mmap_stub.go rename to pkg/tcpip/link/fdbased/mmap_nonlinux.go diff --git a/tools/bazeldefs/tags.bzl b/tools/bazeldefs/tags.bzl index f2257c784..1fe6987eb 100644 --- a/tools/bazeldefs/tags.bzl +++ b/tools/bazeldefs/tags.bzl @@ -41,6 +41,7 @@ archs = [ oses = [ "_linux", + "_nonlinux", ] generic = [