mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Fix checksums and packet buffers, sends ICMPv6 Packet Too Big messages successfully now
This commit is contained in:
parent
37e4492b86
commit
1c59338f01
2 changed files with 21 additions and 26 deletions
|
@ -149,8 +149,6 @@ func (r *router) sendPacket(bs []byte) {
|
|||
default:
|
||||
// Generate an ICMPv6 Packet Too Big for packets larger than session MTU
|
||||
if len(bs) > int(sinfo.getMTU()) {
|
||||
sinfo.core.log.Printf("Packet length %d exceeds session MTU %d", len(bs), sinfo.getMTU())
|
||||
|
||||
// Get the size of the oversized payload, up to a max of 900 bytes
|
||||
window := 900
|
||||
if int(sinfo.getMTU()) < window {
|
||||
|
@ -159,14 +157,13 @@ func (r *router) sendPacket(bs []byte) {
|
|||
|
||||
// Create the Packet Too Big response
|
||||
ptb := &icmp.PacketTooBig{
|
||||
MTU: int(sinfo.getMTU()),
|
||||
MTU: int(sinfo.getMTU()),
|
||||
Data: bs[:window],
|
||||
}
|
||||
|
||||
// Create the ICMPv6 response from it
|
||||
icmpv6Buf, err := r.core.tun.icmpv6.create_icmpv6_tun(bs[8:24], ipv6.ICMPTypePacketTooBig, 0, ptb)
|
||||
if err == nil {
|
||||
sinfo.core.log.Printf("Sending ICMPv6 Message Too Big")
|
||||
r.recv <- icmpv6Buf
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue