Ensure frame padding
This commit is contained in:
parent
0f8297e670
commit
100d70dccf
3 changed files with 15 additions and 0 deletions
|
@ -337,6 +337,9 @@ func (a *AARPMachine) heyThatsMe(targ aarp.AddrPair) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(respFrameRaw) < 64 {
|
||||||
|
respFrameRaw = append(respFrameRaw, make([]byte, 64-len(respFrameRaw))...)
|
||||||
|
}
|
||||||
return a.pcapHandle.WritePacketData(respFrameRaw)
|
return a.pcapHandle.WritePacketData(respFrameRaw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,6 +353,9 @@ func (a *AARPMachine) probe() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(probeFrameRaw) < 64 {
|
||||||
|
probeFrameRaw = append(probeFrameRaw, make([]byte, 64-len(probeFrameRaw))...)
|
||||||
|
}
|
||||||
return a.pcapHandle.WritePacketData(probeFrameRaw)
|
return a.pcapHandle.WritePacketData(probeFrameRaw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,6 +369,9 @@ func (a *AARPMachine) request(ddpAddr ddp.Addr) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(reqFrameRaw) < 64 {
|
||||||
|
reqFrameRaw = append(reqFrameRaw, make([]byte, 64-len(reqFrameRaw))...)
|
||||||
|
}
|
||||||
return a.pcapHandle.WritePacketData(reqFrameRaw)
|
return a.pcapHandle.WritePacketData(reqFrameRaw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,5 +46,8 @@ func (p *EtherTalkPeer) Forward(ctx context.Context, pkt *ddp.ExtPacket) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(outFrameRaw) < 64 {
|
||||||
|
outFrameRaw = append(outFrameRaw, make([]byte, 64-len(outFrameRaw))...)
|
||||||
|
}
|
||||||
return p.Port.PcapHandle.WritePacketData(outFrameRaw)
|
return p.Port.PcapHandle.WritePacketData(outFrameRaw)
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,5 +200,8 @@ func (port *EtherTalkPort) send(dstEth ethernet.Addr, pkt *ddp.ExtPacket) error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(outFrameRaw) < 64 {
|
||||||
|
outFrameRaw = append(outFrameRaw, make([]byte, 64-len(outFrameRaw))...)
|
||||||
|
}
|
||||||
return port.PcapHandle.WritePacketData(outFrameRaw)
|
return port.PcapHandle.WritePacketData(outFrameRaw)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue