mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
wgengine/netstack: replace a 1500 with a const + doc
Per post-submit code review feedback of 1336fb740b7f from @maisem. Change-Id: Ic5c16306cbdee1029518448642304981f77ea1fd Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
e428bba7a3
commit
69b535c01f
@ -133,6 +133,11 @@ var handleSSH func(logger.Logf, *ipnlocal.LocalBackend, net.Conn) error
|
|||||||
const nicID = 1
|
const nicID = 1
|
||||||
const mtu = tstun.DefaultMTU
|
const mtu = tstun.DefaultMTU
|
||||||
|
|
||||||
|
// maxUDPPacketSize is the maximum size of a UDP packet we copy in startPacketCopy
|
||||||
|
// when relaying UDP packets. We don't use the 'mtu' const in anticipation of
|
||||||
|
// one day making the MTU more dynamic.
|
||||||
|
const maxUDPPacketSize = 1500
|
||||||
|
|
||||||
// Create creates and populates a new Impl.
|
// Create creates and populates a new Impl.
|
||||||
func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magicsock.Conn, dialer *tsdial.Dialer, dns *dns.Manager) (*Impl, error) {
|
func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magicsock.Conn, dialer *tsdial.Dialer, dns *dns.Manager) (*Impl, error) {
|
||||||
if mc == nil {
|
if mc == nil {
|
||||||
@ -1018,7 +1023,7 @@ func startPacketCopy(ctx context.Context, cancel context.CancelFunc, dst net.Pac
|
|||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
defer cancel() // tear down the other direction's copy
|
defer cancel() // tear down the other direction's copy
|
||||||
pkt := make([]byte, 1500)
|
pkt := make([]byte, maxUDPPacketSize)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user