summaryrefslogtreecommitdiffhomepage
path: root/tun/tun_windows.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-03-13 02:52:32 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-13 02:52:32 -0600
commitb0e0ab308dd25651fa306e07071624032dab5eab (patch)
tree49260ce807c0aecb5540928c353eb48bc62148aa /tun/tun_windows.go
parent66fb5caf023eb893b5d3fbbda5009749d217a68b (diff)
tun: windows: temporary hack for forcing MTU
Diffstat (limited to 'tun/tun_windows.go')
-rw-r--r--tun/tun_windows.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go
index 4c48af5..579e65c 100644
--- a/tun/tun_windows.go
+++ b/tun/tun_windows.go
@@ -46,6 +46,7 @@ type NativeTun struct {
userClose windows.Handle
events chan TUNEvent
errors chan error
+ forcedMtu int
}
func packetAlign(size uint32) uint32 {
@@ -100,6 +101,7 @@ func CreateTUN(ifname string) (TUNDevice, error) {
wrBuff: &exchgBufWrite{},
events: make(chan TUNEvent, 10),
errors: make(chan error, 1),
+ forcedMtu: 1500,
}
// Create close event.
@@ -220,7 +222,12 @@ func (tun *NativeTun) Close() error {
}
func (tun *NativeTun) MTU() (int, error) {
- return 1500, nil
+ return tun.forcedMtu, nil
+}
+
+//TODO: This is a temporary hack. We really need to be monitoring the interface in real time and adapting to MTU changes.
+func (tun *NativeTun) ForceMtu(mtu int) {
+ tun.forcedMtu = mtu
}
func (tun *NativeTun) Read(buff []byte, offset int) (int, error) {