Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions cmd/cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type DsnetConfig struct {
Peers []PeerConfig `validate:"dive"`
// used for server and client
PersistentKeepalive int `validate:"gte=0,lte=255"`
MTU int `validate:"gte=0,lte=65535"`
}

// LoadConfigFile parses the json config file, validates and stuffs
Expand All @@ -88,6 +89,7 @@ func LoadConfigFile() (*DsnetConfig, error) {
// used _even if value is zero!_
// Effectively, this is a migration
PersistentKeepalive: 25,
MTU: 1420,
}

err = json.Unmarshal(raw, &conf)
Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func init() {
viper.SetDefault("config_file", "/etc/dsnetconfig.json")
viper.SetDefault("fallback_wg_bing", "wireguard-go")
viper.SetDefault("listen_port", 51820)
viper.SetDefault("MTU", 1420)
viper.SetDefault("interface_name", "dsnet")

// if last handshake (different from keepalive, see https://www.wireguard.com/protocol/)
Expand Down
2 changes: 2 additions & 0 deletions lib/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
if err != nil {
return fmt.Errorf("could not add ipv4 addr %s to interface %s: %v", addr.IP, s.InterfaceName, err)
}
// set MTU
err = netlink.LinkSetMTU(link, s.MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.17, GOARCH=arm GOARM=6)

s.MTU undefined (type *Server has no field or method MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.17, GOARCH=arm GOARM=5)

s.MTU undefined (type *Server has no field or method MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.17, GOARCH=amd64)

s.MTU undefined (type *Server has no field or method MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.17, GOARCH=arm GOARM=7)

s.MTU undefined (type *Server has no field or method MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.18, GOARCH=arm GOARM=7)

s.MTU undefined (type *Server has no field or method MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.17, GOARCH=arm64)

s.MTU undefined (type *Server has no field or method MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.18, GOARCH=arm64)

s.MTU undefined (type *Server has no field or method MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.18, GOARCH=arm GOARM=6)

s.MTU undefined (type *Server has no field or method MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.18, GOARCH=amd64)

s.MTU undefined (type *Server has no field or method MTU)

Check failure on line 69 in lib/link.go

View workflow job for this annotation

GitHub Actions / build (1.18, GOARCH=arm GOARM=5)

s.MTU undefined (type *Server has no field or method MTU)
}
}

Expand Down
Loading