Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions disco/disco_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import (
"fmt"
"golang.org/x/crypto/nacl/box"

Check failure on line 8 in disco/disco_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not `goimports`-ed (goimports)
"net/netip"
"reflect"
"strings"
Expand Down Expand Up @@ -75,6 +76,11 @@
if !ok {
t.Fatalf("didn't start with foo: got %q", got)
}
// CODER: 1310 is max size of a Wireguard packet we will send.
expectedLen := 1310 - len(Magic) - keyLen - NonceLen - box.Overhead
if _, ok := tt.m.(*CallMeMaybe); !ok && len(got) != expectedLen {
t.Fatalf("Ping/Pong not padded: got len %d, want len %d", len(got), expectedLen)
}

gotHex := fmt.Sprintf("% x", got)
if !strings.HasPrefix(gotHex, tt.want) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we expect the end of the ping payload to be a bunch of 00s we should probably test that, either by changing the want for each of the ping/pong cases to be the full value or by some other method

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't care that it's zeros per se, but I'll add a check that it's the padded length.

Expand Down
9 changes: 1 addition & 8 deletions wgengine/magicsock/magicsock_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@ import (
// https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.16299.0/shared/ws2ipdef.h
const (
IP_MTU_DISCOVER = 71 // IPV6_MTU_DISCOVER has the same value, which is nice.
)

const (
IP_PMTUDISC_NOT_SET = iota
IP_PMTUDISC_DO
IP_PMTUDISC_DONT
IP_PMTUDISC_PROBE
IP_PMTUDISC_MAX
IP_PMTUDISC_DO = 1
)

func tryPreventFragmentation(pconn nettype.PacketConn, logf logger.Logf, network string) {
Expand Down
Loading