mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 12:36:52 +01:00
Size the buffers of a handshake packet sent through a relay for the packet, not the mtu
This commit is contained in:
1 parent
d190ac7446
commit
e8d6cd9b58
2 files changed
+11
-3
No files matched your search
+10
-2
@@ -289,11 +289,19 @@ func (hm *HandshakeManager) relayEstablished(target netip.Addr, relayHI *HostInf
|
||||
f := hm.f
|
||||
hh.hostinfo.logger(hm.l).Info("Send handshake via new relay", "relay", relayHI.vpnAddrs[0])
|
||||
_ = hm.sendFragmented(now, later, func(p []byte) error {
|
||||
f.SendVia(relayHI, relay, p, make([]byte, 12), make([]byte, mtu), false, 0)
|
||||
f.sendHandshakeVia(relayHI, relay, p)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// sendHandshakeVia sends a handshake packet through a relay, with buffers sized
|
||||
// for the packet rather than the mtu: a relayed post-quantum handshake is
|
||||
// dozens of fragments.
|
||||
func (f *Interface) sendHandshakeVia(via *HostInfo, relay *Relay, p []byte) {
|
||||
out := make([]byte, header.Len+len(p)+via.ConnectionState.eKey.Overhead())
|
||||
f.SendVia(via, relay, p, make([]byte, 12), out, false, 0)
|
||||
}
|
||||
|
||||
// buildPQAttempt creates the initiator's PQ Machine and msg1 sender. A node with
|
||||
// a v3 certificate speaks the hybrid handshake for its suite's KEM, anyone else
|
||||
// the ephemeral KEM one.
|
||||
@@ -824,7 +832,7 @@ func (hm *HandshakeManager) sendTo(via ViaSender) func([]byte) error {
|
||||
if via.relay == nil {
|
||||
return errors.New("both addr and via.relay are nil")
|
||||
}
|
||||
f.SendVia(via.relayHI, via.relay, p, make([]byte, 12), make([]byte, mtu), false, 0)
|
||||
f.sendHandshakeVia(via.relayHI, via.relay, p)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -163,7 +163,7 @@ func (rm *relayManager) StartRelays(f *Interface, vpnIp netip.Addr, hh *Handshak
|
||||
case Established:
|
||||
hl.Log(context.Background(), level, "Send handshake via relay", "relay", relay.String())
|
||||
_ = f.handshakeManager.sendFragmented(now, later, func(p []byte) error {
|
||||
f.SendVia(relayHostInfo, existingRelay, p, make([]byte, 12), make([]byte, mtu), false, 0)
|
||||
f.sendHandshakeVia(relayHostInfo, existingRelay, p)
|
||||
return nil
|
||||
})
|
||||
case Disestablished:
|
||||
|
||||
Reference in new issue
Block a user