Workaround for trailing data on AARP packets
This commit is contained in:
parent
d498f5d6cc
commit
2f1b4c1ce1
1 changed files with 12 additions and 1 deletions
|
@ -37,6 +37,8 @@ const (
|
||||||
maxAMTEntryAge = 30 * time.Second
|
maxAMTEntryAge = 30 * time.Second
|
||||||
aarpRequestRetransmit = 1 * time.Second
|
aarpRequestRetransmit = 1 * time.Second
|
||||||
aarpRequestTimeout = 10 * time.Second
|
aarpRequestTimeout = 10 * time.Second
|
||||||
|
|
||||||
|
aarpBodyLength = 28 // bytes
|
||||||
)
|
)
|
||||||
|
|
||||||
const aarpStatusTemplate = `
|
const aarpStatusTemplate = `
|
||||||
|
@ -181,8 +183,17 @@ func (a *AARPMachine) Run(ctx context.Context) error {
|
||||||
a.incomingCh = nil
|
a.incomingCh = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sfiera/multitalk will return an "excess data" error if the
|
||||||
|
// payload is too big. Most traffic I've seen locally does not have
|
||||||
|
// this problem, but I've seen one report with some junk trailing
|
||||||
|
// data on AARP packets.
|
||||||
|
payload := ethFrame.Payload
|
||||||
|
if len(payload) > aarpBodyLength {
|
||||||
|
payload = payload[:aarpBodyLength]
|
||||||
|
}
|
||||||
|
|
||||||
var aapkt aarp.Packet
|
var aapkt aarp.Packet
|
||||||
if err := aarp.Unmarshal(ethFrame.Payload, &aapkt); err != nil {
|
if err := aarp.Unmarshal(payload, &aapkt); err != nil {
|
||||||
log.Printf("Couldn't unmarshal AARP packet: %v", err)
|
log.Printf("Couldn't unmarshal AARP packet: %v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue