diff --git a/router/aarp.go b/router/aarp.go index 62261ef..815471e 100644 --- a/router/aarp.go +++ b/router/aarp.go @@ -337,6 +337,9 @@ func (a *AARPMachine) heyThatsMe(targ aarp.AddrPair) error { if err != nil { return err } + if len(respFrameRaw) < 64 { + respFrameRaw = append(respFrameRaw, make([]byte, 64-len(respFrameRaw))...) + } return a.pcapHandle.WritePacketData(respFrameRaw) } @@ -350,6 +353,9 @@ func (a *AARPMachine) probe() error { if err != nil { return err } + if len(probeFrameRaw) < 64 { + probeFrameRaw = append(probeFrameRaw, make([]byte, 64-len(probeFrameRaw))...) + } return a.pcapHandle.WritePacketData(probeFrameRaw) } @@ -363,6 +369,9 @@ func (a *AARPMachine) request(ddpAddr ddp.Addr) error { if err != nil { return err } + if len(reqFrameRaw) < 64 { + reqFrameRaw = append(reqFrameRaw, make([]byte, 64-len(reqFrameRaw))...) + } return a.pcapHandle.WritePacketData(reqFrameRaw) } diff --git a/router/peer_eth.go b/router/peer_eth.go index 4b181a2..e3fb8ce 100644 --- a/router/peer_eth.go +++ b/router/peer_eth.go @@ -46,5 +46,8 @@ func (p *EtherTalkPeer) Forward(ctx context.Context, pkt *ddp.ExtPacket) error { if err != nil { return err } + if len(outFrameRaw) < 64 { + outFrameRaw = append(outFrameRaw, make([]byte, 64-len(outFrameRaw))...) + } return p.Port.PcapHandle.WritePacketData(outFrameRaw) } diff --git a/router/port.go b/router/port.go index e6c05bb..6147baa 100644 --- a/router/port.go +++ b/router/port.go @@ -200,5 +200,8 @@ func (port *EtherTalkPort) send(dstEth ethernet.Addr, pkt *ddp.ExtPacket) error if err != nil { return err } + if len(outFrameRaw) < 64 { + outFrameRaw = append(outFrameRaw, make([]byte, 64-len(outFrameRaw))...) + } return port.PcapHandle.WritePacketData(outFrameRaw) }