From 11a7c5c458514062f540b3954b0d8507cb9b0643 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 11 Feb 2018 23:58:30 +0000 Subject: [PATCH] Exchange MTU on wire --- src/yggdrasil/wire.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/yggdrasil/wire.go b/src/yggdrasil/wire.go index 7dbd7b8e..6d574541 100644 --- a/src/yggdrasil/wire.go +++ b/src/yggdrasil/wire.go @@ -429,12 +429,14 @@ func (p *sessionPing) encode() []byte { bs = append(bs, wire_encode_uint64(wire_intToUint(p.tstamp))...) coords := wire_encode_coords(p.coords) bs = append(bs, coords...) + bs = append(bs, wire_encode_uint64(uint64(p.mtu))...) return bs } func (p *sessionPing) decode(bs []byte) bool { var pType uint64 var tstamp uint64 + var mtu uint64 switch { case !wire_chop_uint64(&pType, &bs): return false @@ -449,11 +451,14 @@ func (p *sessionPing) decode(bs []byte) bool { return false case !wire_chop_coords(&p.coords, &bs): return false + case !wire_chop_uint64(&mtu, &bs): + mtu = 1280 } p.tstamp = wire_intFromUint(tstamp) if pType == wire_SessionPong { p.isPong = true } + p.mtu = uint16(mtu) return true }