forked from tailscale/tailscale
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wgengine/netstack: use build tags to exclude gVisor GRO importation o…
…n iOS (tailscale#13015) Updates tailscale/corp#22125 Signed-off-by: Jordan Whited <jordan@tailscale.com>
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Tailscale Inc & AUTHORS | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
//go:build !ios | ||
|
||
package netstack | ||
|
||
import ( | ||
nsgro "gvisor.dev/gvisor/pkg/tcpip/stack/gro" | ||
) | ||
|
||
// gro wraps a gVisor GRO implementation. It exists solely to prevent iOS from | ||
// importing said package (see _ios.go). | ||
type gro struct { | ||
nsgro.GRO | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) Tailscale Inc & AUTHORS | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
//go:build ios | ||
|
||
package netstack | ||
|
||
import ( | ||
"gvisor.dev/gvisor/pkg/tcpip/stack" | ||
) | ||
|
||
// gro on iOS delivers packets to its Dispatcher, immediately. This type exists | ||
// to prevent importation of the gVisor GRO implementation as said package | ||
// increases binary size. This is a penalty we do not wish to pay since we | ||
// currently do not leverage GRO on iOS. | ||
type gro struct { | ||
Dispatcher stack.NetworkDispatcher | ||
} | ||
|
||
func (g *gro) Init(v bool) { | ||
if v { | ||
panic("GRO is not supported on this platform") | ||
} | ||
} | ||
|
||
func (g *gro) Flush() {} | ||
|
||
func (g *gro) Enqueue(pkt *stack.PacketBuffer) { | ||
g.Dispatcher.DeliverNetworkPacket(pkt.NetworkProtocolNumber, pkt) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters