diff --git a/internal/pwru/config.go b/internal/pwru/config.go index 4fbc4532..91684b2a 100644 --- a/internal/pwru/config.go +++ b/internal/pwru/config.go @@ -70,7 +70,7 @@ func GetConfig(flags *Flags) (cfg FilterCfg, err error) { if flags.OutputCaller { cfg.OutputFlags |= OutputCallerMask } - if flags.FilterTraceTc { + if flags.FilterTraceTc || flags.OutputSkbCB { cfg.OutputFlags |= OutputCbMask } if flags.FilterTrackSkb { diff --git a/internal/pwru/output.go b/internal/pwru/output.go index 35d15a5b..877053f3 100644 --- a/internal/pwru/output.go +++ b/internal/pwru/output.go @@ -142,7 +142,7 @@ func (o *output) PrintHeader() { } if o.flags.OutputMeta { fmt.Fprintf(o.writer, " %-10s %-8s %16s %-6s %-5s %-5s", "NETNS", "MARK/x", centerAlignString("IFACE", 16), "PROTO", "MTU", "LEN") - if o.flags.FilterTraceTc { + if o.flags.FilterTraceTc || o.flags.OutputSkbCB { fmt.Fprintf(o.writer, " %-56s", "__sk_buff->cb[]") } } @@ -191,7 +191,7 @@ func (o *output) PrintJson(event *Event) { d.Proto = byteorder.NetworkToHost16(event.Meta.Proto) d.Mtu = event.Meta.MTU d.Len = event.Meta.Len - if o.flags.FilterTraceTc { + if o.flags.FilterTraceTc || o.flags.OutputSkbCB { d.Cb = event.Meta.Cb } } @@ -425,7 +425,7 @@ func (o *output) Print(event *Event) { if o.flags.OutputMeta { fmt.Fprintf(o.writer, " %s", getMetaData(event, o)) - if o.flags.FilterTraceTc { + if o.flags.FilterTraceTc || o.flags.OutputSkbCB { fmt.Fprintf(o.writer, " %s", getCb(event)) } } diff --git a/internal/pwru/types.go b/internal/pwru/types.go index c75d419e..2abb1372 100644 --- a/internal/pwru/types.go +++ b/internal/pwru/types.go @@ -46,6 +46,7 @@ type Flags struct { OutputStack bool OutputCaller bool OutputLimitLines uint64 + OutputSkbCB bool OutputFile string OutputJson bool @@ -82,6 +83,7 @@ func (f *Flags) SetFlags() { flag.BoolVar(&f.OutputStack, "output-stack", false, "print stack") flag.BoolVar(&f.OutputCaller, "output-caller", false, "print caller function name") flag.Uint64Var(&f.OutputLimitLines, "output-limit-lines", 0, "exit the program after the number of events has been received/printed") + flag.BoolVar(&f.OutputSkbCB, "output-skb-cb", false, "print skb->cb") flag.StringVar(&f.OutputFile, "output-file", "", "write traces to file")