mirror of
https://github.com/slackhq/nebula.git
synced 2026-05-10 06:01:54 -07:00
WIP
This commit is contained in:
parent
2f50b3c54f
commit
bb3c70da2e
3 changed files with 14 additions and 12 deletions
|
|
@ -324,10 +324,12 @@ func (hm *HandshakeManager) handleOutbound(vpnIp netip.Addr, lighthouseTriggered
|
|||
hm.messageMetrics.Tx(header.Handshake, header.MessageSubType(hostinfo.HandshakePacket[0][1]), 1)
|
||||
err = hm.udpRaw.WriteTo(raw, udp.RandomSendPort.UDPSendPort(hm.multiPort.TxPorts), addr)
|
||||
if err != nil {
|
||||
hostinfo.logger(hm.l).WithField("udpAddr", addr).
|
||||
WithField("initiatorIndex", hostinfo.localIndexId).
|
||||
WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).
|
||||
WithError(err).Error("Failed to send handshake message")
|
||||
hostinfo.logger(hm.l).Error("Failed to send handshake message",
|
||||
"error", err,
|
||||
"udpAddr", addr,
|
||||
"initiatorIndex", hostinfo.localIndexId,
|
||||
"handshake", hsFields,
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
4
main.go
4
main.go
|
|
@ -241,7 +241,7 @@ func Main(c *config.C, configTest bool, buildVersion string, l *slog.Logger, dev
|
|||
if tx && ifce.udpRaw == nil {
|
||||
ifce.udpRaw, err = udp.NewRawConn(l, c.GetString("listen.host", "0.0.0.0"), port, uint16(port))
|
||||
if err != nil {
|
||||
l.WithError(err).Error("Failed to get raw socket for tun.multiport.tx_enabled")
|
||||
l.Error("Failed to get raw socket for tun.multiport.tx_enabled", "error", err)
|
||||
ifce.udpRaw = nil
|
||||
tx = false
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ func Main(c *config.C, configTest bool, buildVersion string, l *slog.Logger, dev
|
|||
handshakeManager.udpRaw = ifce.udpRaw
|
||||
handshakeManager.multiPort = ifce.multiPort
|
||||
|
||||
l.WithField("multiPort", ifce.multiPort).Info("Multiport configured")
|
||||
l.Info("Multiport configured", "multiPort", ifce.multiPort)
|
||||
}
|
||||
|
||||
loadMultiPortConfig(c)
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ package udp
|
|||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net"
|
||||
"net/netip"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/rcrowley/go-metrics"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/slackhq/nebula/config"
|
||||
"golang.org/x/net/ipv4"
|
||||
"golang.org/x/sys/unix"
|
||||
|
|
@ -26,10 +26,10 @@ const RawOverhead = 28
|
|||
type RawConn struct {
|
||||
sysFd int
|
||||
basePort uint16
|
||||
l *logrus.Logger
|
||||
l *slog.Logger
|
||||
}
|
||||
|
||||
func NewRawConn(l *logrus.Logger, ip string, port int, basePort uint16) (*RawConn, error) {
|
||||
func NewRawConn(l *slog.Logger, ip string, port int, basePort uint16) (*RawConn, error) {
|
||||
syscall.ForkLock.RLock()
|
||||
// With IPPROTO_UDP, the linux kernel tries to deliver every UDP packet
|
||||
// received in the system to our socket. This constantly overflows our
|
||||
|
|
@ -130,17 +130,17 @@ func (u *RawConn) ReloadConfig(c *config.C) {
|
|||
}
|
||||
|
||||
if err := u.SetSendBuffer(b); err != nil {
|
||||
u.l.WithError(err).Error("Failed to set listen.write_buffer")
|
||||
u.l.Error("Failed to set listen.write_buffer", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
s, err := u.GetSendBuffer()
|
||||
if err != nil {
|
||||
u.l.WithError(err).Warn("Failed to get listen.write_buffer")
|
||||
u.l.Warn("Failed to get listen.write_buffer", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
u.l.WithField("size", s).Info("listen.write_buffer was set")
|
||||
u.l.Info("listen.write_buffer was set", "size", s)
|
||||
}
|
||||
|
||||
func (u *RawConn) SetSendBuffer(n int) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue