From fd4bfe604dfea688c06f82ae369f84afb57dba74 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 15 May 2025 02:39:59 +0200 Subject: [PATCH] more fixup Signed-off-by: Jens Langhammer --- internal/outpost/radius/eap/packet.go | 6 +++--- internal/outpost/radius/eap/tls/conn.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/outpost/radius/eap/packet.go b/internal/outpost/radius/eap/packet.go index 0ebdaec56e..640e27c192 100644 --- a/internal/outpost/radius/eap/packet.go +++ b/internal/outpost/radius/eap/packet.go @@ -69,7 +69,7 @@ func Decode(raw []byte) (*Packet, error) { } func (p *Packet) Encode() ([]byte, error) { - buff := make([]byte, 5) + buff := make([]byte, 4) buff[0] = uint8(p.code) buff[1] = uint8(p.id) @@ -77,10 +77,10 @@ func (p *Packet) Encode() ([]byte, error) { if err != nil { return buff, err } - binary.BigEndian.PutUint16(buff[2:], uint16(len(payloadBuffer)+5)) if p.code == CodeRequest || p.code == CodeResponse { - buff[4] = uint8(p.msgType) + buff = append(buff, uint8(p.msgType)) } buff = append(buff, payloadBuffer...) + binary.BigEndian.PutUint16(buff[2:], uint16(len(buff))) return buff, nil } diff --git a/internal/outpost/radius/eap/tls/conn.go b/internal/outpost/radius/eap/tls/conn.go index a8360034e1..4d2851746b 100644 --- a/internal/outpost/radius/eap/tls/conn.go +++ b/internal/outpost/radius/eap/tls/conn.go @@ -54,12 +54,12 @@ func (conn *TLSConnection) Read(p []byte) (int, error) { n, err := conn.reader.Read(p) if n == 0 { log.Debugf("TLS(buffer): Attempted read %d from empty buffer, stalling...", len(p)) - time.Sleep(500 * time.Millisecond) + time.Sleep(100 * time.Millisecond) continue } if conn.expectedWriterByteCount > 0 && conn.writtenByteCount < int(conn.expectedWriterByteCount) { log.Debugf("TLS(buffer): Attempted read %d while waiting for bytes %d, stalling...", len(p), conn.expectedWriterByteCount-conn.reader.Len()) - time.Sleep(500 * time.Millisecond) + time.Sleep(100 * time.Millisecond) continue } if conn.expectedWriterByteCount > 0 && conn.writtenByteCount == int(conn.expectedWriterByteCount) {