Skip to content

Commit

Permalink
cilium: add visibility for all flags in CT dump
Browse files Browse the repository at this point in the history
While debugging #10942, I noticed that not all flags are currently
dumped in our bugtool report's CT list. Fix it by adding the missing
ones as well.

Also dump all unknown flags, so it is easier visible that we're
missing something.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
borkmann committed Apr 16, 2020
1 parent dccac17 commit e92fd24
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions pkg/maps/ctmap/types.go
Expand Up @@ -487,12 +487,15 @@ type CtEntry struct {
func (c *CtEntry) GetValuePtr() unsafe.Pointer { return unsafe.Pointer(c) }

const (
RxClosing = 1 << 0
TxClosing = 1 << 1
Nat64 = 1 << 2
LBLoopback = 1 << 3
SeenNonSyn = 1 << 4
NodePort = 1 << 5
RxClosing = 1 << iota
TxClosing
Nat64
LBLoopback
SeenNonSyn
NodePort
ProxyRedirect
DSR
MaxFlags
)

func (c *CtEntry) flagsString() string {
Expand All @@ -517,6 +520,18 @@ func (c *CtEntry) flagsString() string {
if (c.Flags & NodePort) != 0 {
buffer.WriteString("NodePort ")
}
if (c.Flags & ProxyRedirect) != 0 {
buffer.WriteString("ProxyRedirect ")
}
if (c.Flags & DSR) != 0 {
buffer.WriteString("DSR ")
}

unknownFlags := c.Flags
unknownFlags &^= MaxFlags - 1
if unknownFlags != 0 {
buffer.WriteString(fmt.Sprintf("Unknown=%#04x ", unknownFlags))
}
buffer.WriteString("]")
return buffer.String()
}
Expand Down

0 comments on commit e92fd24

Please sign in to comment.