Move DF indication into LogFrame

This commit is contained in:
David Wragg committed 2015-06-12 16:11:32 +01:00
1 parent 2fa5cda2c7
commit b77abf480b
3 files changed
+19 -18

No files matched your search

+10 -4
View File
@@ -172,11 +172,17 @@ func logFrameFunc(debug bool) weave.LogFrameFunc {
}
return func(prefix string, frame []byte, dec *weave.EthernetDecoder) {
h := fmt.Sprintf("%x", sha256.Sum256(frame))
if dec == nil {
log.Println(prefix, len(frame), "bytes (", h, ")")
} else {
log.Println(prefix, len(frame), "bytes (", h, "):", dec.Eth.SrcMAC, "->", dec.Eth.DstMAC)
parts := []interface{}{prefix, len(frame), "bytes (", h, ")"}
if dec != nil {
parts = append(parts, dec.Eth.SrcMAC, "->", dec.Eth.DstMAC)
if dec.DF() {
parts = append(parts, "(DF)")
}
}
log.Println(parts...)
}
}