refactor(ish) of special frame processing in udp frame handler

- pull all special frame handling in one place
- generalise the condition for detecting special frames
- add some explanation
This commit is contained in:
Matthias Radestock committed 2015-01-17 16:48:00 +00:00
1 parent c6898de4c0
commit aceaa66903
2 files changed
+31 -29

No files matched your search

+3 -3
View File
@@ -75,7 +75,7 @@ func (dec *EthernetDecoder) DropFrame() bool {
return bytes.Equal(stpMACPrefix, dec.eth.DstMAC[:len(stpMACPrefix)])
}
func (dec *EthernetDecoder) IsPMTUVerify() bool {
return bytes.Equal(zeroMAC, dec.eth.SrcMAC) &&
bytes.Equal(zeroMAC, dec.eth.DstMAC)
func (dec *EthernetDecoder) IsSpecial() bool {
return dec.eth.Length == 0 && dec.eth.EthernetType == layers.EthernetTypeLLC &&
bytes.Equal(zeroMAC, dec.eth.SrcMAC) && bytes.Equal(zeroMAC, dec.eth.DstMAC)
}