mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-22 16:07:31 +00:00
Merge pull request #907 from yggdrasil-network/neilalexander/pmtud
This commit is contained in:
commit
6c4778bb67
@ -237,11 +237,11 @@ func (k *keyStore) readPC(p []byte) (int, error) {
|
|||||||
k.mutex.Unlock()
|
k.mutex.Unlock()
|
||||||
if len(bs) > mtu {
|
if len(bs) > mtu {
|
||||||
// Using bs would make it leak off the stack, so copy to buf
|
// Using bs would make it leak off the stack, so copy to buf
|
||||||
buf := make([]byte, 40)
|
buf := make([]byte, 512)
|
||||||
copy(buf, bs)
|
cn := copy(buf, bs)
|
||||||
ptb := &icmp.PacketTooBig{
|
ptb := &icmp.PacketTooBig{
|
||||||
MTU: mtu,
|
MTU: mtu,
|
||||||
Data: buf[:40],
|
Data: buf[:cn],
|
||||||
}
|
}
|
||||||
if packet, err := CreateICMPv6(buf[8:24], buf[24:40], ipv6.ICMPTypePacketTooBig, 0, ptb); err == nil {
|
if packet, err := CreateICMPv6(buf[8:24], buf[24:40], ipv6.ICMPTypePacketTooBig, 0, ptb); err == nil {
|
||||||
_, _ = k.writePC(packet)
|
_, _ = k.writePC(packet)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user