Add round-robin implementation (#66)

* add handler.encapsulateNode

* implement round robin handler approach

* simplify round robin implementation

* leave TODO

* internet.node touch up

* fix conflict resolve f-up

* replace certain ErrShortBuffer with ErrTruncatedFrame error
This commit is contained in:
Pat Whittingslow
2026-04-09 09:36:17 -03:00
committed by GitHub
parent ec44889896
commit 63f7870fe5
21 changed files with 104 additions and 70 deletions
+3 -3
View File
@@ -24,7 +24,7 @@ func (sudp *StackUDPPort) SetStackNode(node lneto.StackNode, raddr []byte, rmpor
func (sudp *StackUDPPort) Protocol() uint64 { return uint64(lneto.IPProtoUDP) }
func (sudp *StackUDPPort) LocalPort() uint16 { return sudp.h.port }
func (sudp *StackUDPPort) LocalPort() uint16 { return sudp.h.lport }
func (sudp *StackUDPPort) ConnectionID() *uint64 { return sudp.h.connID }
@@ -42,7 +42,7 @@ func (sudp *StackUDPPort) Demux(carrierData []byte, frameOffset int) error {
return sudp.vld.ErrPop()
}
dst := ufrm.DestinationPort()
if dst != sudp.h.port {
if dst != sudp.h.lport {
return lneto.ErrPacketDrop // Not meant for us.
}
// TODO remote ip address handling.
@@ -70,7 +70,7 @@ func (sudp *StackUDPPort) Encapsulate(carrierData []byte, offsetToIP, offsetToFr
if err != nil {
return 0, err
}
ufrm.SetSourcePort(sudp.h.port)
ufrm.SetSourcePort(sudp.h.lport)
ufrm.SetDestinationPort(sudp.rmport)
if len(sudp.raddr) > 0 && offsetToIP >= 0 {
err = internal.SetIPAddrs(carrierData[offsetToIP:], 0, nil, sudp.raddr)