Make the full EthernetDecoder available to LogFrame
So that LogFrame can include information about the decoded frame beyond the ethernet layer.
This commit is contained in:
1 parent
ea59c6c065
commit
4162dcafd3
5 files changed
+35
-35
No files matched your search
+4
-4
@@ -192,14 +192,14 @@ func options() map[string]string {
|
||||
|
||||
func logFrameFunc(debug bool) weave.LogFrameFunc {
|
||||
if !debug {
|
||||
return func(prefix string, frame []byte, eth *layers.Ethernet) {}
|
||||
return func(prefix string, frame []byte, dec *weave.EthernetDecoder) {}
|
||||
}
|
||||
return func(prefix string, frame []byte, eth *layers.Ethernet) {
|
||||
return func(prefix string, frame []byte, dec *weave.EthernetDecoder) {
|
||||
h := fmt.Sprintf("%x", sha256.Sum256(frame))
|
||||
if eth == nil {
|
||||
if dec == nil {
|
||||
log.Println(prefix, len(frame), "bytes (", h, ")")
|
||||
} else {
|
||||
log.Println(prefix, len(frame), "bytes (", h, "):", eth.SrcMAC, "->", eth.DstMAC)
|
||||
log.Println(prefix, len(frame), "bytes (", h, "):", dec.Eth.SrcMAC, "->", dec.Eth.DstMAC)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user