tun: windows: inform wintun of maximum buffer length for writes
This commit is contained in:
parent
c69d026649
commit
5e6eff81b6
|
@ -141,6 +141,12 @@ func (tun *NativeTun) openTUN() error {
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
firstSize := (*uint32)(unsafe.Pointer(&tun.wrBuff.data[0]))
|
||||||
|
saved := *firstSize
|
||||||
|
*firstSize = 0
|
||||||
|
// Set the maximum buffer length with an invalid write.
|
||||||
|
tun.tunFileWrite.Write(tun.wrBuff.data[:])
|
||||||
|
*firstSize = saved
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue